Changeset 166


Ignore:
Timestamp:
Aug 1, 2013, 5:11:07 PM (12 years ago)
Author:
David Azarewicz
Message:

added ability to ignore individual ports

Location:
trunk/src/os2ahci
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/os2ahci/Makefile

    r163 r166  
    3030# Define default build version if not specified in environment
    3131BLD_MAJOR=1
    32 BLD_MINOR=29 # must be 2 digits
     32BLD_MINOR=30 # must be 2 digits
    3333BLD_REV=0 # not used at this time
    3434FIXPACK=
     
    9090
    9191AFLAGS = -q
    92 # In order to build the SMP safe version you must have the updated devhelp.h and define OS2AHCI_SMP.
    93 CFLAGS= -ei -6 -d0 -bt=os2 -ms -zu -wx -ecc -zp1 -q -s -zgp -zfp -oi -DOS2AHCI_SMP
     92CFLAGS= -ei -6 -d0 -bt=os2 -ms -zu -wx -ecc -zp1 -q -s -zgp -zfp -oi
    9493CFLAGS_DEBUG = -ei -6 -d3 -hc -bt=os2 -ms -zu -ecc -zp1 -q -s -zgp -zfp -od
    9594
  • trunk/src/os2ahci/README

    r165 r166  
    154154                       (default = -1, all ports)
    155155
    156 Adapter-specific Options
    157 
    158 Option                 Description
    159 ------------------------------------------------------------------------------
    160 /i                     Ignore current adapter
     156/i                     Ignore current adapter if no port has been specified.
     157                       Otherwise, ignore the current port on the current adapter.
    161158
    162159Port-specific Options
     
    402399    be there anyway.
    403400  Fixed a defect in the SMART IOCtl.
     401  Added ability to ignore individual ports.
    404402
    405403v.1.29 12-Jun-2013 - David Azarewicz
  • trunk/src/os2ahci/ahci.c

    r165 r166  
    598598  dprintf("ahci_scan_ports: scanning ports on adapter %d\n", ad_no(ai));
    599599  for (p = 0; p < AHCI_MAX_PORTS; p++) {
    600     if (ai->port_map & (1UL << p)) {
    601 
    602       ddprintf("ahci_scan_ports: Wait till not busy on port %d\n", p);
    603       /* wait until all active commands have completed on this port */
    604       timer_init(&Timer, 250);
    605       while (ahci_port_busy(ai, p)) {
    606         if (timer_check_and_block(&Timer)) break;
     600    if (!(ai->port_map & (1UL << p))) continue;
     601    if (port_ignore[ad_no(ai)][p]) continue;
     602
     603    ddprintf("ahci_scan_ports: Wait till not busy on port %d\n", p);
     604    /* wait until all active commands have completed on this port */
     605    timer_init(&Timer, 250);
     606    while (ahci_port_busy(ai, p)) {
     607      if (timer_check_and_block(&Timer)) break;
     608    }
     609
     610    if (!init_complete) {
     611      if ((pc = ahci_save_port_config(ai, p)) == NULL) {
     612        goto exit_port_scan;
    607613      }
    608 
    609       if (!init_complete) {
    610         if ((pc = ahci_save_port_config(ai, p)) == NULL) {
    611           goto exit_port_scan;
    612         }
     614    }
     615
     616    /* start/reset port; if no device is attached, this is expected to fail */
     617    if (init_reset) {
     618      rc = ahci_reset_port(ai, p, 0);
     619    } else {
     620      ddprintf("ahci_scan_ports: (re)starting port %d\n", p);
     621      ahci_stop_port(ai, p);
     622      rc = ahci_start_port(ai, p, 0);
     623    }
     624    if (rc) {
     625      /* no device attached to this port */
     626      ai->port_map &= ~(1UL << p);
     627      goto restore_port_config;
     628    }
     629
     630    /* this port seems to have a device attached and ready for commands */
     631    ddprintf("ahci_scan_ports: port %d seems to be attached to a device; probing...\n", p);
     632
     633    /* Get ATA(PI) identity. The so-called signature gives us a hint whether
     634     * this is an ATA or an ATAPI device but we'll try both in either case;
     635     * the signature will merely determine whether we're going to probe for
     636     * an ATA or ATAPI device, first, in order to reduce the chance of sending
     637     * the wrong command (which would result in a port reset given the way
     638     * ahci_exec_polled_cmd() was implemented).
     639     */
     640    is_ata = readl(port_base(ai, p) + PORT_SIG) == 0x00000101UL;
     641    for (i = 0; i < 2; i++) {
     642      rc = ahci_exec_polled_cmd(ai, p, 0, 500,
     643                                (is_ata) ? ATA_CMD_ID_ATA : ATA_CMD_ID_ATAPI,
     644                                AP_VADDR, (void _far *) id_buf, 512,
     645                                AP_END);
     646      if (rc == 0) {
     647        break;
    613648      }
    614649
    615       /* start/reset port; if no device is attached, this is expected to fail */
    616       if (init_reset) {
    617         rc = ahci_reset_port(ai, p, 0);
    618       } else {
    619         ddprintf("ahci_scan_ports: (re)starting port %d\n", p);
    620         ahci_stop_port(ai, p);
    621         rc = ahci_start_port(ai, p, 0);
    622       }
    623       if (rc) {
    624         /* no device attached to this port */
    625         ai->port_map &= ~(1UL << p);
    626         goto restore_port_config;
    627       }
    628 
    629       /* this port seems to have a device attached and ready for commands */
    630       ddprintf("ahci_scan_ports: port %d seems to be attached to a device; probing...\n", p);
    631 
    632       /* Get ATA(PI) identity. The so-called signature gives us a hint whether
    633        * this is an ATA or an ATAPI device but we'll try both in either case;
    634        * the signature will merely determine whether we're going to probe for
    635        * an ATA or ATAPI device, first, in order to reduce the chance of sending
    636        * the wrong command (which would result in a port reset given the way
    637        * ahci_exec_polled_cmd() was implemented).
    638        */
    639       is_ata = readl(port_base(ai, p) + PORT_SIG) == 0x00000101UL;
    640       for (i = 0; i < 2; i++) {
    641         rc = ahci_exec_polled_cmd(ai, p, 0, 500,
    642                                   (is_ata) ? ATA_CMD_ID_ATA : ATA_CMD_ID_ATAPI,
    643                                   AP_VADDR, (void _far *) id_buf, 512,
    644                                   AP_END);
    645         if (rc == 0) {
    646           break;
    647         }
    648 
    649         /* try again with ATA/ATAPI swapped */
    650         is_ata = !is_ata;
    651       }
    652 
    653       if (rc == 0) {
    654         /* we have a valid IDENTIFY or IDENTIFY_PACKET response */
    655         ddphex(id_buf, 512, "ATA_IDENTIFY%s results:\n", (is_ata) ? "" : "_PACKET");
    656         ahci_setup_device(ai, p, 0, id_buf);
    657       } else {
    658         /* no device attached to this port */
    659         ai->port_map &= ~(1UL << p);
    660       }
    661 
    662     restore_port_config:
    663       if (pc != NULL) {
    664         ahci_restore_port_config(ai, p, pc);
    665       }
     650      /* try again with ATA/ATAPI swapped */
     651      is_ata = !is_ata;
     652    }
     653
     654    if (rc == 0) {
     655      /* we have a valid IDENTIFY or IDENTIFY_PACKET response */
     656      ddphex(id_buf, 512, "ATA_IDENTIFY%s results:\n", (is_ata) ? "" : "_PACKET");
     657      ahci_setup_device(ai, p, 0, id_buf);
     658    } else {
     659      /* no device attached to this port */
     660      ai->port_map &= ~(1UL << p);
     661    }
     662
     663  restore_port_config:
     664    if (pc != NULL) {
     665      ahci_restore_port_config(ai, p, pc);
    666666    }
    667667  }
  • trunk/src/os2ahci/os2ahci.c

    r165 r166  
    144144u8              link_power[MAX_AD][AHCI_MAX_PORTS];
    145145u8              track_size[MAX_AD][AHCI_MAX_PORTS];
     146u8              port_ignore[MAX_AD][AHCI_MAX_PORTS];
    146147
    147148static char     init_msg[] = "%s driver version %d.%02d\n";
     
    324325        /* ignore current adapter index */
    325326        if (adapter_index >= 0) {
    326           ad_ignore |= 1U << adapter_index;
     327          if (port_index >= 0) port_ignore[adapter_index][port_index] = !invert_option;
     328          else ad_ignore |= 1U << adapter_index;
    327329        }
    328330        break;
     
    400402  }
    401403
    402   /* print initialization message */
    403   ciprintf(init_msg, drv_name, VERSION / 100, VERSION % 100);
    404 
    405404  if (com_baud) init_com(com_baud); /* initialize com port for debug output */
    406405
     
    415414  ntprintf("BldLevel: %s\n", BldLevel);
    416415  ntprintf("CmdLine: %Fs\n", cmd_line);
     416
     417  /* print initialization message */
     418  ciprintf(init_msg, drv_name, VERSION / 100, VERSION % 100);
    417419
    418420  /* scan PCI bus for supported devices */
  • trunk/src/os2ahci/os2ahci.h

    r165 r166  
    654654extern u8            link_power[MAX_AD][AHCI_MAX_PORTS];
    655655extern u8            track_size[MAX_AD][AHCI_MAX_PORTS];
    656 
     656extern u8            port_ignore[MAX_AD][AHCI_MAX_PORTS];
     657
  • trunk/src/os2ahci/pci.c

    r164 r166  
    610610
    611611  /* found a supported AHCI device */
    612   ciiprintf("found AHCI device: %s %s (%04x:%04x) class:0x%06lx bus:%d devfunc:0x%02x\n",
     612  ciiprintf("Found AHCI device %s %s (%d:%d:%d %04x:%04x) class:0x%06lx\n",
    613613            vendor_from_id(vendor), device_from_id(device),
    614             vendor, device,
    615             class, bus, dev_func);
    616 
    617   dprintf("found AHCI device: %s %s (%04x:%04x) class:0x%06lx bus:%d devfunc:0x%02x\n",
    618             vendor_from_id(vendor), device_from_id(device),
    619             vendor, device,
    620             class, bus, dev_func);
     614            bus, dev_func>>3, dev_func&7, vendor, device, class);
    621615
    622616  /* make sure we got room in the adapter information array */
  • trunk/src/os2ahci/trace.c

    r165 r166  
    220220    AD_INFO *ai = ad_infos + a;
    221221
    222     ntprintf("Adapter %d: PCI=%d:%d:%d ID=%x:%x irq=%d addr=0x%lx version=%lx\n", a,
     222    ntprintf("Adapter %d: PCI=%d:%d:%d ID=%04x:%04x irq=%d addr=0x%lx version=%lx\n", a,
    223223      ai->bus, ai->dev_func>>3, ai->dev_func&7,
    224224      ai->pci->vendor, ai->pci->device,
Note: See TracChangeset for help on using the changeset viewer.