Ignore:
Timestamp:
Jul 31, 2013, 8:08:59 PM (12 years ago)
Author:
David Azarewicz
Message:

code cleanup - debug messages
fixed defect in smart ioctl

File:
1 edited

Legend:

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

    r129 r165  
    207207  ic->iorb.iorbh.UnitHandle       = iorb_unit(a, p, d);
    208208  ic->iorb.iorbh.CommandCode      = IOCC_ADAPTER_PASSTHRU;
    209   ic->iorb.iorbh.CommandModifier  = (req->flags & PT_ATAPI) ? IOCM_EXECUTE_CDB
    210                                                             : IOCM_EXECUTE_ATA;
     209  ic->iorb.iorbh.CommandModifier  = (req->flags & PT_ATAPI) ? IOCM_EXECUTE_CDB : IOCM_EXECUTE_ATA;
    211210  ic->iorb.iorbh.RequestControl   = IORB_ASYNC_POST;
    212211  ic->iorb.iorbh.Timeout          = req->timeout;
     
    234233  add_entry(&ic->iorb.iorbh);
    235234
    236   /* Wait for IORB completion. On SMP kernels, ProcBlock will release
    237    * all spinlocks currently held, in addition to re-enabling interrupts,
    238    * so we can use spinlocks to protect the time between checking the
    239    * IORB_DONE flag and calling ProcBlock.
    240    *
    241    * However, if OS2AHCI_SMP is not defined, we're emulating spinlocks
    242    * via disabling interrupts and there's a sanity check in the emulation
    243    * code to catch recursive spinlocks, thus we need to reset the emulated
    244    * spinlock status before calling ProcBlock. Otherwise, the driver will
    245    * will get caught in the sanity checks when processing the next IORB or
    246    * interrupt while we're waiting.
    247    */
     235  /* Wait for IORB completion. */
    248236  spin_lock(drv_lock);
    249237  while (!(ic->iorb.iorbh.Status & IORB_DONE)) {
    250 
    251 #   ifndef OS2AHCI_SMP
    252       drv_lock = 0;
    253 #   endif
    254 
    255238    DevHelp_ProcBlock((ULONG) (void _far *) &ic->iorb.iorbh, 30000, 1);
    256     spin_lock(drv_lock);
    257239  }
    258240  spin_unlock(drv_lock);
     
    355337  USHORT d;
    356338  UCHAR unit;
    357  
     339
    358340  /* verify addressability of parm buffer (DSKSP_CommandParameters) */
    359341  if (DevHelp_VerifyAccess((SEL) ((ULONG) cp >> 16),
     
    499481
    500482  case DSKSP_SMART_ONOFF:
    501     ret = do_smart(unit, (BYTE) ((parm) ? ATA_SMART_ENABLE
    502                                         : ATA_SMART_DISABLE),
    503                    0, 0, NULL);
     483    ret = do_smart(unit, (BYTE) ((parm) ? ATA_SMART_ENABLE : ATA_SMART_DISABLE), 0, 0, NULL);
    504484    break;
    505485
    506486  case DSKSP_SMART_AUTOSAVE_ONOFF:
    507     ret = do_smart(unit, ATA_SMART_AUTOSAVE,
    508                    (BYTE) ((parm) ? (BYTE) 0xf1 : 0), 0, NULL);
     487    ret = do_smart(unit, ATA_SMART_AUTOSAVE, (BYTE) ((parm) ? (BYTE) 0xf1 : 0), 0, NULL);
    509488    break;
    510489
     
    547526 * Perform SMART request. The code has been more or less copied from DANIS506.
    548527 */
    549 static USHORT do_smart(BYTE unit, BYTE sub_func, BYTE cnt, BYTE lba_l,
    550                        void _far *buf)
     528static USHORT do_smart(BYTE unit, BYTE sub_func, BYTE cnt, BYTE lba_l, void _far *buf)
    551529{
    552530  OS2AHCI_PASSTHROUGH pt;
     
    584562  }
    585563
    586   if (((ret = gen_ioctl(&ioctl)) & STERR) == 0 &&
    587       sub_func == ATA_SMART_STATUS) {
     564  if (((ret = gen_ioctl(&ioctl)) & STERR) == 0 && sub_func == ATA_SMART_STATUS) {
    588565
    589566    /* ATA_SMART_STATUS doesn't transfer anything but instead relies on the
Note: See TracChangeset for help on using the changeset viewer.