Changeset 209


Ignore:
Timestamp:
Mar 6, 2021, 7:44:15 PM (4 years ago)
Author:
David Azarewicz
Message:

Debugging support changes.

Location:
trunk/src/os2ahci
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/os2ahci/Makefile

    r204 r209  
    66# Copyright (c) 2013-2016 David Azarewicz
    77#
     8#define DBG_ALWAYS    0x0000
     9#define DBG_FUNCBEG   0x0001
     10#define DBG_FUNCEND   0x0002
     11#define DBG_ATTACH    0x0004
     12#define DBG_DETAILED  0x0008
     13#define DBG_INIT      0x0010
     14#define DBG_SPECIAL   0x0020
     15#define DBG_VERBOSE   0x0100
     16#define DBG_ERROR_ALL 0x800000ff
     17FDEBUG=0x0000
     18
    819.ERASE
    920.SUFFIXES
     
    8495
    8596!ifdef DEBUG
    86 CDEFS=-DDEBUG
     97CDEFS=-DDEBUG=$(FDEBUG)
    8798O=Debug
    8899!else
  • trunk/src/os2ahci/ReadMe.txt

    r207 r209  
    6767Global Options
    6868
    69 Option                 Description
    70 ------------------------------------------------------------------------------
    71 /B:<baud>              Initialize the COM port to the specified baud rate. Allowable
    72                        baud values are: 300, 600, 1200, 2400, 4800, 9600, 19200,
    73                        38400, 57600, and 115200. /B has no effect if /C is not also
    74                        specified. If /B is not specified, the COM port is not
    75                        initialized. For example, if you are using the kernel debugger,
    76                        the kernel debugger initializes the COM port so you should not
    77                        use this switch.
    78 
    79 /COM:<n>               Set debug COM port base address. Values for n can be:
    80                          1 = COM1
    81                          2 = COM2
    82                          a hex value (COM port base address) COM1=3f8, COM2=2f8
    83                        The default is 0. If set to 0 then no output goes to the COM port.
    84 
    85 /D[:n]                 Debug output to COM port/debug buffer. Values for n can be:
    86                          1 = requests
    87                          2 = detailed
    88                          3 = verbose
    89                        If :n is not specified the debug level is incremented for
    90                        each /D specified.
    91 
    92 /W                     Allows the debug buffer to wrap when full.
    93 
    94 /V[:n]                 Display informational messages during boot. Values for n can be:
    95                          1 = Display sign on banner
    96                          2 = Display adapter information
    97                        If :n is not specified the verbosity level is incremented for
    98                        each /V specified.
    99 
    100 /G:<vendor>:<device>   Add generic PCI ID to list of supported AHCI adapters
    101                        (e.g. /G:8086:2829)
    102 
    103 /T                     Perform thorough PCI ID scan; default = on, can be
    104                        turned off with /!T to perform only a PCI class scan
    105 
    106 /F                     Force the use of the HW write cache when using NCQ
    107                        commands; see "Native Command Queuing" below for
    108                        further explanation (default = off)
    109 
    110 /R                     Reset ports during initialization (default = on)
    111                        Can be turned off with /!R, however, when the
    112                        [Intel] AHCI controller was found to be
    113                        initialized by the BIOS in SATA mode, ports will
    114                        always be reset even when /!R is specified
    115 
    116 /A:n                   Set adapter to n for adapter-specific options
    117                        (default = -1, all adapters)
    118 
    119 /P:n                   Set port to n for port-specific options
    120                        (default = -1, all ports)
    121 
    122 /I                     Ignore current adapter if no port has been specified.
    123                        Otherwise, ignore the current port on the current adapter.
    124 
    125 /U                     Check for usable disks and ignore disks that are not
    126                        usable. To be usable a disk must be an MBR disk or wiped.
    127                        (default = on) Can be turned off with /!U.
     69Option                Description
     70-----------------------------------------------------------------------------
     71/A:n                  Set adapter to n for adapter-specific options
     72                      (default = -1, all adapters)
     73
     74/F                    Force the use of the HW write cache when using NCQ
     75                      commands; see "Native Command Queuing" below for
     76                      further explanation (default = off)
     77
     78/G:<vendor>:<device>  Add generic PCI ID to list of supported AHCI adapters
     79                      (e.g. /G:8086:2829)
     80
     81/I                    Ignore current adapter if no port has been specified.
     82                      Otherwise, ignore the current port on the current adapter.
     83
     84/P:n                  Set port to n for port-specific options
     85                      (default = -1, all ports)
     86
     87/R                    Reset ports during initialization (default = on)
     88                      Can be turned off with /!R, however, when the
     89                      [Intel] AHCI controller was found to be
     90                      initialized by the BIOS in SATA mode, ports will
     91                      always be reset even when /!R is specified
     92
     93/T                    Perform thorough PCI ID scan; default = on, can be
     94                      turned off with /!T to perform only a PCI class scan
     95
     96/U                    Check for usable disks and mark disks that are not
     97                      usable as unavailable for normal OS/2 operations.
     98                      To be usable a disk must be an MBR disk or wiped.
     99                      (default = on) Can be turned off with /!U.
     100
     101/V                    Display informational messages during boot.
     102
     103Debugging options (may only be available in debug builds)
     104
     105Option                Description
     106-----------------------------------------------------------------------------
     107/B:<baud>             Initialize the COM port to the specified baud rate. Allowable
     108                      baud values are: 300, 600, 1200, 2400, 4800, 9600, 19200,
     109                      38400, 57600, and 115200. /B has no effect if /C is not also
     110                      specified. If /B is not specified, the COM port is not
     111                      initialized. For example, if you are using the kernel debugger,
     112                      the kernel debugger initializes the COM port so you should not
     113                      use this switch.
     114
     115/COM:<n>              Set debug COM port base address. Values for n can be:
     116                        1 = COM1
     117                        2 = COM2
     118                        a hex value (COM port base address) COM1=3f8, COM2=2f8
     119                      The default is 0. If set to 0 then no output goes to the COM port.
     120
     121/DEBUG:<n>            Sets debug mask
     122
     123/W                    Allows the debug buffer to wrap when full.
    128124
    129125Port-specific Options
    130126
    131 Option                 Description
    132 ------------------------------------------------------------------------------
    133 /S                     Enable SCSI emulation for ATAPI units (default = on)
    134                        SCSI emulation is required for tools like cdrecord.
    135 
    136 /N                     Enable NCQ (Native Command Queuing) for hard disks
    137                        (default = off)
    138 
    139 /LS                    Set link speed (default = 0):
    140                          0 = maximum,
    141                          1 = limit to generation 1
    142                          2 = limit to generation 2
    143                          3 = limit to generation 3
    144 
    145 /LP                    Set link power management (default = 0):
    146                          0 = full power management,
    147                          1 = transitions to "partial slumber state" disabled,
    148                          2 = transitions to "slumber state" disabled,
    149                          3 = transitions to both partial and slumber states disabled
    150 
    151 /4                     Force track size to be 56 sectors regardless of the
    152                        reported disk geometry to optimize partition boundaries
    153                        for hard disks with 4096 byte sectors.
     127Option                Description
     128-----------------------------------------------------------------------------
     129/S                    Enable SCSI emulation for ATAPI units (default = on)
     130                      SCSI emulation is required for tools like cdrecord.
     131
     132/N                    Enable NCQ (Native Command Queuing) for hard disks
     133                      (default = off)
     134
     135/LS                   Set link speed (default = 0):
     136                        0 = maximum,
     137                        1 = limit to generation 1
     138                        2 = limit to generation 2
     139                        3 = limit to generation 3
     140
     141/LP                   Set link power management (default = 0):
     142                        0 = full power management,
     143                        1 = transitions to "partial slumber state" disabled,
     144                        2 = transitions to "slumber state" disabled,
     145                        3 = transitions to both partial and slumber states disabled
     146
     147/4                    Force track size to be 56 sectors regardless of the
     148                      reported disk geometry to optimize partition boundaries
     149                      for hard disks with 4096 byte sectors.
    154150
    155151Port-specific options depend on the currently active adapter
  • trunk/src/os2ahci/ahci.c

    r207 r209  
    202202  if ((ai->cap & HOST_CAP_NCQ) && (ai->flags & AHCI_HFLAG_NO_NCQ))
    203203  {
    204     DPRINTF(1,"controller can't do NCQ, turning off CAP_NCQ\n");
     204    DPRINTF(DBG_INIT, DBG_PREFIX": controller can't do NCQ, turning off CAP_NCQ\n");
    205205    ai->cap &= ~HOST_CAP_NCQ;
    206206  }
     
    208208  if (!(ai->cap & HOST_CAP_NCQ) && (ai->flags & AHCI_HFLAG_YES_NCQ))
    209209  {
    210     DPRINTF(1,"controller can do NCQ, turning on CAP_NCQ\n");
     210    DPRINTF(DBG_INIT, DBG_PREFIX": controller can do NCQ, turning on CAP_NCQ\n");
    211211    ai->cap |= HOST_CAP_NCQ;
    212212  }
     
    214214  if ((ai->cap & HOST_CAP_PMP) && (ai->flags & AHCI_HFLAG_NO_PMP))
    215215  {
    216     DPRINTF(1,"controller can't do PMP, turning off CAP_PMP\n");
     216    DPRINTF(DBG_INIT, DBG_PREFIX": controller can't do PMP, turning off CAP_PMP\n");
    217217    ai->cap |= HOST_CAP_PMP;
    218218  }
     
    220220  if ((ai->cap & HOST_CAP_SNTF) && (ai->flags & AHCI_HFLAG_NO_SNTF))
    221221  {
    222     DPRINTF(1,"controller can't do SNTF, turning off CAP_SNTF\n");
     222    DPRINTF(DBG_INIT, DBG_PREFIX": controller can't do SNTF, turning off CAP_SNTF\n");
    223223    ai->cap &= ~HOST_CAP_SNTF;
    224224  }
     
    226226  if (ai->pci_vendor == PCI_VENDOR_ID_JMICRON && ai->pci_device == 0x2361 && ai->port_map != 1)
    227227  {
    228     DPRINTF(1,"JMB361 has only one port, port_map 0x%x -> 0x%x\n", ai->port_map, 1);
     228    DPRINTF(DBG_INIT, DBG_PREFIX": JMB361 has only one port, port_map 0x%x -> 0x%x\n", ai->port_map, 1);
    229229    ai->port_map = 1;
    230230    ai->hw_ports = 1;
     
    249249    /* more ports in port_map than in HOST_CAP & 0x1f */
    250250    ports = ai->hw_ports;
    251     DPRINTF(0,"implemented port map (0x%x) contains more ports than hw_ports (%d), using hw_ports\n", ai->port_map, ports);
     251    DPRINTF(DBG_INIT, DBG_PREFIX": implemented port map (0x%x) contains more ports than hw_ports (%d), using hw_ports\n", ai->port_map, ports);
    252252    ai->port_map = (1UL << ports) - 1UL;
    253253  }
     
    274274  }
    275275
    276   DPRINTF(3,__func__": BIOS AHCI mode is %d\n", ai->bios_config[HOST_CTL / sizeof(u32)] & HOST_AHCI_EN);
     276  DPRINTF(DBG_DETAILED, DBG_PREFIX": BIOS AHCI mode is %d\n", ai->bios_config[HOST_CTL / sizeof(u32)] & HOST_AHCI_EN);
    277277
    278278  if ((ai->bios_config[HOST_CTL / sizeof(u32)] & HOST_AHCI_EN) == 0 && ai->pci_vendor == PCI_VENDOR_ID_INTEL)
     
    284284  }
    285285
    286   DUMP_HOST_REGS(6,ai,1);
     286  DUMP_HOST_REGS(DBG_DETAILED, ai, 1);
    287287
    288288  return(0);
     
    296296int ahci_restore_bios_config(AD_INFO *ai)
    297297{
    298   DPRINTF(3,__func__": restoring AHCI BIOS configuration on adapter %d\n", ad_no(ai));
     298  DPRINTF(DBG_DETAILED, DBG_PREFIX": restoring AHCI BIOS configuration on adapter %d\n", ad_no(ai));
    299299
    300300  /* Restore saved BIOS configuration; please note that HOST_CTL is restored
     
    354354int ahci_restore_initial_config(AD_INFO *ai)
    355355{
    356   DPRINTF(3,__func__": restoring initial configuration on adapter %d\n", ad_no(ai));
     356  DPRINTF(DBG_DETAILED, DBG_PREFIX": restoring initial configuration on adapter %d\n", ad_no(ai));
    357357
    358358  /* restore saved BIOS configuration */
     
    379379    TIMER Timer;
    380380
    381     DPRINTF(2,"controller reset starting on adapter %d\n", ad_no(ai));
     381    DPRINTF(DBG_ATTACH, DBG_PREFIX": controller reset starting on adapter %d\n", ad_no(ai));
    382382
    383383    /* we must be in AHCI mode, before using anything AHCI-specific, such as HOST_RESET. */
     
    414414      u32 tmp16 = 0;
    415415
    416       DPRINTF(1,"ahci_reset_controller: intel detected\n");
     416      DPRINTF(DBG_ATTACH, DBG_PREFIX": ahci_reset_controller: intel detected\n");
    417417      /* configure PCS */
    418418      PciReadConfig(ai->bus, ai->dev_func, 0x92, sizeof(u16), &tmp16);
    419419      if ((tmp16 & ai->port_map) != ai->port_map) {
    420         DPRINTF(3,"ahci_reset_controller: updating PCS %x/%x\n", tmp16, ai->port_map);
     420        DPRINTF(DBG_ATTACH, DBG_PREFIX": ahci_reset_controller: updating PCS %x/%x\n", tmp16, ai->port_map);
    421421        tmp16 |= ai->port_map;
    422422        PciWriteConfig(ai->bus, ai->dev_func, 0x92, sizeof(u16), tmp16);
     
    535535  int i;
    536536
    537   DPRINTF(2,__func__": completing initialization of adapter #%d\n", ad_no(ai));
     537  DPRINTF(DBG_INIT, DBG_PREFIX": completing initialization of adapter #%d\n", ad_no(ai));
    538538
    539539  if (!ai->int_set)
     
    559559      if (i >= MAX_IRQ_HANDLERS) return -1; /* no more handlers available */
    560560
    561       DPRINTF(2,"registering interrupt %d pin=%d\n", ai->irq, ai->irq_pin);
     561      DPRINTF(DBG_INIT, DBG_PREFIX": registering interrupt %d pin=%d\n", ai->irq, ai->irq_pin);
    562562
    563563      rc = Dev32Help_SetIRQ(ahci_intr, ai->irq, p, ai->irq);
     
    592592      if (init_reset)
    593593      {
    594         DPRINTF(3,__func__": resetting port %d\n", p);
     594        DPRINTF(DBG_INIT, DBG_PREFIX": resetting port %d\n", p);
    595595        ahci_reset_port(ai, p, 1);
    596596      }
    597597      else
    598598      {
    599         DPRINTF(3,__func__": restarting port #%d\n", p);
     599        DPRINTF(DBG_INIT, DBG_PREFIX": restarting port #%d\n", p);
    600600        ahci_stop_port(ai, p);
    601601        ahci_start_port(ai, p, 1);
     
    615615  /* pci_enable_int(ai->bus, ai->dev_func); */
    616616
    617   DPRINTF(2,__func__": done\n");
     617  DPRINTF(DBG_INIT|DBG_FUNCEND, DBG_PREFIX": END\n");
    618618  return(0);
    619619}
     
    644644         AP_END)) break;
    645645
    646     DHEXDUMP(5, pSector0, 512, "Sector0:\n");
     646    DHEXDUMP(DBG_DETAILED, pSector0, 512, "Sector0:\n");
    647647
    648648    /* check for wiped disk */
     
    722722  }
    723723
    724   DPRINTF(2,"found device %d.%d.%d: removable=%d dev_type=%d atapi=%d ncq_max=%d\n",
     724  DPRINTF(DBG_ATTACH, DBG_PREFIX": found device %d.%d.%d: removable=%d dev_type=%d atapi=%d ncq_max=%d\n",
    725725          ad_no(ai), p, d,
    726726          ai->ports[p].devs[d].removable,
     
    804804
    805805  /* perform port scan */
    806   DPRINTF(1,__func__": scanning ports on adapter %d\n", ad_no(ai));
     806  DPRINTF(DBG_ATTACH, DBG_PREFIX": scanning ports on adapter %d\n", ad_no(ai));
    807807  for (p = 0; p < AHCI_MAX_PORTS; p++)
    808808  {
     
    812812    // DAZ allocate port structure here
    813813
    814     DPRINTF(3,__func__": Wait till not busy on port %d\n", p);
     814    DPRINTF(DBG_ATTACH, DBG_PREFIX": Wait till not busy on port %d\n", p);
    815815    /* wait until all active commands have completed on this port */
    816816    TimerInit(&Timer, 250);
     
    832832    else
    833833    {
    834       DPRINTF(3,__func__": (re)starting port %d\n", p);
     834      DPRINTF(DBG_ATTACH, DBG_PREFIX": (re)starting port %d\n", p);
    835835      ahci_stop_port(ai, p);
    836836      rc = ahci_start_port(ai, p, 0);
     
    840840    {
    841841      /* this port seems to have a device attached and ready for commands */
    842       DPRINTF(2,__func__": port %d seems to be attached to a device; probing...\n", p);
     842      DPRINTF(DBG_ATTACH, DBG_PREFIX": port %d seems to be attached to a device; probing...\n", p);
    843843
    844844      #ifdef DAZ_NEW_CODE
     
    871871    {
    872872      /* we have a valid IDENTIFY or IDENTIFY_PACKET response */
    873       DHEXDUMP(5,id_buf, ATA_ID_WORDS * sizeof(u16), "ATA_IDENTIFY%s results:\n", (is_ata) ? "" : "_PACKET");
     873      DHEXDUMP(DBG_DETAILED,id_buf, ATA_ID_WORDS * sizeof(u16), "ATA_IDENTIFY%s results:\n", (is_ata) ? "" : "_PACKET");
    874874      ahci_setup_device(ai, p, 0, id_buf);
    875875      if (!IsUsableDisk(ai, p, 0)) ai->ports[p].devs[0].ignored = 1;
     
    915915  TIMER Timer;
    916916
    917   DPRINTF(3,__func__": resetting port %d.%d\n", ad_no(ai), p);
    918   DUMP_PORT_REGS(3,ai,p);
     917  DPRINTF(DBG_ATTACH, DBG_PREFIX": resetting port %d.%d\n", ad_no(ai), p);
     918  DUMP_PORT_REGS(DBG_DETAILED,ai,p);
    919919
    920920  /* stop port engines (we don't care whether there is an error doing so) */
     
    932932
    933933  /* set link speed and power management options */
    934   DPRINTF(3,__func__": setting link speed and power management options\n");
     934  DPRINTF(DBG_DETAILED, DBG_PREFIX": setting link speed and power management options\n");
    935935  tmp = readl(port_mmio + PORT_SCR_CTL) & ~0x00000fffUL;
    936936  tmp |= (link_speed[ad_no(ai)][p] & 0x0f) << 4;
     
    939939
    940940  /* issue COMRESET on the port */
    941   DPRINTF(3,__func__": issuing COMRESET on port %d\n", p);
     941  DPRINTF(DBG_DETAILED, DBG_PREFIX": issuing COMRESET on port %d\n", p);
    942942  writel(port_mmio + PORT_SCR_CTL, tmp | 1);
    943943  readl(port_mmio + PORT_SCR_CTL);  /* flush */
     
    950950
    951951  /* wait for communication to be re-established after port reset */
    952   DPRINTF(3,"Wait for communication...\n");
     952  DPRINTF(DBG_DETAILED, DBG_PREFIX": Wait for communication...\n");
    953953  TimerInit(&Timer, 500);
    954954  while (((tmp = readl(port_mmio + PORT_SCR_STAT)) & 3) != 3)
     
    956956    if (TimerCheckAndBlock(&Timer))
    957957    {
    958       DPRINTF(2,"no device present after resetting port #%d (PORT_SCR_STAT = 0x%x)\n", p, tmp);
     958      DPRINTF(DBG_ATTACH, DBG_PREFIX": no device present after resetting port #%d (PORT_SCR_STAT = 0x%x)\n", p, tmp);
    959959      return(-1);
    960960    }
     
    966966
    967967  /* start port so we can receive the COMRESET FIS */
    968   DPRINTF(3,__func__": starting port %d again\n", p);
     968  DPRINTF(DBG_DETAILED, DBG_PREFIX": starting port %d again\n", p);
    969969  ahci_start_port(ai, p, ei);
    970970
     
    975975    if (TimerCheckAndBlock(&Timer))
    976976    {
    977       DPRINTF(0,"device not ready on port #%d (PORT_TFDATA = 0x%x)\n", p, tmp);
     977      DPRINTF(0, DBG_PREFIX": device not ready on port #%d (PORT_TFDATA = 0x%x)\n", p, tmp);
    978978      ahci_stop_port(ai, p);
    979979      return(-1);
    980980    }
    981981  }
    982   DPRINTF(3,__func__": PORT_TFDATA = 0x%x\n", readl(port_mmio + PORT_TFDATA));
     982  DPRINTF(DBG_ATTACH|DBG_FUNCEND, DBG_PREFIX": END PORT_TFDATA = 0x%x\n", readl(port_mmio + PORT_TFDATA));
    983983
    984984  return(0);
     
    993993  u32 status;
    994994
    995   DPRINTF(3,__func__": %d.%d\n", ad_no(ai), p);
     995  DPRINTF(DBG_ATTACH, DBG_PREFIX": %d.%d\n", ad_no(ai), p);
    996996  /* check whether device presence is detected and link established */
    997997
    998998  status = readl(port_mmio + PORT_SCR_STAT);
    999   DPRINTF(3,__func__": PORT_SCR_STAT = 0x%x\n", status);
     999  DPRINTF(DBG_DETAILED, DBG_PREFIX": PORT_SCR_STAT = 0x%x\n", status);
    10001000  if ((status & 0xf) != 3) return(-1);
    10011001
    10021002  /* clear SError, if any */
    10031003  status = readl(port_mmio + PORT_SCR_ERR);
    1004   DPRINTF(3,__func__": PORT_SCR_ERR  = 0x%x\n", status);
     1004  DPRINTF(DBG_DETAILED, DBG_PREFIX": PORT_SCR_ERR  = 0x%x\n", status);
    10051005  writel(port_mmio + PORT_SCR_ERR, status);
    10061006
     
    10901090  int rc;
    10911091
    1092   DPRINTF(3,__func__": %d.%d\n", ad_no(ai), p);
     1092  DPRINTF(DBG_ATTACH, DBG_PREFIX": %d.%d\n", ad_no(ai), p);
    10931093
    10941094  /* disable port interrupts */
     
    12331233  }
    12341234
    1235   DPRINTF(7,"---------- "__func__": iorb=%x\n", vIorb);
     1235  DPRINTF(DBG_DETAILED, DBG_PREFIX": ---------- iorb=%x\n", vIorb);
    12361236
    12371237  /* Enable AHCI mode; apparently, the AHCI mode may end up becoming
     
    12591259      cmd_max = ai->cmd_max;
    12601260    }
    1261     DPRINTF(8,__func__": NCQ command; cmd_max = %d->%d\n", ai->cmd_max, cmd_max);
     1261    DPRINTF(DBG_DETAILED, DBG_PREFIX": NCQ command; cmd_max = %d->%d\n", ai->cmd_max, cmd_max);
    12621262  }
    12631263
     
    13121312        aws->cmd_slot = port->cmd_slot;
    13131313
    1314         DPRINTF(7,__func__": Issuing command Slot=%d cmds=%x\n", port->cmd_slot, *cmds);
     1314        DPRINTF(DBG_DETAILED, DBG_PREFIX": Issuing command Slot=%d cmds=%x\n", port->cmd_slot, *cmds);
    13151315        if (aws->is_ncq)
    13161316        {
     
    14051405  {
    14061406    /* successfully prepared cmd; issue cmd and wait for completion */
    1407     DPRINTF(3,"---------- "__func__" executing polled cmd on slot 0...");
     1407    DPRINTF(DBG_DETAILED, DBG_PREFIX": ---------- executing polled cmd on slot 0...");
    14081408    writel(port_mmio + PORT_CMD_ISSUE, 1);
    14091409    TimerInit(&Timer, timeout);
     
    14171417    if (rc)
    14181418    {
    1419       DPRINTF(3," timeout for IORB %x port=%x", vIorb, p);
     1419      DPRINTF(DBG_DETAILED, " timeout for IORB %x port=%x", vIorb, p);
    14201420      iorb_seterr(pIorb, IOERR_ADAPTER_TIMEOUT);
    14211421    }
    14221422    else if (readl(port_mmio + PORT_SCR_ERR) != 0 || readl(port_mmio + PORT_TFDATA) & 0x89)
    14231423    {
    1424       DPRINTF(3," polled cmd error for IORB %x", vIorb);
     1424      DPRINTF(DBG_DETAILED, " polled cmd error for IORB %x", vIorb);
    14251425      iorb_seterr(pIorb, IOERR_DEVICE_NONSPECIFIC);
    14261426      ahci_reset_port(ai, iorb_unit_port(pIorb), 0);
     
    14381438      }
    14391439    }
    1440     DPRINTF(3,"\n");
     1440    DPRINTF(DBG_DETAILED, "\n");
    14411441  }
    14421442
     
    14761476  if (readl(port_mmio + PORT_CMD_ISSUE) & 1)
    14771477  {
    1478     DPRINTF(3,__func__": port %d slot 0 is not idle; not executing polled cmd\n", p);
     1478    DPRINTF(0, DBG_PREFIX": port %d slot 0 is not idle; not executing polled cmd\n", p);
    14791479    return(-1);
    14801480  }
     
    14851485
    14861486  /* start command execution for slot 0 */
    1487   DPRINTF(3,"---------- "__func__" executing polled cmd...");
     1487  DPRINTF(DBG_DETAILED, DBG_PREFIX": ---------- executing polled cmd...");
    14881488  writel(port_mmio + PORT_CMD_ISSUE, 1);
    14891489
     
    14961496    if (rc)
    14971497    {
    1498       DPRINTF(2," Timeout");
     1498      DPRINTF(DBG_DETAILED, " Timeout");
    14991499      break;
    15001500    }
     
    15041504  if (tmp & PORT_ERR_FAIL_BITS)
    15051505  {
    1506     DPRINTF(2," SERR = 0x%08lx", tmp);
     1506    DPRINTF(DBG_DETAILED, " SERR = 0x%08lx", tmp);
    15071507    rc = 1;
    15081508  }
     
    15101510  if (((tmp = readl(port_mmio + PORT_TFDATA)) & 0x89) != 0)
    15111511  {
    1512     DPRINTF(2," TFDATA = 0x%08lx", tmp);
     1512    DPRINTF(DBG_DETAILED, " TFDATA = 0x%08lx", tmp);
    15131513    rc = 1;
    15141514  }
     
    15161516  if (rc)
    15171517  {
    1518     DPRINTF(3,"failed\n");
     1518    DPRINTF(DBG_DETAILED, "failed\n");
    15191519    ahci_reset_port(ai, p, 0);
    15201520    return(-1);
    15211521  }
    1522   DPRINTF(3,"success\n");
     1522  DPRINTF(DBG_DETAILED, "success\n");
    15231523  return(0);
    15241524}
     
    15371537  if (!ai->ports[p].devs[d].atapi)
    15381538  {
    1539     DPRINTF(2,__func__": flushing cache on %d.%d.%d\n", ad_no(ai), p, d);
     1539    DPRINTF(DBG_INIT, DBG_PREFIX": flushing cache on %d.%d.%d\n", ad_no(ai), p, d);
    15401540    return(ahci_exec_polled_cmd(ai, p, d, 30000,
    15411541           ai->ports[p].devs[d].lba48 ? ATA_CMD_FLUSH_EXT : ATA_CMD_FLUSH, AP_END));
     
    15541554int ahci_set_dev_idle(AD_INFO *ai, int p, int d, int idle)
    15551555{
    1556   DPRINTF(3,__func__": sending IDLE=%d command to port %d\n", idle, p);
     1556  DPRINTF(DBG_FUNCBEG, DBG_PREFIX": sending IDLE=%d command to port %d\n", idle, p);
    15571557  return ahci_exec_polled_cmd(ai, p, d, 500, ATA_CMD_IDLE, AP_COUNT, idle ? 1 : 0, AP_END);
    15581558}
     
    16121612    if ((u32)&irq_stat < 0xf000)
    16131613    {
    1614       DPRINTF(0,__func__": IRQ stack running low; arming engine context hook\n");
     1614      DPRINTF(DBG_DETAILED, DBG_PREFIX": IRQ stack running low; arming engine context hook\n");
    16151615      /* Rousseau:
    16161616       * A context hook cannot be re-armed before it has completed.
     
    16891689    active_cmds = readl(port_mmio + PORT_SCR_ACT);
    16901690    done_mask = ai->ports[p].ncq_cmds ^ active_cmds;
    1691     DPRINTF(7,"[ncq_cmds]: active_cmds=0x%08x done_mask=0x%08x\n", active_cmds, done_mask);
     1691    DPRINTF(DBG_DETAILED, DBG_PREFIX": [ncq_cmds]: active_cmds=0x%08x done_mask=0x%08x\n", active_cmds, done_mask);
    16921692  }
    16931693  else
     
    16951695    active_cmds = readl(port_mmio + PORT_CMD_ISSUE);
    16961696    done_mask = ai->ports[p].reg_cmds ^ active_cmds;
    1697     DPRINTF(7,"[reg_cmds]: active_cmds=0x%08x  done_mask=0x%08x\n", active_cmds, done_mask);
     1697    DPRINTF(DBG_DETAILED, DBG_PREFIX": [reg_cmds]: active_cmds=0x%08x  done_mask=0x%08x\n", active_cmds, done_mask);
    16981698  }
    16991699
     
    17751775    #ifdef DEBUG
    17761776    u32 *unk = (u32 *) (port_dma_base(ai, p)->rx_fis + RX_FIS_UNK);
    1777     DPRINTF(0,"warning: unknown FIS %08lx %08lx %08lx %08lx\n", unk[0], unk[1], unk[2], unk[3]);
     1777    dprintf(0,"warning: unknown FIS %08lx %08lx %08lx %08lx\n", unk[0], unk[1], unk[2], unk[3]);
    17781778    #endif
    17791779    reset_port = 1;
     
    18031803  dprintf(0,"port #%d interrupt error status: 0x%08x; restarting port\n", p, irq_stat);
    18041804  #else
    1805   if (!ai->ports[p].devs[0].atapi || D32g_DbgLevel)
     1805  if (!ai->ports[p].devs[0].atapi)
    18061806  {
    18071807    dprintf(0,"port #%d interrupt error status: 0x%08x; restarting port\n", p, irq_stat);
     
    18231823void ahci_get_geometry(IORBH FAR16DATA *vIorb, IORBH *pIorb)
    18241824{
    1825   DPRINTF(7,"ahci_get_geometry(%d.%d.%d)\n", iorb_unit_adapter(pIorb),
     1825  DPRINTF(DBG_FUNCBEG, DBG_PREFIX": ahci_get_geometry(%d.%d.%d)\n", iorb_unit_adapter(pIorb),
    18261826          iorb_unit_port(pIorb), iorb_unit_device(pIorb));
    18271827
     
    18341834void ahci_unit_ready(IORBH FAR16DATA *vIorb, IORBH *pIorb)
    18351835{
    1836   DPRINTF(7,"ahci_unit_ready(%d.%d.%d)\n", iorb_unit_adapter(pIorb),
     1836  DPRINTF(DBG_FUNCBEG, DBG_PREFIX": ahci_unit_ready(%d.%d.%d)\n", iorb_unit_adapter(pIorb),
    18371837          iorb_unit_port(pIorb), iorb_unit_device(pIorb));
    18381838
     
    18451845void ahci_read(IORBH FAR16DATA *vIorb, IORBH *pIorb)
    18461846{
    1847   DPRINTF(7,"ahci_read(%d.%d.%d, %d, %d)\n", iorb_unit_adapter(vIorb),
     1847  DPRINTF(DBG_FUNCBEG, DBG_PREFIX": ahci_read(%d.%d.%d, %d, %d)\n", iorb_unit_adapter(vIorb),
    18481848          iorb_unit_port(pIorb), iorb_unit_device(pIorb),
    18491849          ((IORB_EXECUTEIO *) pIorb)->RBA,
     
    18581858void ahci_verify(IORBH FAR16DATA *vIorb, IORBH *pIorb)
    18591859{
    1860   DPRINTF(7,"ahci_verify(%d.%d.%d, %d, %d)\n", iorb_unit_adapter(pIorb),
     1860  DPRINTF(DBG_FUNCBEG, DBG_PREFIX": ahci_verify(%d.%d.%d, %d, %d)\n", iorb_unit_adapter(pIorb),
    18611861          iorb_unit_port(pIorb), iorb_unit_device(pIorb),
    18621862          ((IORB_EXECUTEIO *)pIorb)->RBA,
     
    18711871void ahci_write(IORBH FAR16DATA *vIorb, IORBH *pIorb)
    18721872{
    1873   DPRINTF(7,"ahci_write(%d.%d.%d, %d, %d)\n", iorb_unit_adapter(pIorb),
     1873  DPRINTF(DBG_FUNCBEG, DBG_PREFIX": ahci_write(%d.%d.%d, %d, %d)\n", iorb_unit_adapter(pIorb),
    18741874          iorb_unit_port(pIorb), iorb_unit_device(pIorb),
    18751875          ((IORB_EXECUTEIO *)pIorb)->RBA,
     
    18881888  int d = iorb_unit_device(pIorb);
    18891889
    1890   DHEXDUMP(5,Far16ToFlat(((IORB_ADAPTER_PASSTHRU *)pIorb)->f16ControllerCmd),
     1890  DHEXDUMP(DBG_DETAILED ,Far16ToFlat(((IORB_ADAPTER_PASSTHRU *)pIorb)->f16ControllerCmd),
    18911891        ((IORB_ADAPTER_PASSTHRU *)pIorb)->ControllerCmdLen,
    18921892        "ahci_execute_cdb(%d.%d.%d): ", a, p, d);
     
    19141914  int d = iorb_unit_device(pIorb);
    19151915
    1916   DHEXDUMP(5,Far16ToFlat(((IORB_ADAPTER_PASSTHRU *)pIorb)->f16ControllerCmd),
     1916  DHEXDUMP(DBG_DETAILED, Far16ToFlat(((IORB_ADAPTER_PASSTHRU *)pIorb)->f16ControllerCmd),
    19171917        ((IORB_ADAPTER_PASSTHRU *)pIorb)->ControllerCmdLen,
    19181918        "ahci_execute_ata(%d.%d.%d): ", a, p, d);
  • trunk/src/os2ahci/apm.c

    r206 r209  
    4545  /* connect to APM driver */
    4646  if ((rc = APMAttach()) != 0) {
    47     DPRINTF(2,"couldn't connect to APM driver (rc = %d)\n", rc);
     47    DPRINTF(0, DBG_PREFIX": couldn't connect to APM driver (rc = %d)\n", rc);
    4848    return;
    4949  }
     
    5353                                   APM_NOTIFYNORMRESUME |
    5454                                   APM_NOTIFYCRITRESUME, 0)) != 0) {
    55     DPRINTF(2,"couldn't register for power event notificatins (rc = %d)\n", rc);
     55    DPRINTF(0, DBG_PREFIX": couldn't register for power event notificatins (rc = %d)\n", rc);
    5656    return;
    5757  }
     
    6565  USHORT msg = (USHORT) evt->ulParm1;
    6666
    67   DPRINTF(2,"received APM event: 0x%x/0x%x\n");
     67  DPRINTF(DBG_FUNCBEG, DBG_PREFIX": received APM event: 0x%x/0x%x\n");
    6868
    6969  switch (msg) {
     
    8383
    8484  default:
    85     DPRINTF(2,"unknown APM event; ignoring...\n");
     85    DPRINTF(0, DBG_PREFIX": unknown APM event; ignoring...\n");
    8686    break;
    8787  }
     
    103103
    104104  if (suspended) return;
    105   DPRINTF(2,"suspend()\n");
     105  DPRINTF(DBG_FUNCBEG, DBG_PREFIX": suspend()\n");
    106106
    107107  /* restart all ports with interrupts disabled */
     
    144144
    145145  suspended = 1;
    146   DPRINTF(2,"suspend() finished\n");
     146  DPRINTF(DBG_FUNCEND, DBG_PREFIX": suspend() finished\n");
    147147}
    148148
     
    156156
    157157  if (!suspended) return;
    158   DPRINTF(2,"resume()\n");
     158  DPRINTF(DBG_FUNCBEG, DBG_PREFIX": resume()\n");
    159159
    160160  for (a = 0; a < ad_info_cnt; a++) {
     
    192192  KernArmHook(engine_ctxhook_h, 0, 0);
    193193
    194   DPRINTF(2,"resume() finished\n");
     194  DPRINTF(DBG_FUNCEND, DBG_PREFIX": resume() finished\n");
    195195}
    196196
     
    209209  //int d;
    210210
    211   DPRINTF(1,"shutdown_driver() enter\n");
     211  DPRINTF(DBG_FUNCBEG, DBG_PREFIX": shutdown_driver() enter\n");
    212212
    213213  for (a = 0; a < ad_info_cnt; a++)
     
    255255  }
    256256
    257   DPRINTF(1,"shutdown_driver() finished\n");
    258 }
    259 
     257  DPRINTF(DBG_FUNCEND, DBG_PREFIX": shutdown_driver() finished\n");
     258}
     259
  • trunk/src/os2ahci/ata.c

    r208 r209  
    263263      if ((sg_addr & 1) || (chunk & 1))
    264264      {
    265         DPRINTF(0,"warning: ata_cmd() called with unaligned S/G element(s)\n");
     265        DPRINTF(0, DBG_PREFIX": warning: ata_cmd() called with unaligned S/G element(s)\n");
    266266        return(ATA_CMD_UNALIGNED_ADDR);
    267267      }
     
    277277  cmd_hdr->options |= n << 16;
    278278
    279   #ifdef DEBUG
    280   if ((D32g_DbgLevel >= 5) /*|| (atapi_cmd != NULL)*/)
    281   {
    282     DPRINTF(0,"ATA command for %d.%d.%d, slot %d:\n", ad_no(ai), p, d, slot);
    283     dHexDump(0,cmd_hdr, offsetof(AHCI_CMD_HDR, reserved), "cmd_hdr: ");
    284     dHexDump(0,&ata_cmd, sizeof(ata_cmd), "ata_cmd: ");
    285     if (atapi_cmd != NULL)
    286     {
    287       dHexDump(0,atapi_cmd, atapi_cmd_len, "atapi_cmd: ");
    288     }
    289     if (n > 0)
    290     {
    291       dHexDump(0,cmd_tbl->sg_list, sizeof(*cmd_tbl->sg_list) * n, "sg_list: ");
    292     }
     279  #if DEBUG & DBG_DETAILED
     280  dprintf(0,"ATA command for %d.%d.%d, slot %d:\n", ad_no(ai), p, d, slot);
     281  dHexDump(0,cmd_hdr, offsetof(AHCI_CMD_HDR, reserved), "cmd_hdr: ");
     282  dHexDump(0,&ata_cmd, sizeof(ata_cmd), "ata_cmd: ");
     283  if (atapi_cmd != NULL)
     284  {
     285    dHexDump(0,atapi_cmd, atapi_cmd_len, "atapi_cmd: ");
     286  }
     287  if (n > 0)
     288  {
     289    dHexDump(0,cmd_tbl->sg_list, sizeof(*cmd_tbl->sg_list) * n, "sg_list: ");
    293290  }
    294291  #endif
     
    447444  if (rc) return 0;
    448445
    449   DHEXDUMP(5,pDLA, sizeof(DLA_Table_Sector), "DLA sector %d:\n", sector-1);
     446  DHEXDUMP(DBG_DETAILED, pDLA, sizeof(DLA_Table_Sector), "DLA sector %d:\n", sector-1);
    450447
    451448  if ((pDLA->DLA_Signature1 == DLA_TABLE_SIGNATURE1) && (pDLA->DLA_Signature2 == DLA_TABLE_SIGNATURE2))
    452449  {
    453     DPRINTF(3,__func__": DLA found at sector %d\n", sector-1);
     450    DPRINTF(DBG_ATTACH, DBG_PREFIX": DLA found at sector %d\n", sector-1);
    454451    geometry->TotalCylinders = pDLA->Cylinders;
    455452    geometry->NumHeads = pDLA->Heads_Per_Cylinder;
     
    482479  int p = iorb_unit_port(pIorb);
    483480  int d = iorb_unit_device(pIorb);
    484   DPRINTF(3,__func__" (%d.%d.%d)\n", ad_no(ai), p, d);
     481  dprintf(DBG_DETAILED, DBG_PREFIX": (%d.%d.%d)\n", ad_no(ai), p, d);
    485482  #endif
    486483
     
    607604  }
    608605
    609   DPRINTF(2,"Physical geometry: %d cylinders, %d heads, %d sectors per track (%dMB) (%s)\n",
     606  DPRINTF(DBG_ATTACH, DBG_PREFIX": Physical geometry: %d cylinders, %d heads, %d sectors per track (%dMB) (%s)\n",
    610607      geometry->TotalCylinders, geometry->NumHeads, geometry->SectorsPerTrack,
    611608      (ULONG)(ullTotalSectors / 2048), Method);
     
    616613  else ullTotalSectors = geometry->TotalSectors;
    617614
    618   ad_infos[a].ports[p].devs[0].dev_info.Cylinders = geometry->TotalCylinders;
    619   ad_infos[a].ports[p].devs[0].dev_info.HeadsPerCylinder = geometry->NumHeads;
    620   ad_infos[a].ports[p].devs[0].dev_info.SectorsPerTrack = geometry->SectorsPerTrack;
    621   ad_infos[a].ports[p].devs[0].dev_info.TotalSectors = ullTotalSectors;
    622   ad_infos[a].ports[p].devs[0].dev_info.Method = Method;
     615  ad_infos[a].ports[p].devs[0].dev_info.ulCylinders = geometry->TotalCylinders;
     616  ad_infos[a].ports[p].devs[0].dev_info.usHeadsPerCylinder = geometry->NumHeads;
     617  ad_infos[a].ports[p].devs[0].dev_info.usSectorsPerTrack = geometry->SectorsPerTrack;
     618  ad_infos[a].ports[p].devs[0].dev_info.ullTotalSectors = ullTotalSectors;
     619  ad_infos[a].ports[p].devs[0].dev_info.pMethod = Method;
    623620
    624621  //DAZ DPRINTF(2,"Reported geometry: %d cylinders, %d heads, %d sectors per track (%dMB) (%s)\n",
    625   DPRINTF(0,"Reported geometry: %d cylinders, %d heads, %d sectors per track (%dMB) (%s)\n",
     622  DPRINTF(DBG_ATTACH, DBG_PREFIX": Reported geometry: %d cylinders, %d heads, %d sectors per track (%dMB) (%s)\n",
    626623      geometry->TotalCylinders, geometry->NumHeads, geometry->SectorsPerTrack,
    627624      (ULONG)(ullTotalSectors / 2048), Method);
     
    799796  }
    800797
    801   DPRINTF(7,"ata_read_unaligned(%d.%d.%d, %lld)\n", ad_no(ai), p, d, ullLba);
     798  DPRINTF(DBG_DETAILED, DBG_PREFIX": ata_read_unaligned(%d.%d.%d, %lld)\n", ad_no(ai), p, d, ullLba);
    802799  ai->ports[p].unaligned_read_count++;
    803800
     
    848845
    849846  io->BlocksXferred += add_workspace(pIorb)->blocks;
    850   DPRINTF(7,__func__": blocks transferred = %d\n", io->BlocksXferred);
     847  DPRINTF(DBG_DETAILED, DBG_PREFIX": blocks transferred = %d\n", io->BlocksXferred);
    851848
    852849  if (io->BlocksXferred >= io->BlockCount)
     
    10591056  }
    10601057
    1061   DPRINTF(7,"ata_write_unaligned(%d.%d.%d, %lld)\n", ad_no(ai), p, d, ullLba);
     1058  DPRINTF(DBG_DETAILED, DBG_PREFIX": ata_write_unaligned(%d.%d.%d, %lld)\n", ad_no(ai), p, d, ullLba);
    10621059
    10631060  /* allocate transfer buffer */
     
    11061103
    11071104  io->BlocksXferred += add_workspace(pIorb)->blocks;
    1108   DPRINTF(7,"ata_write_pp(): blocks transferred = %d\n", io->BlocksXferred);
     1105  DPRINTF(DBG_DETAILED, DBG_PREFIX": ata_write_pp(): blocks transferred = %d\n", io->BlocksXferred);
    11091106
    11101107  if (io->BlocksXferred >= io->BlockCount)
     
    11761173  {
    11771174    /* this is not a D2H FIS - give up silently */
    1178     DPRINTF(3,"ata_execute_ata_pp(): D2H FIS type incorrect: %d\n", fis[0]);
     1175    DPRINTF(DBG_DETAILED, DBG_PREFIX": ata_execute_ata_pp(): D2H FIS type incorrect: %d\n", fis[0]);
    11791176    add_workspace(pIorb)->complete = 1;
    11801177    return;
     
    11971194                | ((u16) fis[13] << 8);
    11981195
    1199   DHEXDUMP(5,cmd, sizeof(*cmd), "ahci_execute_ata_pp(): cmd after completion:\n");
     1196  DHEXDUMP(DBG_DETAILED, cmd, sizeof(*cmd), "ahci_execute_ata_pp(): cmd after completion:\n");
    12001197
    12011198  /* signal completion to interrupt handler */
  • trunk/src/os2ahci/atapi.c

    r207 r209  
    4141int atapi_get_geometry(IORBH FAR16DATA *vIorb, IORBH *pIorb, int slot)
    4242{
    43   DPRINTF(4,"atapi_get_geometry called\n");
     43  DPRINTF(DBG_FUNCBEG, DBG_PREFIX": atapi_get_geometry called\n");
    4444  iorb_seterr(pIorb, IOERR_CMD_NOT_SUPPORTED);
    4545  return(-1);
     
    5151int atapi_unit_ready(IORBH FAR16DATA *vIorb, IORBH *pIorb, int slot)
    5252{
    53   DPRINTF(4,"atapi_unit_ready called\n");
     53  DPRINTF(DBG_FUNCBEG, DBG_PREFIX": atapi_unit_ready called\n");
    5454  iorb_seterr(pIorb, IOERR_CMD_NOT_SUPPORTED);
    5555  return(-1);
     
    9292  SET_CDB_32(cdb.lba, io->RBA + io->BlocksXferred);
    9393
    94   DPRINTF(4, "atapi_read\n");
     94  DPRINTF(DBG_DETAILED, DBG_PREFIX": atapi_read\n");
    9595
    9696  do {
     
    166166
    167167  ai->ports[p].unaligned_read_count++;
    168   DPRINTF(4, "atapi_read_unaligned\n");
     168  DPRINTF(DBG_DETAILED, DBG_PREFIX": atapi_read_unaligned\n");
    169169
    170170  /* allocate transfer buffer */
     
    207207int atapi_verify(IORBH FAR16DATA *vIorb, IORBH *pIorb, int slot)
    208208{
    209   DPRINTF(4,"atapi_verify called\n");
     209  DPRINTF(DBG_FUNCBEG, DBG_PREFIX": atapi_verify called\n");
    210210  iorb_seterr(pIorb, IOERR_CMD_NOT_SUPPORTED);
    211211  return(-1);
     
    217217int atapi_write(IORBH FAR16DATA *vIorb, IORBH *pIorb, int slot)
    218218{
    219   DPRINTF(4,"atapi_write called\n");
     219  DPRINTF(DBG_FUNCBEG, DBG_PREFIX": atapi_write called\n");
    220220  iorb_seterr(pIorb, IOERR_CMD_NOT_SUPPORTED);
    221221  return(-1);
     
    287287  size_t sense_buf_len = ATAPI_SENSE_LEN;
    288288
    289   DPRINTF(4,"atapi_req_sense\n");
     289  DPRINTF(DBG_FUNCBEG, DBG_PREFIX": atapi_req_sense\n");
    290290
    291291  if ((pIorb->RequestControl & IORB_REQ_STATUSBLOCK) &&
     
    363363  ATAPI_SENSE_DATA *psd = (ATAPI_SENSE_DATA *) aws->buf;
    364364
    365   DHEXDUMP(5,psd, sizeof(*psd), "sense buffer:\n");
     365  DHEXDUMP(DBG_DETAILED, psd, sizeof(*psd), "sense buffer:\n");
    366366
    367367  if ((pIorb->RequestControl & IORB_REQ_STATUSBLOCK) &&
  • trunk/src/os2ahci/ctxhook.c

    r205 r209  
    9797  rearm_ctx_hook = 0;
    9898
    99   DPRINTF(8,"restart_ctxhook() started\n");
     99  DPRINTF(DBG_FUNCBEG, DBG_PREFIX": restart_ctxhook() started\n");
    100100  memset(&done_queue, 0x00, sizeof(done_queue));
    101101
     
    124124        need_reset = 0;
    125125
    126         DPRINTF(8,"port %d, TF_DATA: 0x%x\n", p, readl(port_mmio + PORT_TFDATA));
     126        DPRINTF(DBG_DETAILED, DBG_PREFIX": port %d, TF_DATA: 0x%x\n", p, readl(port_mmio + PORT_TFDATA));
    127127
    128128        /* get "current command slot"; only valid if there are no NCQ cmds */
    129129        ccs = (int) ((readl(port_mmio + PORT_CMD) >> 8) & 0x1f);
    130         DPRINTF(8," PORT_CMD      = 0x%x\n", ccs);
     130        DPRINTF(DBG_DETAILED, DBG_PREFIX": PORT_CMD      = 0x%x\n", ccs);
    131131
    132132        for (vIorb = ai->ports[p].iorb_queue.vRoot; vIorb != FAR16NULL; vIorb = vNext)
     
    152152              {
    153153                /* this is the non-NCQ command that failed */
    154                 DPRINTF(0,"failing IORB: %x\n", vIorb);
     154                DPRINTF(0, DBG_PREFIX": failing IORB: %x\n", vIorb);
    155155                vProblemIorb = vIorb;
    156156              }
     
    179179        if (ai->ports[p].ncq_cmds != 0 || ai->ports[p].reg_cmds != 0)
    180180        {
    181           DPRINTF(0,"warning: commands issued not 0 (%08lx/%08lx); resetting...\n",
     181          DPRINTF(0, DBG_PREFIX": warning: commands issued not 0 (%08lx/%08lx); resetting...\n",
    182182                  ai->ports[p].ncq_cmds, ai->ports[p].reg_cmds);
    183183          need_reset = 1;
     
    278278  spin_unlock(drv_lock);
    279279
    280   DPRINTF(8,"restart_ctxhook() completed\n");
     280  DPRINTF(DBG_FUNCEND, DBG_PREFIX": restart_ctxhook() completed\n");
    281281
    282282  /* Check whether we have to rearm ourselves because some adapters were busy
     
    332332  rearm_ctx_hook = 0;
    333333
    334   DPRINTF(8,"reset_ctxhook() started\n");
     334  DPRINTF(DBG_FUNCBEG, DBG_PREFIX": reset_ctxhook() started\n");
    335335  memset(&done_queue, 0x00, sizeof(done_queue));
    336336
     
    457457  spin_unlock(drv_lock);
    458458
    459   DPRINTF(8,"reset_ctxhook() completed\n");
     459  DPRINTF(DBG_FUNCEND, DBG_PREFIX": reset_ctxhook() completed\n");
    460460
    461461  /* Check whether we have to rearm ourselves because some adapters were busy
     
    489489  D32ThunkStackTo32();
    490490
    491   DPRINTF(8,"engine_ctxhook() started\n");
     491  DPRINTF(DBG_FUNCBEG, DBG_PREFIX": engine_ctxhook() started\n");
    492492  if (resume_sleep_flag)
    493493  {
     
    503503  spin_unlock(drv_lock);
    504504
    505   DPRINTF(8,"engine_ctxhook() completed\n");
     505  DPRINTF(DBG_FUNCEND, DBG_PREFIX": engine_ctxhook() completed\n");
    506506
    507507  if (iorbs_sent != 0)
  • trunk/src/os2ahci/os2ahci.c

    r207 r209  
    5959int init_reset = 1;    /* if != 0, reset ports during init */
    6060int force_write_cache; /* if != 0, force write cache */
    61 int verbosity = 0;     /* default is quiet. 1=show sign on banner, >1=show adapter info during boot */
     61int iVerbose = 0;     /* default is quiet. 1=show sign on banner, >1=show adapter info during boot */
    6262int use_mbr_test = 1;
    6363
     
    182182    return(RPDONE | ((init_drv_failed) ? RPERR_INITFAIL : 0));
    183183  }
    184   D32g_DbgLevel = 0;
     184  #ifdef DEBUG
     185  D32g_DbgLevel = 0x80000000 | DEBUG;
     186  #endif
    185187  init_drv_called = 1;
    186188  suspended = 0;
     
    203205  if ((rmrc = RMCreateDriver(&rm_drvinfo, &rm_drvh)) != RMRC_SUCCESS)
    204206  {
    205     iprintf("%s: failed to register driver with resource manager (rc = %d)", drv_name, rmrc);
     207    iprintf("OS2AHCI.ADD: failed to register driver with resource manager (rc = %d)", rmrc);
    206208    goto init_fail;
    207209  }
     
    236238    }
    237239
    238     if (ArgCmp(pszCmdLine, "D"))
    239     {
    240       pszCmdLine++;
    241       if (*pszCmdLine == ':')
    242       {
    243         pszCmdLine++;
    244         D32g_DbgLevel = strtol(pszCmdLine, &pszCmdLine, 0);
    245       }
    246       else D32g_DbgLevel++; /* increase debug level */
    247       continue;
    248     }
     240    #ifdef DEBUG
     241    if (ArgCmp(pszCmdLine, "DEBUG:"))
     242    {
     243      pszCmdLine += 6;
     244      D32g_DbgLevel = strtol(pszCmdLine, &pszCmdLine, 0);
     245      continue;
     246    }
     247    #endif
    249248
    250249    if (ArgCmp(pszCmdLine, "G:"))
     
    261260      if (add_pci_id(usVendor, usDevice))
    262261      {
    263         iprintf("%s: failed to add PCI ID %04x:%04x", drv_name, usVendor, usDevice);
     262        iprintf("OS2AHCI.ADD: failed to add PCI ID %04x:%04x", usVendor, usDevice);
    264263        iStatus = 1;
    265264      }
     
    299298      if (adapter_index < 0 || adapter_index >= MAX_AD)
    300299      {
    301         iprintf("%s: invalid adapter index (%d)", drv_name, adapter_index);
     300        iprintf("OS2AHCI.ADD: invalid adapter index (%d)", adapter_index);
    302301        iStatus = 1;
    303302      }
     
    312311      if (port_index < 0 || port_index >= AHCI_MAX_PORTS)
    313312      {
    314         iprintf("%s: invalid port index (%d)", drv_name, port_index);
     313        iprintf("OS2AHCI.ADD: invalid port index (%d)", port_index);
    315314        iStatus = 1;
    316315      }
     
    393392    {
    394393      pszCmdLine++;
    395       if (*pszCmdLine == ':')
    396       {
    397         pszCmdLine++;
    398         verbosity = strtol(pszCmdLine, &pszCmdLine, 0);
    399       }
    400       else verbosity++; /* increase verbosity level */
     394      iVerbose = 1;
    401395      continue;
    402396    }
     
    410404    }
    411405
    412     iprintf("Unrecognized switch: %s", pszCmdLine-1);
     406    iprintf("OS2AHCI.ADD: Unrecognized switch: %s", pszCmdLine-1);
    413407    iStatus = 1; /* unrecognized argument */
    414408  }
     
    427421
    428422  /* print initialization message */
    429   ciprintf("%s driver version %d.%02d", drv_name, DMAJOR, DMINOR);
     423  if (iVerbose) iprintf("OS2AHCI.ADD: driver version %d.%02d", DMAJOR, DMINOR);
    430424
    431425  #ifdef TESTVER
     
    442436    if (Dev32Help_RegisterDeviceClass(drv_name, add_entry, 0, 1, &add_handle))
    443437    {
    444       iprintf("%s: couldn't register device class", drv_name);
     438      iprintf("OS2AHCI.ADD: couldn't register device class");
    445439      goto init_fail;
    446440    }
     
    461455  {
    462456    /* no adapters found */
    463     ciprintf("%s: No adapters found.", drv_name);
     457    if (iVerbose) iprintf("OS2AHCI.ADD: No adapters found.");
    464458  }
    465459
     
    474468  }
    475469
    476   ciprintf("%s driver *not* installed", drv_name);
     470  if (iVerbose) iprintf("OS2AHCI.ADD: driver *not* installed");
    477471  return(RPDONE | RPERR_INITFAIL);
    478472}
     
    486480USHORT gen_ioctl(REQPACKET *ioctl)
    487481{
    488   DPRINTF(2,"IOCTL 0x%x/0x%x\n", ioctl->ioctl.bCategory, ioctl->ioctl.bFunction);
     482  DPRINTF(DBG_FUNCBEG, DBG_PREFIX": IOCTL 0x%x/0x%x\n", ioctl->ioctl.bCategory, ioctl->ioctl.bFunction);
    489483  AhciStats.ulTestCount2++;
    490484
     
    544538USHORT exit_drv(int func)
    545539{
    546   DPRINTF(2,"exit_drv(%d) called\n", func);
     540  DPRINTF(DBG_FUNCBEG|DBG_INIT, DBG_PREFIX": exit_drv(%d) called\n", func);
    547541
    548542  if (func == 0)
     
    562556USHORT sr_drv(int func)
    563557{
    564   DPRINTF(2,"sr_drv(%d) called\n", func);
     558  DPRINTF(DBG_FUNCBEG|DBG_INIT, DBG_PREFIX": sr_drv(%d) called\n", func);
    565559
    566560  if (func) resume();
     
    859853    if (!init_complete)
    860854    {
    861       DPRINTF(1,"leaving initialization mode\n");
     855      DPRINTF(DBG_INIT, DBG_PREFIX": leaving initialization mode\n");
    862856      for (a = 0; a < ad_info_cnt; a++)
    863857      {
     
    872866        unlock_adapter(ad_infos + a);
    873867      }
    874       DPRINTF(1,"leaving initialization mode 2\n");
     868      DPRINTF(DBG_INIT, DBG_PREFIX": leaving initialization mode 2\n");
    875869
    876870      #ifdef LEGACY_APM
     
    13081302
    13091303  #ifdef DEBUG
    1310   if (D32g_DbgLevel)
    13111304  {
    13121305    /* determine queue type (local, driver, abort or port) and minimum debug
     
    13141307     */
    13151308    char *queue_type;
    1316     int min_debug = 7;
     1309    int min_debug = DBG_DETAILED;
    13171310
    13181311    if ((u32)queue >> 16 == (u32)&queue >> 16) /* DAZ this is bogus */
     
    13201313      /* this queue is on the stack */
    13211314      queue_type = "local";
    1322       min_debug = 8;
     1315      min_debug = DBG_DETAILED;
    13231316    }
    13241317    else if (queue == &driver_queue)
     
    13291322    {
    13301323      queue_type = "abort";
    1331       min_debug = 8;
     1324      min_debug = DBG_DETAILED;
    13321325    }
    13331326    else
     
    13361329    }
    13371330
    1338     DPRINTF(min_debug,"IORB %x queued (cmd=%d/%d queue=%x [%s], timeout=%d)\n",
     1331    dprintf(min_debug, DBG_PREFIX": IORB %x queued (cmd=%d/%d queue=%x [%s], timeout=%d)\n",
    13391332           vIorb, pIorb->CommandCode, pIorb->CommandModifier, queue, queue_type,
    13401333           pIorb->Timeout);
     
    13811374  if (found)
    13821375  {
    1383     DPRINTF(8,"IORB %x removed (queue = %x)\n", vIorb, queue);
     1376    DPRINTF(DBG_DETAILED, DBG_PREFIX": IORB %x removed (queue = %x)\n", vIorb, queue);
    13841377  }
    13851378  else
    13861379  {
    1387     DPRINTF(2,"IORB %x not found in queue %x\n", vIorb, queue);
     1380    DPRINTF(0, DBG_PREFIX": IORB %x not found in queue %x\n", vIorb, queue);
    13881381  }
    13891382  #endif
     
    14541447  pIorb->Status |= IORB_DONE;
    14551448
    1456   DPRINTF(7,"IORB %x complete status=0x%04x error=0x%04x\n",
     1449  DPRINTF(DBG_FUNCBEG, DBG_PREFIX": IORB %x complete status=0x%04x error=0x%04x\n",
    14571450          vIorb, pIorb->Status, pIorb->ErrorCode);
    14581451
  • trunk/src/os2ahci/os2ahci.h

    r207 r209  
    6464#define MAX_RETRIES 3
    6565
     66#define DBG_ALWAYS    0x0000
     67#define DBG_FUNCBEG   0x0001
     68#define DBG_FUNCEND   0x0002
     69#define DBG_ATTACH    0x0004
     70#define DBG_DETAILED  0x0008
     71#define DBG_INIT      0x0010
     72#define DBG_SPECIAL   0x0020
     73#define DBG_VERBOSE   0x0100
     74#define DBG_ERROR_ALL 0x800000ff
     75
     76#define DBG_PREFIX "AHCI: "__func__
     77
    6678/* debug output macros */
    6779#ifdef DEBUG
    6880#define DPRINTF(a,b,...) dprintf(a, b, ##__VA_ARGS__)
    6981#define DHEXDUMP(a,b,c,d,...) dHexDump(a, b, c, d, ##__VA_ARGS__)
    70 #define DUMP_HOST_REGS(l,a,b) {if (D32g_DbgLevel>=l) ahci_dump_host_regs(a,b);}
    71 #define DUMP_PORT_REGS(l,a,b) {if (D32g_DbgLevel>=l) ahci_dump_port_regs(a,b);}
     82#define DUMP_HOST_REGS(l,a,b) {if (D32g_DbgLevel&l) ahci_dump_host_regs(a,b);}
     83#define DUMP_PORT_REGS(l,a,b) {if (D32g_DbgLevel&l) ahci_dump_port_regs(a,b);}
    7284#else
    7385#define DPRINTF(a,b,...)
     
    7688#define DUMP_PORT_REGS(l,a,b)
    7789#endif
    78 
    79 /* verbosity console print macros
    80  * (we use 'i' in ciprintf here to avoid name clash
    81  * with vprintf-like funcs)
    82  */
    83 #define ciprintf(a,...)  {if (verbosity > 0) iprintf(a, ##__VA_ARGS__);}
    84 #define ciiprintf(a,...) {if (verbosity > 1) iprintf(a, ##__VA_ARGS__);}
    8590
    8691/* adapter number from AD_INFO pointer; mainly for dprintf() purposes */
     
    230235
    231236typedef struct {
    232     ULONG Cylinders;
    233     USHORT HeadsPerCylinder;
    234     USHORT SectorsPerTrack;
    235     ULONGLONG  TotalSectors;
    236     char *Method;
     237    ULONG ulCylinders;
     238    USHORT usHeadsPerCylinder;
     239    USHORT usSectorsPerTrack;
     240    ULONGLONG  ullTotalSectors;
     241    char *pMethod;
    237242} DEV_INFO;
    238243
     
    479484extern int init_reset; /* if != 0, reset ports during init */
    480485extern int force_write_cache; /* if != 0, force write cache */
    481 extern int verbosity; /* if != 0, show some info during boot */
     486extern int iVerbose; /* if != 0, show some info during boot */
    482487extern int use_mbr_test;
    483488
  • trunk/src/os2ahci/pci.c

    r205 r209  
    271271  USHORT BusDevFunc;
    272272
    273   DPRINTF(3,"scanning PCI bus...\n");
     273  DPRINTF(DBG_INIT|DBG_FUNCBEG, DBG_PREFIX": scanning PCI bus...\n");
    274274
    275275  /* Go through the list of PCI IDs and search for each device
     
    374374  {
    375375    /* set IRQ for first device/func to 11 */
    376     DPRINTF(1,"hacking virtualbox PIIX3 PCI to ISA bridge IRQ mapping\n");
     376    DPRINTF(DBG_INIT, DBG_PREFIX": hacking virtualbox PIIX3 PCI to ISA bridge IRQ mapping\n");
    377377    irq = ad_infos[0].irq;
    378378    PciWriteConfig(0x0008, 0x60, sizeof(irq), irq);
     
    467467  pin = (int) ((val >> 8) & 0xff);
    468468
    469   #if 0
    470   i = 1;
    471   if (irq==0 || irq==255) i = 0;
    472 
    473   if (verbosity > i)
    474   {
    475     iprintf("%s AHCI device %s %s (%d:%d:%d %04x:%04x) class:0x%06x", i?"Found":"Ignoring",
    476      vendor_from_id(vendor), device_from_id(device),
    477      PCI_BUS_FROM_BDF(BusDevFunc), PCI_DEV_FROM_BDF(BusDevFunc), PCI_FUNC_FROM_BDF(BusDevFunc),
    478      vendor, device, class);
    479     if (i==0) iprintf("Invalid interrupt (IRQ=%d).", irq);
    480   }
    481   if (i==0) return;
    482   #endif
    483 
    484469  /* make sure we got room in the adapter information array */
    485470  if (ad_info_cnt >= MAX_AD - 1)
    486471  {
    487     iprintf("%s: too many AHCI devices", drv_name);
     472    iprintf("OS2AHCI.ADD: too many AHCI devices");
    488473    return;
    489474  }
     
    511496   */
    512497
    513   ciprintf("Adapter %d PCI=%d:%d:%d ID=%04x:%04x\n", ad_info_cnt, PCI_BUS_FROM_BDF(BusDevFunc),
    514     PCI_DEV_FROM_BDF(BusDevFunc), PCI_FUNC_FROM_BDF(BusDevFunc), vendor, device);
    515   DPRINTF(1,"Adapter %d PCI=%d:%d:%d ID=%04x:%04x\n", ad_info_cnt, PCI_BUS_FROM_BDF(BusDevFunc),
     498  if (iVerbose)
     499  {
     500    iprintf("OS2AHCI.ADD: Adapter %d PCI=%d:%d:%d ID=%04x:%04x", ad_info_cnt, PCI_BUS_FROM_BDF(BusDevFunc),
     501      PCI_DEV_FROM_BDF(BusDevFunc), PCI_FUNC_FROM_BDF(BusDevFunc), vendor, device);
     502  }
     503  DPRINTF(DBG_INIT, DBG_PREFIX": Adapter %d PCI=%d:%d:%d ID=%04x:%04x\n", ad_info_cnt, PCI_BUS_FROM_BDF(BusDevFunc),
    516504    PCI_DEV_FROM_BDF(BusDevFunc), PCI_FUNC_FROM_BDF(BusDevFunc), vendor, device);
    517505
     
    535523      if (resource.ResourceType != RS_TYPE_MEM)
    536524      {
    537         iprintf("%s: BAR #5 must be an MMIO region", drv_name);
     525        iprintf("OS2AHCI.ADD: BAR #5 must be an MMIO region");
    538526        goto add_pci_fail;
    539527      }
     
    549537      if (ret == RMRC_RES_ALREADY_CLAIMED)
    550538      {
    551         ciiprintf("Device already claimed.");
     539        if (iVerbose) iprintf("OS2AHCI.ADD: Device already claimed.");
    552540      }
    553541      else
    554542      {
    555         iprintf("%s: couldn't register [MM]IO region (rc = %s)", drv_name, rmerr(ret));
     543        iprintf("OS2AHCI.ADD: couldn't register [MM]IO region (rc = %s)", rmerr(ret));
    556544      }
    557545      goto add_pci_fail;
     
    562550  if (ad_info->mmio_phys == 0)
    563551  {
    564     iprintf("%s: couldn't determine MMIO base address", drv_name);
     552    iprintf("OS2AHCI.ADD: couldn't determine MMIO base address");
    565553    goto add_pci_fail;
    566554  }
     
    602590  if (ret != RMRC_SUCCESS)
    603591  {
    604     iprintf("%s: couldn't register adapter (rc = %s)", drv_name, rmerr(ret));
     592    iprintf("OS2AHCI.ADD: couldn't register adapter (rc = %s)", rmerr(ret));
    605593    goto add_pci_fail;
    606594  }
     
    666654      PciWriteConfig(BusDevFunc, PCI_BAR(i), sizeof(u32), bar_addr) )
    667655  {
    668     iprintf("%s: couldn't determine [MM]IO size", drv_name);
     656    iprintf("OS2AHCI.ADD: couldn't determine [MM]IO size");
    669657    if (bar_addr != 0)
    670658    {
     
    703691  }
    704692
    705   DPRINTF(3,"BAR #%d: type = %s, addr = 0x%08lx, size = %d\n", i,
    706            (resource->ResourceType == RS_TYPE_IO) ? "I/O" : "MEM",
    707            bar_addr, bar_size);
     693  DPRINTF(DBG_INIT, DBG_PREFIX": BAR #%d: type = %s, addr = 0x%08lx, size = %d\n", i,
     694           (resource->ResourceType == RS_TYPE_IO) ? "I/O" : "MEM", bar_addr, bar_size);
    708695
    709696  return((long) bar_size);
  • trunk/src/os2ahci/trace.c

    r207 r209  
    4242          if (pi->devs[d].atapi) dprintf(0," atapi");
    4343          if (pi->devs[d].removable) dprintf(0," removable");
    44           if (pi->devs[d].dev_info.Method != NULL)
     44          if (pi->devs[d].dev_info.pMethod != NULL)
    4545          {
    4646            dprintf(0," %d cylinders, %d heads, %d sectors per track (%dMB) (%s)",
    47               pi->devs[d].dev_info.Cylinders, pi->devs[d].dev_info.HeadsPerCylinder, pi->devs[d].dev_info.SectorsPerTrack,
    48               (ULONG)(pi->devs[d].dev_info.TotalSectors/2048), pi->devs[d].dev_info.Method);
     47              pi->devs[d].dev_info.ulCylinders, pi->devs[d].dev_info.usHeadsPerCylinder,
     48              pi->devs[d].dev_info.usSectorsPerTrack,
     49              (ULONG)(pi->devs[d].dev_info.ullTotalSectors/2048), pi->devs[d].dev_info.pMethod);
    4950          }
    5051          if (pi->devs[d].ignored) dprintf(0," Unusable");
     
    5253          dprintf(0,"          Model: %s\n", pi->devs[d].dev_name);
    5354        }
    54         else if (verbosity > 0)
     55        else if (iVerbose > 0)
    5556        {
    5657          if (iFlag) dprintf(0,"  Port %d: No drive present\n", p);
     
    6465void DumpIorb(IORBH *pIorb)
    6566{
    66   if (D32g_DbgLevel < 2) return;
     67  if (!(D32g_DbgLevel & DBG_DETAILED)) return;
    6768  if (!ad_infos[iorb_unit_adapter(pIorb)].ports[iorb_unit_port(pIorb)].devs[iorb_unit_device(pIorb)].atapi) return;
    6869
Note: See TracChangeset for help on using the changeset viewer.