Changeset 193


Ignore:
Timestamp:
Dec 12, 2017, 11:08:37 PM (8 years ago)
Author:
David Azarewicz
Message:

Fixed IOCtl pass-thru interface.
Cosmetic changes to user interface.
Removed old IBM smartctl exe from distribution.

Location:
trunk/src/os2ahci
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/os2ahci/Makefile

    r190 r193  
    1212# Define default build version if not specified in environment
    1313BLD_MAJOR=2
    14 BLD_MINOR=03 # must be 2 digits
     14BLD_MINOR=04 # must be 2 digits
    1515BLD_REV=0 # not used at this time
    1616
     
    166166  copy /b $(ROOT)\src\os2ahci\$(O)\os2ahci.sym $(ZIPDIR)\pkg1 >NUL
    167167
    168   @md $(ZIPDIR)\pkg2
    169   @copy /b $(ROOT)\Tools\smartahci.exe $(ZIPDIR)\pkg2 >NUL
    170 
    171168  @md $(ZIPDIR)\pkg20
    172169  @copy $(ROOT)\src\os2ahci\ReadMe.txt $(ZIPDIR)\pkg20 >NUL
  • trunk/src/os2ahci/ReadMe.txt

    r191 r193  
    1 AHCI Driver for OS/2 v2.03
     1AHCI Driver for OS/2 v2.04
    22
    33Introduction
     
    321321
    322322Starting with version 1.22, OS2AHCI supports the IOCTL interface required by
    323 existing SMART monitoring tools. Since those tools are hard-coded to open
    324 the character device named "IBMS506$", they will not work with OS2AHCI unless
    325 modified to open the OS2AHCI$ device. Previous versions of OS2AHCI used to
    326 register a duplicate device with the IBMS506$ name, however since that caused
    327 so many unacceptable problems, that is no longer done. You must have a SMART
    328 utility that opens the OS2AHCI$ device to access the AHCI driver.
    329 
    330 A patched version of the smartctl.exe program is included in the OS2AHCI
    331 distribution. This patched version simply has the name "IBMS506$" changed
    332 to "OS2AHCI$" and is otherwise identical. This patched program has been
    333 renamed to smartahci.exe to distinguish it from the unpatched version.
    334 The patched smartahci.exe program is provided AS-IS and is completely
    335 UNSUPPORTED. Use of this program is at your own risk.
     323existing SMART monitoring tools. Beware that the IBM version of smartctl.exe
     324is hard-coded to open the character device named "IBMS506$" so it will not
     325work with OS2AHCI. You must use a version that allows specifying ahci devices.
    336326
    337327NOTES:
     
    360350
    361351Hot swap is not supported.
     352Port expanders are not supported. Only one drive per port is allowed.
    362353
    363354
     
    387378Change Log
    388379==========
     380
     381v.2.04 06-Dec-2017 - David Azarewicz
     382  Cosmetic changes to user display.
     383  Fixed the ioctl pass-thru interface.
     384  Removed the old IBM smartctl.exe from the distribution.
    389385
    390386v.2.03 15-Jul-2017 - David Azarewicz
  • trunk/src/os2ahci/ahci.c

    r191 r193  
    504504  }
    505505
     506  if (ai->pci_vendor == PCI_VENDOR_ID_INTEL)
     507  {
     508    /* Adapter is not in AHCI mode and the spec says a COMRESET is
     509     * required when switching from SATA to AHCI mode and vice versa.
     510     */
     511    init_reset = 1;
     512  }
     513
    506514  /* some controllers need AHCI_EN to be written multiple times */
    507515  for (i = 0; i < 5; i++)
  • trunk/src/os2ahci/ioctl.c

    r191 r193  
    5555  SCATGATENTRY        sg_lst[AHCI_MAX_SG / 2]; /* scatter/gather list */
    5656  ULONG               sg_cnt;                  /* number of S/G elements */
    57   struct _KernVMLock_t *lh;                  /* lock handle for VMLock() */
     57  struct _KernVMLock_t lh;                     /* lock handle for KernVMLock() */
    5858} IOCTL_CONTEXT;
    5959
    6060/* -------------------------- function prototypes -------------------------- */
    6161
    62 static USHORT do_smart  (BYTE unit, BYTE sub_func, BYTE cnt, BYTE lba_l,
    63                          void *buf);
    64 static int    map_unit  (BYTE unit, USHORT *a, USHORT *p,
    65                          USHORT *d);
     62static USHORT do_smart(BYTE unit, BYTE sub_func, BYTE cnt, BYTE lba_l, void *buf);
     63static int map_unit(BYTE unit, USHORT *a, USHORT *p, USHORT *d);
    6664
    6765extern IORBH FAR16DATA * (__far16 *Far16AdrOfIoctlWakeup16)(IORBH FAR16DATA*);
     
    168166  memset(ic, 0x00, sizeof(*ic));
    169167
     168  /* lock DMA transfer buffer into memory and construct S/G list */
     169  if (req->buflen > 0)
     170  {
     171    if (KernVMLock(VMDHL_LONG | !((req->flags & PT_WRITE) ? VMDHL_WRITE : 0),
     172                       req->buf, req->buflen, &ic->lh, (KernPageList_t*)&ic->sg_lst, &ic->sg_cnt) != 0)
     173    {
     174      /* couldn't lock buffer and/or produce a S/G list */
     175      MemFree(ic);
     176      return(RPDONE | RPERR_PARAMETER);
     177    }
     178  }
     179
    170180  /* fill in adapter passthrough fields */
    171181  ic->iorb.iorbh.Length           = sizeof(ic->iorb);
     
    200210
    201211  /* Wait for IORB completion. */
    202   spin_lock(drv_lock);
     212
     213  //DAZ 20171206 spin_lock(drv_lock);
    203214  while (!(ic->iorb.iorbh.Status & IORB_DONE))
    204215  {
    205     KernBlock((ULONG)&ic->iorb.iorbh, 30000, 0, NULL, NULL);
    206   }
    207   spin_unlock(drv_lock);
     216    KernBlock(CastFar16ToULONG(MemFar16Adr(&ic->iorb.iorbh)), 30000, 0, NULL, NULL);
     217  }
     218  //DAZ 20171206 spin_unlock(drv_lock);
    208219
    209220  ret = RPDONE;
     
    270281      memcpy(sense_buf, ic->sense, min(ic->ssb.ReqSenseLen, req->sense_len));
    271282    }
    272 
    273283  }
    274284  else if ((req->flags & PT_ATAPI) == 0)
     
    282292
    283293  MemFree(ic);
     294  if (req->buflen > 0) KernVMUnlock(&ic->lh);
    284295  return(ret);
    285296}
     
    393404{
    394405  DSKSP_CommandParameters *cp = (DSKSP_CommandParameters *)Far16ToFlat(ioctl->ioctl.pvParm);
    395   USHORT size = 0;
    396406  USHORT ret;
    397407  UCHAR unit;
    398   UCHAR parm;
     408  UCHAR parm = 0;
     409  void *pData = NULL;
    399410
    400411  unit = cp->byPhysicalUnit;
    401412
    402   /* verify addressability of data buffer (depends on SMART function) */
    403   switch (ioctl->ioctl.bFunction)
    404   {
    405 
    406   case DSKSP_SMART_GETSTATUS:
    407     size = sizeof(ULONG);
    408     break;
    409 
    410   case DSKSP_SMART_GET_ATTRIBUTES:
    411   case DSKSP_SMART_GET_THRESHOLDS:
    412   case DSKSP_SMART_GET_LOG:
    413     size = 512;
    414     break;
    415   }
    416 
    417   if (size > 0)
    418   {
    419     parm = *(UCHAR*)Far16ToFlat(ioctl->ioctl.pvData);
     413  if (ioctl->ioctl.pvData)
     414  {
     415    pData = (void*)Far16ToFlat(ioctl->ioctl.pvData);
     416    parm = *(UCHAR*)pData;
    420417  }
    421418
     
    444441
    445442  case DSKSP_SMART_GETSTATUS:
    446     ret = do_smart(unit, ATA_SMART_STATUS, 0, 0, Far16ToFlat(ioctl->ioctl.pvData));
     443    ret = do_smart(unit, ATA_SMART_STATUS, 0, 0, pData);
    447444    break;
    448445
    449446  case DSKSP_SMART_GET_ATTRIBUTES:
    450     ret = do_smart(unit, ATA_SMART_READ_VALUES, 0, 0, Far16ToFlat(ioctl->ioctl.pvData));
     447    ret = do_smart(unit, ATA_SMART_READ_VALUES, 0, 0, pData);
    451448    break;
    452449
    453450  case DSKSP_SMART_GET_THRESHOLDS:
    454     ret = do_smart(unit, ATA_SMART_READ_THRESHOLDS, 0, 0, Far16ToFlat(ioctl->ioctl.pvData));
     451    ret = do_smart(unit, ATA_SMART_READ_THRESHOLDS, 0, 0, pData);
    455452    break;
    456453
    457454  case DSKSP_SMART_GET_LOG:
    458     ret = do_smart(unit, ATA_SMART_READ_LOG, 1, parm, Far16ToFlat(ioctl->ioctl.pvData));
     455    ret = do_smart(unit, ATA_SMART_READ_LOG, 1, parm, pData);
    459456    break;
    460457
  • trunk/src/os2ahci/trace.c

    r186 r193  
    2525  int p;
    2626  int d;
     27  int iFlag;
    2728
    2829  for (a = 0; a < ad_info_cnt; a++)
     
    3738      ai->bios_config[HOST_VERSION / sizeof(u32)]);
    3839
    39     for (p = 0; p <= ai->port_max; p++)
     40    for (p = 0; p < ai->hw_ports; p++)
    4041    {
    4142      P_INFO *pi = &ai->ports[p];
    42 
    43       dprintf(0,"  Port %d:\n", p);
     43      iFlag = 1;
    4444
    4545      for (d = 0; d <= pi->dev_max; d++)
    4646      {
    47         if (!pi->devs[d].present)
     47        if (pi->devs[d].present)
    4848        {
    49           dprintf(0,"    No drive present\n");
    50         } else {
     49          if (iFlag) dprintf(0,"  Port %d:\n", p);
     50          iFlag = 0;
    5151          dprintf(0,"    Drive %d:", d);
    5252          if (pi->devs[d].atapi) dprintf(0," atapi");
     
    6060          dprintf(0,"\n");
    6161          dprintf(0,"             Model: %s\n", pi->devs[d].dev_name);
     62        }
     63        else if (verbosity > 0)
     64        {
     65          if (iFlag) dprintf(0,"  Port %d:\n", p);
     66          iFlag = 0;
     67          dprintf(0,"    No drive present\n");
    6268        } /* if */
    6369      } /* for d */
Note: See TracChangeset for help on using the changeset viewer.