Ignore:
Timestamp:
Dec 13, 2016, 3:07:49 AM (9 years ago)
Author:
David Azarewicz
Message:

Debugging changes

File:
1 edited

Legend:

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

    r178 r181  
    207207#endif
    208208
     209int AllocPortData(AD_INFO *ai, int p)
     210{
     211  if (ai->ports[p]) return 0;
     212  ai->ports[p] = MemAlloc(sizeof(P_INFO));
     213  if (ai->ports[p] == NULL) return 1;
     214  memset(ai->ports[p], 0, sizeof(P_INFO));
     215  return 0;
     216}
     217
     218FreePortData(AD_INFO *ai, int p)
     219{
     220}
     221
    209222/******************************************************************************
    210223 * Save BIOS configuration of AHCI adapter. As a side effect, this also saves
     
    605618    if (port_ignore[ad_no(ai)][p]) continue;
    606619
     620    // DAZ allocate port structure here
     621
    607622    DPRINTF(3,"ahci_scan_ports: Wait till not busy on port %d\n", p);
    608623    /* wait until all active commands have completed on this port */
     
    629644      rc = ahci_start_port(ai, p, 0);
    630645    }
    631     if (rc)
    632     {
    633       /* no device attached to this port */
    634       ai->port_map &= ~(1UL << p);
    635       goto restore_port_config;
    636     }
    637 
    638     /* this port seems to have a device attached and ready for commands */
    639     DPRINTF(1,"ahci_scan_ports: port %d seems to be attached to a device; probing...\n", p);
    640 
    641     /* Get ATA(PI) identity. The so-called signature gives us a hint whether
    642      * this is an ATA or an ATAPI device but we'll try both in either case;
    643      * the signature will merely determine whether we're going to probe for
    644      * an ATA or ATAPI device, first, in order to reduce the chance of sending
    645      * the wrong command (which would result in a port reset given the way
    646      * ahci_exec_polled_cmd() was implemented).
    647      */
    648     is_ata = readl(port_base(ai, p) + PORT_SIG) == 0x00000101UL;
    649     for (i = 0; i < 2; i++)
    650     {
    651       rc = ahci_exec_polled_cmd(ai, p, 0, 500,
    652                                 (is_ata) ? ATA_CMD_ID_ATA : ATA_CMD_ID_ATAPI,
    653                                 AP_VADDR, (void *) id_buf, ATA_ID_WORDS * sizeof(u16),
    654                                 AP_END);
    655       if (rc == 0) break;
    656 
    657       /* try again with ATA/ATAPI swapped */
    658       is_ata = !is_ata;
     646
     647    if (rc == 0)
     648    {
     649      /* this port seems to have a device attached and ready for commands */
     650      DPRINTF(1,"ahci_scan_ports: port %d seems to be attached to a device; probing...\n", p);
     651
     652      /* Get ATA(PI) identity. The so-called signature gives us a hint whether
     653       * this is an ATA or an ATAPI device but we'll try both in either case;
     654       * the signature will merely determine whether we're going to probe for
     655       * an ATA or ATAPI device, first, in order to reduce the chance of sending
     656       * the wrong command (which would result in a port reset given the way
     657       * ahci_exec_polled_cmd() was implemented).
     658       */
     659      is_ata = readl(port_base(ai, p) + PORT_SIG) == 0x00000101UL;
     660      for (i = 0; i < 2; i++)
     661      {
     662        rc = ahci_exec_polled_cmd(ai, p, 0, 500,
     663                                  (is_ata) ? ATA_CMD_ID_ATA : ATA_CMD_ID_ATAPI,
     664                                  AP_VADDR, (void *) id_buf, ATA_ID_WORDS * sizeof(u16),
     665                                  AP_END);
     666        if (rc == 0) break;
     667
     668        /* try again with ATA/ATAPI swapped */
     669        is_ata = !is_ata;
     670      }
    659671    }
    660672
     
    669681      /* no device attached to this port */
    670682      ai->port_map &= ~(1UL << p);
    671     }
    672 
    673   restore_port_config:
    674     if (pc != NULL) {
    675       ahci_restore_port_config(ai, p, pc);
    676     }
     683      // DAZ free port structure here
     684    }
     685
     686    if (pc != NULL) ahci_restore_port_config(ai, p, pc);
    677687  }
    678688
     
    10961106  }
    10971107
    1098   DPRINTF(1,"---------- ahci_exec_iorb: iorb=%x\n", vIorb);
     1108  DPRINTF(7,"---------- ahci_exec_iorb: iorb=%x\n", vIorb);
    10991109
    11001110  /* Enable AHCI mode; apparently, the AHCI mode may end up becoming
     
    11221132      cmd_max = ai->cmd_max;
    11231133    }
    1124     DPRINTF(3,"NCQ command; cmd_max = %d->%d\n", ai->cmd_max, cmd_max);
     1134    DPRINTF(8,"NCQ command; cmd_max = %d->%d\n", ai->cmd_max, cmd_max);
    11251135  }
    11261136
     
    11751185        aws->cmd_slot = port->cmd_slot;
    11761186
    1177         DPRINTF(1,"Issuing command Slot=%d cmds=%x\n", port->cmd_slot, *cmds);
     1187        DPRINTF(7,"Issuing command Slot=%d cmds=%x\n", port->cmd_slot, *cmds);
    11781188        if (aws->is_ncq)
    11791189        {
     
    14321442 * queues, ...)
    14331443 */
    1434 u32 DazCount = 0;
    1435 
    14361444int ahci_intr(u16 irq)
    14371445{
     
    14401448  int a;
    14411449  int p;
    1442 
    1443   DPRINTF(1,"AI=%x",DazCount++);
    14441450
    14451451  /* find adapter(s) with pending interrupts */
     
    15301536  readl(port_mmio + PORT_IRQ_STAT); /* flush */
    15311537
    1532   DPRINTF(3,"port interrupt A=%d Port=%d stat=%x\n", ad_no(ai), p, irq_stat);
    15331538  memset(&done_queue, 0x00, sizeof(done_queue));
    15341539
     
    15561561    active_cmds = readl(port_mmio + PORT_SCR_ACT);
    15571562    done_mask = ai->ports[p].ncq_cmds ^ active_cmds;
    1558     DPRINTF(1,"[ncq_cmds]: active_cmds=0x%08x done_mask=0x%08x\n", active_cmds, done_mask);
     1563    DPRINTF(7,"[ncq_cmds]: active_cmds=0x%08x done_mask=0x%08x\n", active_cmds, done_mask);
    15591564  }
    15601565  else
     
    15621567    active_cmds = readl(port_mmio + PORT_CMD_ISSUE);
    15631568    done_mask = ai->ports[p].reg_cmds ^ active_cmds;
    1564     DPRINTF(1,"[reg_cmds]: active_cmds=0x%08x  done_mask=0x%08x\n", active_cmds, done_mask);
     1569    DPRINTF(7,"[reg_cmds]: active_cmds=0x%08x  done_mask=0x%08x\n", active_cmds, done_mask);
    15651570  }
    15661571
     
    16811686{
    16821687  #ifdef DEBUG
    1683   DPRINTF(2,"ahci_get_geometry(%d.%d.%d)\n", iorb_unit_adapter(pIorb),
     1688  DPRINTF(7,"ahci_get_geometry(%d.%d.%d)\n", iorb_unit_adapter(pIorb),
    16841689          iorb_unit_port(pIorb), iorb_unit_device(pIorb));
    16851690  #endif
     
    16941699{
    16951700  #ifdef DEBUG
    1696   DPRINTF(2,"ahci_unit_ready(%d.%d.%d)\n", iorb_unit_adapter(pIorb),
     1701  DPRINTF(7,"ahci_unit_ready(%d.%d.%d)\n", iorb_unit_adapter(pIorb),
    16971702          iorb_unit_port(pIorb), iorb_unit_device(pIorb));
    16981703  #endif
     
    17071712{
    17081713  #ifdef DEBUG
    1709   DPRINTF(2,"ahci_read(%d.%d.%d, %d, %d)\n", iorb_unit_adapter(vIorb),
     1714  DPRINTF(7,"ahci_read(%d.%d.%d, %d, %d)\n", iorb_unit_adapter(vIorb),
    17101715          iorb_unit_port(pIorb), iorb_unit_device(pIorb),
    17111716          ((IORB_EXECUTEIO *) pIorb)->RBA,
     
    17221727{
    17231728  #ifdef DEBUG
    1724   DPRINTF(2,"ahci_verify(%d.%d.%d, %d, %d)\n", iorb_unit_adapter(pIorb),
     1729  DPRINTF(7,"ahci_verify(%d.%d.%d, %d, %d)\n", iorb_unit_adapter(pIorb),
    17251730          iorb_unit_port(pIorb), iorb_unit_device(pIorb),
    17261731          ((IORB_EXECUTEIO *)pIorb)->RBA,
     
    17371742{
    17381743  #ifdef DEBUG
    1739   DPRINTF(2,"ahci_write(%d.%d.%d, %d, %d)\n", iorb_unit_adapter(pIorb),
     1744  DPRINTF(7,"ahci_write(%d.%d.%d, %d, %d)\n", iorb_unit_adapter(pIorb),
    17401745          iorb_unit_port(pIorb), iorb_unit_device(pIorb),
    17411746          ((IORB_EXECUTEIO *)pIorb)->RBA,
Note: See TracChangeset for help on using the changeset viewer.