final int getCommand() { return mem.getInt(2); }
final int getLink() { return mem.getInt(4); }
final int getStatus() { return mem.getInt(0); }
final int getCount() { return mem.getInt(12); }
/** * @param driver * @param architecture * @param model * @param device */ public RadeonCore(RadeonDriver driver, int architecture, String model, PCIDevice device) throws ResourceNotFreeException, DriverException { this.driver = driver; this.fbinfo = new FBInfo(architecture); final PCIHeaderType0 pciCfg = device.getConfig().asHeaderType0(); final PCIBaseAddress ioAddr = pciCfg.getBaseAddresses()[2]; final PCIBaseAddress fbAddr = pciCfg.getBaseAddresses()[0]; final PCIRomAddress romAddr = pciCfg.getRomAddress(); log.info("Found ATI " + model + ", chipset 0x" + NumberUtils.hex(pciCfg.getRevision())); try { final ResourceManager rm = InitialNaming.lookup(ResourceManager.NAME); final int ioBase = (int) ioAddr.getMemoryBase(); final int ioSize = ioAddr.getSize(); final int fbBase = (int) fbAddr.getMemoryBase() /* & 0xFF800000 */; // Map Memory Mapped IO this.mmio = rm.claimMemoryResource( device, Address.fromIntZeroExtend(ioBase), ioSize, ResourceManager.MEMMODE_NORMAL); this.vgaIO = new RadeonVgaIO(mmio); final int memSize = readMemorySize(); log.info("Memory size " + NumberUtils.toBinaryByte(memSize)); this.accel = new RadeonAcceleration(vgaIO); // Map Device RAM this.deviceRam = rm.claimMemoryResource( device, Address.fromIntZeroExtend(fbBase), memSize, ResourceManager.MEMMODE_NORMAL); vgaIO.setVideoRam(deviceRam); // Find ROM MemoryResource rom = null; if (romAddr != null) { romAddr.setEnabled(true); if (romAddr.isEnabled()) { rom = rm.claimMemoryResource( device, Address.fromIntZeroExtend(romAddr.getRomBase()), romAddr.getSize(), ResourceManager.MEMMODE_NORMAL); if (!verifyBiosSignature(rom)) { log.info("Signature mismatch"); rom.release(); rom = null; } } else { log.debug("Failed to enabled expansion ROM"); } } if (rom == null) { // Use the ISA regions rom instead rom = findRom(device, rm); } this.rom = rom; log.debug( "Found ATI " + model + ", FB at 0x" + NumberUtils.hex(fbBase) + "s0x" + NumberUtils.hex(memSize) + ", MMIO at 0x" + NumberUtils.hex(ioBase) + ", ROM " + pciCfg.getRomAddress()); fbinfo.readMonitorInfo(vgaIO); if (this.rom != null) { log.info("ROM[0-3] 0x" + NumberUtils.hex(rom.getInt(0))); // Read monitor information fbinfo.readFPIInfo(rom); } } catch (NameNotFoundException ex) { throw new ResourceNotFreeException(ex); } // Read the current state of the device this.oldVgaState = new RadeonVgaState(architecture, fbinfo.hasCRTC2, vgaIO); this.currentState = new RadeonVgaState(architecture, fbinfo.hasCRTC2, vgaIO); // Claim the first 128K for VGA only deviceRam.claimChildResource(0, 128 * 1024, false); // Allocate the hardware cursor this.hwCursor = new RadeonHardwareCursor(this, vgaIO); }
/** * Gets an 32-bit MMIO value * * @param index * @return */ final int getReg32(int index) { return mmio.getInt(index); }
/** * Get a FB value at the given offset * * @param offset */ public int getFB(int offset) { return mmio.getInt(PFB_OFS + offset); }