Package org.jnode.driver.bus.pci

Examples of org.jnode.driver.bus.pci.PCIDeviceConfig


        boolean nativeMode = false;

        // Detect PCI IDE Controller, look for enhanced mode
        if (device instanceof PCIDevice) {
            final PCIDevice pciDev = (PCIDevice) device;
            final PCIDeviceConfig pciCfg = pciDev.getConfig();
            final int pIntf = pciCfg.getMinorClass();
            final int progMask = 0x02 | 0x08;
            final int enhModeMask = 0x01 | 0x04;
            if ((pIntf & progMask) == progMask) {
                // Mode is programmable, set enhanced mode
                //pciCfg.setMinorClass(pIntf | enhModeMask);               
            }
            if ((pciCfg.getMinorClass() & enhModeMask) == enhModeMask) {
                // Use enhanced mode
                final PCIBaseAddress[] baseAddrs = pciCfg.asHeaderType0().getBaseAddresses();
                final int idx = (primary ? 0 : 2);
                cmdBlockStart = baseAddrs[idx].getIOBase();
                cmdBlockSize = 8;
                ctrlBlockStart = baseAddrs[idx + 1].getIOBase();
                ctrlBlockSize = 4;
                altStatusPort = ctrlBlockStart + 0x02;
                irq = pciCfg.asHeaderType0().getInterruptLine();
                nativeMode = true;
            }
        }

        log.info("Using PCI IDE " + (nativeMode ? "Native" : "Compatibility") + " mode [irq=" + irq + "]");
View Full Code Here


    public Driver findDriver(Device device) {
        if (!(device instanceof PCIDevice)) {
            return null;
        }
        final PCIDevice dev = (PCIDevice) device;
        final PCIDeviceConfig config = dev.getConfig();

        if (config.getVendorID() != PCI_IDs.PCI_VENDOR_ID_INTEL)
            return null;

        switch (config.getDeviceID()) {

            // 440BX chipset members
            case 0x7110:
                //firmware=new BIOS(); // we assume this is a BIOS system, not an EFI
                //return new i82371AB_ISABridge();
View Full Code Here

    public Driver findDriver(Device device) {
        if (!(device instanceof PCIDevice)) {
            return null;
        }
        final PCIDevice dev = (PCIDevice) device;
        final PCIDeviceConfig config = dev.getConfig();

        if (config.getVendorID() != PCI_IDs.PCI_VENDOR_ID_VIATEC) {
            return null;
        }

        switch (config.getDeviceID()) {
            case 0x0305:
                return new Via8363_0();
            case 0x0686:
                return new Via82C686();
            default:
View Full Code Here

     */
    public Mach64Core(Mach64Driver driver, String model, PCIDevice device)
        throws ResourceNotFreeException, DriverException {
        this.driver = driver;

        final PCIDeviceConfig pciCfg = device.getConfig();
        // Disable VGA I/O, enable memory mapped I/O
        int cmd = pciCfg.getCommand();
        cmd &= ~PCIConstants.PCI_COMMAND_IO;
        cmd |= PCIConstants.PCI_COMMAND_MEMORY;
        pciCfg.setCommand(cmd);

        final PCIBaseAddress fbAddr = pciCfg.asHeaderType0().getBaseAddresses()[0];

        log.info("Found ATI " + model + ", pci " + pciCfg);

        try {
            final ResourceManager rm = InitialNaming.lookup(ResourceManager.NAME);

            final int fbBase = (int) fbAddr.getMemoryBase() /* & 0xFF800000 */;
            final int memSize = fbAddr.getSize();
            log.info("Memory size " + NumberUtils.toBinaryByte(memSize));

            // Map Device RAM
            this.deviceRam =
                    rm.claimMemoryResource(device, Address.fromIntZeroExtend(fbBase), memSize,
                            ResourceManager.MEMMODE_NORMAL);

            // Map MMIO block 0, first test for 8Mb framebuffers.
            Offset block0Ofs = Offset.fromIntZeroExtend(0x7ffc00);
            Extent mmioSize = Extent.fromIntZeroExtend(1024); // 1K
            MemoryResource mmio0 = deviceRam.claimChildResource(block0Ofs, mmioSize, false);
            Mach64VgaIO io = new Mach64VgaIO(deviceRam, mmio0);
            if ((io.getReg32(CONFIG_CHIP_ID) & CFG_CHIP_TYPE) != pciCfg.getDeviceID()) {
                // Try for 4Mb framebuffers.
                mmio0.release();
                block0Ofs = Offset.fromIntZeroExtend(0x3ffc00);
                mmio0 = deviceRam.claimChildResource(block0Ofs, mmioSize, false);
                io = new Mach64VgaIO(deviceRam, mmio0);
                if ((io.getReg32(CONFIG_CHIP_ID) & CFG_CHIP_TYPE) != pciCfg.getDeviceID()) {
                    throw new DriverException("Cannot find block0 registers.");
                }
            }
            this.vgaIO = io;
            this.mmio0 = mmio0;
View Full Code Here

        if (!(device instanceof PCIDevice))
            return null;

        //checking display controller device class
        final PCIDevice pciDev = (PCIDevice) device;
        final PCIDeviceConfig cfg = pciDev.getConfig();
        if ((cfg.getBaseClass() & 0xFFFFFF) != DISPLAY_CONTROLLER_PCI_DEVICE_CLASS)
            return null;

        //checking the VESA mode set up by GRUB
        Address vbeControlInfo = UnsafeX86.getVbeControlInfos();
        VbeInfoBlock vbeInfoBlock = new VbeInfoBlock(vbeControlInfo);
View Full Code Here

     *
     * @param device
     */
    public UHCICore(PCIDevice device) throws DriverException, ResourceNotFreeException {
        this.device = device;
        final PCIDeviceConfig cfg = device.getConfig();
        final PCIBaseAddress baseAddr = getBaseAddress(cfg);
        try {
            this.rm = InitialNaming.lookup(ResourceManager.NAME);
            final int ioBase = baseAddr.getIOBase();
            final int ioSize = baseAddr.getSize();
            log.info("Found UHCI at 0x" + NumberUtils.hex(ioBase));

            this.io = new UHCIIO(claimPorts(rm, device, ioBase, ioSize));
            this.bus = new USBBus(device, this);
            this.rootHub = new UHCIRootHub(io, bus);
            final Schedule schedule = new Schedule(rm);
            this.pipeMgr = new UHCIPipeManager(rm, schedule);

            final int irqNr = cfg.asHeaderType0().getInterruptLine() & 0xF;
            // Workaround for some VIA chips
            cfg.asHeaderType0().setInterruptLine(irqNr);
            this.irq = rm.claimIRQ(device, irqNr, this, true);
            log.debug("Using IRQ " + irqNr);

            // Reset the HC
            resetHC();
View Full Code Here

TOP

Related Classes of org.jnode.driver.bus.pci.PCIDeviceConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.