コード例 #1
0
ファイル: DefaultIDEIO.java プロジェクト: neoedmund/jnode
 /** Stop this processor. */
 public void release() {
   cmdBlock.release();
   ctrlBlock.release();
 }
コード例 #2
0
ファイル: DefaultIDEIO.java プロジェクト: neoedmund/jnode
  /** Create a new instance */
  protected DefaultIDEIO(Device device, boolean primary)
      throws IllegalArgumentException, DriverException, ResourceNotFreeException {

    int cmdBlockStart = (primary ? IDE0_START_PORT : IDE1_START_PORT);
    int ctrlBlockStart = cmdBlockStart + HIGH_OFFSET;
    int cmdBlockSize = IDE_NR_PORTS;
    int ctrlBlockSize = IDE_NR_HIGH_PORTS;
    int altStatusPort = ctrlBlockStart + R8_ALTSTATUS_OFFSET;
    int irq = (primary ? IDE0_IRQ : IDE1_IRQ);
    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 + "]");

    // Now claim the resources
    IOResource cmdBlock = null;
    IOResource ctrlBlock = null;
    final ResourceManager rm;
    try {
      rm = InitialNaming.lookup(ResourceManager.NAME);
      cmdBlock = claimPorts(rm, device, cmdBlockStart, cmdBlockSize);
      ctrlBlock = claimPorts(rm, device, ctrlBlockStart, ctrlBlockSize);
    } catch (NameNotFoundException ex) {
      throw new ResourceNotFreeException("Cannot find ResourceManager", ex);
    } catch (ResourceNotFreeException ex) {
      if (cmdBlock != null) {
        cmdBlock.release();
      }
      if (ctrlBlock != null) {
        ctrlBlock.release();
      }
      throw ex;
    }
    this.irq = irq;
    this.cmdBlockStart = cmdBlockStart;
    this.ctrlBlockStart = ctrlBlockStart;
    this.cmdBlock = cmdBlock;
    this.ctrlBlock = ctrlBlock;
    this.altStatusPort = altStatusPort;
  }
コード例 #3
0
ファイル: UHCIIO.java プロジェクト: NanoGame/jnode
 /** Release all resources */
 public void release() {
   io.release();
 }