Changeset 165 for trunk/src/os2ahci/ioctl.c
- Timestamp:
- Jul 31, 2013, 8:08:59 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/os2ahci/ioctl.c
r129 r165 207 207 ic->iorb.iorbh.UnitHandle = iorb_unit(a, p, d); 208 208 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; 211 210 ic->iorb.iorbh.RequestControl = IORB_ASYNC_POST; 212 211 ic->iorb.iorbh.Timeout = req->timeout; … … 234 233 add_entry(&ic->iorb.iorbh); 235 234 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. */ 248 236 spin_lock(drv_lock); 249 237 while (!(ic->iorb.iorbh.Status & IORB_DONE)) { 250 251 # ifndef OS2AHCI_SMP252 drv_lock = 0;253 # endif254 255 238 DevHelp_ProcBlock((ULONG) (void _far *) &ic->iorb.iorbh, 30000, 1); 256 spin_lock(drv_lock);257 239 } 258 240 spin_unlock(drv_lock); … … 355 337 USHORT d; 356 338 UCHAR unit; 357 339 358 340 /* verify addressability of parm buffer (DSKSP_CommandParameters) */ 359 341 if (DevHelp_VerifyAccess((SEL) ((ULONG) cp >> 16), … … 499 481 500 482 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); 504 484 break; 505 485 506 486 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); 509 488 break; 510 489 … … 547 526 * Perform SMART request. The code has been more or less copied from DANIS506. 548 527 */ 549 static USHORT do_smart(BYTE unit, BYTE sub_func, BYTE cnt, BYTE lba_l, 550 void _far *buf) 528 static USHORT do_smart(BYTE unit, BYTE sub_func, BYTE cnt, BYTE lba_l, void _far *buf) 551 529 { 552 530 OS2AHCI_PASSTHROUGH pt; … … 584 562 } 585 563 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) { 588 565 589 566 /* ATA_SMART_STATUS doesn't transfer anything but instead relies on the
Note:
See TracChangeset
for help on using the changeset viewer.