Package org.jnode.system.resource

Examples of org.jnode.system.resource.ResourceManager


        log.debug("Found VMWare SVGA device using ports 0x" + NumberUtils.hex(indexPort) +
            " and 0x" + NumberUtils.hex(valuePort));

        try {
            // Allocate IO register space
            final ResourceManager rm = InitialNaming.lookup(ResourceManager.NAME);
            ports = claimPorts(rm, device, basePort, SVGA_NUM_PORTS * 4);

            // Detect deviceID
            deviceId = getVMWareID();
            if (deviceId == SVGA_ID_0 || deviceId == SVGA_ID_INVALID) {
                dumpState();
                throw new DriverException("No supported VMWare SVGA found, found id 0x" +
                    NumberUtils.hex(deviceId));
            } else {
                log.debug("VMWare SVGA ID: 0x" + NumberUtils.hex(deviceId));
            }

            // Initialize and start FIFO
            fifoMem = initFifo(device, rm);

            // Read info
            this.capabilities = getReg32(SVGA_REG_CAPABILITIES);
            this.fifoCapabilities = hasCapability(SVGA_CAP_EXTENDED_FIFO) ? getFIFO(SVGA_FIFO_CAPABILITIES) : 0;
            this.videoRamSize = getReg32(SVGA_REG_FB_MAX_SIZE);
            this.maxWidth = getReg32(SVGA_REG_MAX_WIDTH);
            this.maxHeight = getReg32(SVGA_REG_MAX_HEIGHT);
            final int bitsPerPixel = getReg32(SVGA_REG_BITS_PER_PIXEL);
            this.bytesPerLine = getReg32(SVGA_REG_BYTES_PER_LINE);

            // Allocate framebuffer memory
            final Address videoRamAddr;
            if (device.getConfig().getDeviceID() == PCI_DEVICE_ID_VMWARE_SVGA2) {
                videoRamAddr =
                    Address.fromLong(device.getConfig().asHeaderType0().getBaseAddresses()[1].getMemoryBase());
            } else {
                videoRamAddr = Address.fromIntZeroExtend(SVGA_REG_FB_START);

            }
            this.videoRam = rm.claimMemoryResource(device, videoRamAddr, videoRamSize, ResourceManager.MEMMODE_NORMAL);
            this.bitsPerPixel = bitsPerPixel;
            switch (bitsPerPixel) {
                case 8:
                    bitmapGraphics =
                        BitmapGraphics.create8bppInstance(videoRam, width, height,
View Full Code Here


        this.tx_active = false;

        // Get the start of the IO address space
        this.iobase = getIOBase(device, flags);
        final int iolength = getIOLength(device, flags);
        final ResourceManager rm;
        try {
            rm = InitialNaming.lookup(ResourceManager.NAME);
        } catch (NameNotFoundException ex) {
            throw new DriverException("Cannot find ResourceManager");
        }
        this.irq = rm.claimIRQ(owner, irq, this, true);
        try {
            io = rm.claimIOResource(owner, iobase, iolength);
        } catch (ResourceNotFreeException ex) {
            this.irq.release();
            throw ex;
        }
        this.rxRing = new _3c90xRxRing(RX_FRAMES, rm);
View Full Code Here

        this.iobase = getIOBase(device, this.flags);

        final int iolength = getIOLength(device, this.flags);
        // log.debug("RTL8139 driver iobase "+iobase+" irq "+irq);

        final ResourceManager rm;

        try {
            rm = InitialNaming.lookup(ResourceManager.NAME);
        } catch (NameNotFoundException ex) {
            throw new DriverException("Cannot find ResourceManager");
        }

        this.irq = rm.claimIRQ(owner, irq, this, true);

        try {
            io = claimPorts(rm, owner, iobase, iolength);
        } catch (ResourceNotFreeException ex) {
            this.irq.release();
View Full Code Here

        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
View Full Code Here

        this.driver = driver;
        Address address = Address.fromIntZeroExtend(modeInfoBlock.getRamBase());

        try {
            final ResourceManager rm = InitialNaming.lookup(ResourceManager.NAME);
            this.capabilities = vbeInfoBlock.getCapabilities();
            this.maxWidth = modeInfoBlock.getXResolution();
            this.maxHeight = modeInfoBlock.getYResolution();
            this.bitsPerPixel = modeInfoBlock.getBitsPerPixel();

            int multiplier = 1;
            if (bitsPerPixel == 16)
                multiplier = 2;
            else if (bitsPerPixel == 24)
                multiplier = 3;
            else if (bitsPerPixel == 32)
                multiplier = 4;

            this.bytesPerLine = modeInfoBlock.getXResolution() * multiplier;
            this.videoRamSize = bytesPerLine * modeInfoBlock.getYResolution();

            this.videoRam =
                    rm.claimMemoryResource(device, address, videoRamSize,
                            ResourceManager.MEMMODE_NORMAL);

            BitmapGraphics graphics;
            switch (bitsPerPixel) {
                case 8:
View Full Code Here

        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();
View Full Code Here

        final PCIHeaderType0 pciCfg = device.getConfig().asHeaderType0();
        final PCIBaseAddress ioAddr = pciCfg.getBaseAddresses()[0];
        final PCIBaseAddress fbAddr = pciCfg.getBaseAddresses()[1];
        log.info("Found NVidia " + model + ", chipset 0x" + NumberUtils.hex(pciCfg.getRevision()));
        try {
            final ResourceManager rm = InitialNaming.lookup(ResourceManager.NAME);
            final int ioBase = (int) ioAddr.getMemoryBase() & 0xFF800000;
            final int ioSize = ioAddr.getSize();
            final int fbBase = (int) fbAddr.getMemoryBase() & 0xFF800000;
            final int fbSize = fbAddr.getSize();

            log.debug("Found NVidia, FB at 0x" + NumberUtils.hex(fbBase) + "s0x" +
                    NumberUtils.hex(fbSize) + ", MMIO at 0x" + NumberUtils.hex(ioBase));

            this.mmio =
                    rm.claimMemoryResource(device, Address.fromIntZeroExtend(ioBase), ioSize,
                            ResourceManager.MEMMODE_NORMAL);
            this.videoRam =
                    rm.claimMemoryResource(device, Address.fromIntZeroExtend(fbBase), fbSize,
                            ResourceManager.MEMMODE_NORMAL);
            this.vgaIO = new NVidiaVgaIO(mmio, videoRam);

        } catch (NameNotFoundException ex) {
            throw new ResourceNotFreeException(ex);
View Full Code Here

                + ", device-vendor ID 0x"
                + NumberUtils.hex(pciCfg.getDeviceID() << 16 + pciCfg
                        .getVendorID()));

        try {
            final ResourceManager rm = (ResourceManager) InitialNaming
                    .lookup(ResourceManager.NAME);
            final IOResource ports = claimPorts(rm, device, CIRRUS_FIRST_PORT,
                    CIRRUS_LAST_PORT - CIRRUS_FIRST_PORT);
            final int mmioBase = (int) mmioAddr.getMemoryBase() & 0xFF000000;
            final int mmioSize = mmioAddr.getSize();
            final int fbBase = (int) fbAddr.getMemoryBase() & 0xFF000000;
            final int fbSize = fbAddr.getSize();

            log.info("Found Cirrus, FB at 0x" + NumberUtils.hex(fbBase)
                    + " s0x" + NumberUtils.hex(fbSize) + ", MMIO at 0x"
                    + NumberUtils.hex(mmioBase) + " s0x"
                    + NumberUtils.hex(mmioSize));

            // TODO: support move of videoRam to an upper bank for byte swapping
            // (i.e. non LE)

            this.mmio = rm.claimMemoryResource(device, Address
                    .fromIntZeroExtend(mmioBase), mmioSize,
                    ResourceManager.MEMMODE_NORMAL);
            this.videoRam = rm.claimMemoryResource(device, Address
                    .fromIntZeroExtend(fbBase), fbSize,
                    ResourceManager.MEMMODE_NORMAL);

            this.vgaIO = new CirrusMMIO(mmio, ports);
View Full Code Here

     * @return the IRQResource for the driver in question
     */
    final synchronized IRQResource claimResources(ResourceOwner owner, int irq)
        throws DriverException {
        try {
            final ResourceManager rm;
            try {
                rm = InitialNaming.lookup(ResourceManager.NAME);
            } catch (NameNotFoundException ex) {
                throw new DriverException("Cannot find ResourceManager: ", ex);
            }
            if (ioResData == null) {
                ioResData = claimPorts(rm, owner, PS2_DATA_PORT, 1);
                ioResCtrl = claimPorts(rm, owner, PS2_CTRL_PORT, 1);
            }
            final IRQResource irqRes = rm.claimIRQ(owner, irq, this, true);
            if (activeCount == 0) {
                flush();
            }
            activeCount++;
            return irqRes;
View Full Code Here

     * Create a new instance
     */
    public StandardVGAIO(ResourceOwner owner, MemoryResource mem) throws ResourceNotFreeException,
            DriverException {
        try {
            ResourceManager rm = InitialNaming.lookup(ResourceManager.NAME);
            vgaIO = claimPorts(rm, owner, VGA_FIRST_PORT, VGA_LAST_PORT - VGA_FIRST_PORT + 1);
            this.mem = mem;
            current_mode = getColorMode();
        } catch (NameNotFoundException ex) {
            throw new ResourceNotFreeException("Cannot find ResourceManager", ex);
View Full Code Here

TOP

Related Classes of org.jnode.system.resource.ResourceManager

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.