Changeset 71


Ignore:
Timestamp:
Feb 15, 2011, 1:18:21 PM (14 years ago)
Author:
chris
Message:
  • Added minimum NCQ depth for SATA devices which don't support NCQ at all
  • Removed ATAPI devices from the flush cache queue as they caused timeouts with a DVD drive in an HP test box
  • Various cosmetic changes to debug levels, etc.
Location:
trunk/src/os2ahci
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/os2ahci/ahci.c

    r69 r71  
    553553
    554554  /* enable interrupts on PCI-level (PCI 2.3 added a feature to disable ints) */
    555   pci_enable_int(ai->bus, ai->dev_func);
     555  /* pci_enable_int(ai->bus, ai->dev_func); */
    556556
    557557  return(0);
     
    11031103int ahci_flush_cache(AD_INFO *ai, int p, int d)
    11041104{
    1105   dprintf("flushing cache on %d.%d.%d\n", ad_no(ai), p, d);
    1106   return(ahci_exec_polled_cmd(ai, p, d, 30000,
    1107                               ai->ports[p].devs[d].lba48 ? ATA_CMD_FLUSH_EXT
    1108                                                          : ATA_CMD_FLUSH,
    1109                               AP_END));
     1105  if (!ai->ports[p].devs[d].atapi) {
     1106    dprintf("flushing cache on %d.%d.%d\n", ad_no(ai), p, d);
     1107    return(ahci_exec_polled_cmd(ai, p, d, 30000,
     1108                                ai->ports[p].devs[d].lba48 ? ATA_CMD_FLUSH_EXT
     1109                                                           : ATA_CMD_FLUSH,
     1110                                AP_END));
     1111  }
    11101112}
    11111113
     
    13971399  int d = iorb_unit_device(iorb);
    13981400
    1399   dphex(((IORB_ADAPTER_PASSTHRU _far *) iorb)->pControllerCmd,
    1400         ((IORB_ADAPTER_PASSTHRU _far *) iorb)->ControllerCmdLen,
    1401         "ahci_execute_cdb(%d.%d.%d)", a, p, d);
    1402 
    14031401  if (ad_infos[a].ports[p].devs[d].atapi) {
    14041402    ahci_exec_iorb(iorb, 0, atapi_execute_cdb);
     
    14711469      dprintf("NCQ off for a:%d p:%d\n", (int) ad_no(ai), p);
    14721470    } else {
    1473       ai->ports[p].devs[d].ncq_max = id_buf[ATA_ID_QUEUE_DEPTH] & 0x001fU;
     1471      ai->ports[p].devs[d].ncq_max = max(1, id_buf[ATA_ID_QUEUE_DEPTH] & 0x001fU);
    14741472      dprintf("NCQ max=%d for a:%d p:%d\n", ai->ports[p].devs[d].ncq_max, (int) ad_no(ai), p);
    14751473    }
     
    15181516  if (ai == ad_infos && p == 7 &&
    15191517      ai->pci->vendor == 0x8086 && ai->pci->device == 0x2829 &&
    1520       !memcmp(ds.DevDescriptName, "VBOX HARDDISK", 13)) {
     1518      !memcmp(ata_dev_name(id_buf), "VBOX HARDDISK", 13)) {
    15211519    /* running inside virtualbox */
    15221520    pci_hack_virtualbox();
  • trunk/src/os2ahci/ata.c

    r70 r71  
    624624
    625625  io->BlocksXferred += add_workspace(iorb)->blocks;
    626   ddprintf("ata(pi)_read_pp(): blocks transferred = %d\n", (int) io->BlocksXferred);
     626  dprintf("ata_read_pp(): blocks transferred = %d\n", (int) io->BlocksXferred);
    627627
    628628  if (io->BlocksXferred >= io->BlockCount) {
     
    756756
    757757  io->BlocksXferred += add_workspace(iorb)->blocks;
    758   ddprintf("ata_write_pp(): blocks transferred = %d\n", (int) io->BlocksXferred);
     758  dprintf("ata_write_pp(): blocks transferred = %d\n", (int) io->BlocksXferred);
    759759
    760760  if (io->BlocksXferred >= io->BlockCount) {
  • trunk/src/os2ahci/atapi.c

    r69 r71  
    5353int atapi_unit_ready(IORBH _far *iorb, int slot)
    5454{
    55   dprintf("atapi_unit_ready called\n");
     55  ddprintf("atapi_unit_ready called\n");
    5656  iorb_seterr(iorb, IOERR_CMD_NOT_SUPPORTED);
    5757  return(-1);
     
    123123int atapi_verify(IORBH _far *iorb, int slot)
    124124{
    125   dprintf("atapi_verify called\n");
     125  ddprintf("atapi_verify called\n");
    126126  iorb_seterr(iorb, IOERR_CMD_NOT_SUPPORTED);
    127127  return(-1);
     
    133133int atapi_write(IORBH _far *iorb, int slot)
    134134{
    135   dprintf("atapi_write called\n");
     135  ddprintf("atapi_write called\n");
    136136  iorb_seterr(iorb, IOERR_CMD_NOT_SUPPORTED);
    137137  return(-1);
     
    241241  ATAPI_SENSE_DATA *psd = (ATAPI_SENSE_DATA *) aws->buf;
    242242
    243   ddphex(psd, sizeof(psd), "sense buffer:\n");
     243  dphex(psd, sizeof(psd), "sense buffer:\n");
    244244
    245245  /* map sense data to some IOERR_ value */
  • trunk/src/os2ahci/libc.c

    r66 r71  
    7373  int reg;
    7474  u8  data;
    75 } com1_init_sequence[] = {
     75} com_init_sequence[] = {
    7676  3, 0x80,   /* overlay divisor latch register at 0x3f8 and 0x3f9 */
    7777  0, 0x01,   /* set low byte of divisor to 1 (115200 baud) */
     
    107107  int i;
    108108
    109   DevHelp_CreateSpinLock(&com_lock);
    110 
    111   for (i = 0; com1_init_sequence[i].reg != -1; i++) {
    112     u16 port = com_base + com1_init_sequence[i].reg;
    113     u8  data = com1_init_sequence[i].data;
     109  spin_lock(com_lock);
     110
     111  for (i = 0; com_init_sequence[i].reg != -1; i++) {
     112    u16 port = com_base + com_init_sequence[i].reg;
     113    u8  data = com_init_sequence[i].data;
    114114    _asm {
    115115      mov  dx, port;
     
    118118    }
    119119  }
     120
     121  spin_unlock(com_lock);
    120122}
    121123
  • trunk/src/os2ahci/os2ahci.c

    r69 r71  
    964964  }
    965965
    966   dprintf("IORB queued:  %d/%d (queue = %Fp, IORB = %Fp)\n",
    967           iorb->CommandCode, iorb->CommandModifier, queue, iorb);
     966  ddprintf("IORB queued:  %d/%d (queue = %Fp, IORB = %Fp)\n",
     967           iorb->CommandCode, iorb->CommandModifier, queue, iorb);
    968968}
    969969
     
    995995
    996996  if (found) {
    997     dprintf("IORB removed: %d/%d (queue = %Fp, IORB = %Fp) - %04x/%04x\n",
    998             iorb->CommandCode, iorb->CommandModifier, queue, iorb,
    999             iorb->Status, iorb->ErrorCode);
     997    ddprintf("IORB removed: %d/%d (queue = %Fp, IORB = %Fp) - %04x/%04x\n",
     998             iorb->CommandCode, iorb->CommandModifier, queue, iorb,
     999             iorb->Status, iorb->ErrorCode);
    10001000  } else {
    10011001    dprintf("IORB %Fp not found in queue %Fp\n", iorb, queue);
  • trunk/src/os2ahci/os2ahci.def

    r69 r71  
    11library os2ahci
    2 Description '$@#thi.guten (www.thiguten.de):1.00.20110107#@OS/2 AHCI Adapter Device Driver'
     2Description '$@#thi.guten (www.thiguten.de):1.00.20110215#@OS/2 AHCI Adapter Device Driver'
    33protmode
    44
  • trunk/src/os2ahci/os2ahci.h

    r69 r71  
    7979
    8080/* max/min macros */
    81 #define max(a, b)  a > b ? a : b
    82 #define min(a, b)  a < b ? a : b
     81#define max(a, b)  (a) > (b) ? (a) : (b)
     82#define min(a, b)  (a) < (b) ? (a) : (b)
    8383
    8484/* debug output macros */
Note: See TracChangeset for help on using the changeset viewer.