Changeset 211 for trunk/src/os2ahci/os2ahci.c
- Timestamp:
- Jul 24, 2023, 5:51:46 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/os2ahci/os2ahci.c
r209 r211 4 4 * Copyright (c) 2011 thi.guten Software Development 5 5 * Copyright (c) 2011 Mensys B.V. 6 * Copyright (c) 2013-202 1David Azarewicz <david@88watts.net>6 * Copyright (c) 2013-2023 David Azarewicz <david@88watts.net> 7 7 * 8 8 * Authors: Christian Mueller, Markus Thielen … … 26 26 */ 27 27 28 #define INCL_LONGLONG 28 29 #include "os2ahci.h" 29 30 #include "ioctl.h" … … 58 59 int thorough_scan = 1; /* if != 0, perform thorough PCI scan */ 59 60 int init_reset = 1; /* if != 0, reset ports during init */ 60 int force_write_cache ; /* if != 0, force write cache */61 int force_write_cache = 0; /* if != 0, force write cache */ 61 62 int iVerbose = 0; /* default is quiet. 1=show sign on banner, >1=show adapter info during boot */ 62 63 int use_mbr_test = 1; … … 190 191 memset(ad_infos, 0, sizeof(ad_infos)); 191 192 memset(emulate_scsi, 1, sizeof(emulate_scsi)); /* set default enabled */ 193 memset(enable_ncq, 1, sizeof(enable_ncq)); /* set default enabled */ 192 194 UtSetDriverName("OS2AHCI$"); 193 195 Header.ulCaps |= DEV_ADAPTER_DD; /* DAZ This flag is not really needed. */ … … 423 425 if (iVerbose) iprintf("OS2AHCI.ADD: driver version %d.%02d", DMAJOR, DMINOR); 424 426 425 #if def TESTVER427 #if defined(TESTVER) && defined(DEBUG) 426 428 #include "testver.c" 427 429 #endif … … 443 445 444 446 /* allocate context hooks */ 445 KernAllocateContextHook( restart_ctxhook, 0, &restart_ctxhook_h);446 KernAllocateContextHook( reset_ctxhook, 0, &reset_ctxhook_h);447 KernAllocateContextHook(RestartCtxHook, 0, &RestartCtxHook_h); 448 KernAllocateContextHook(ResetCtxHook, 0, &ResetCtxHook_h); 447 449 KernAllocateContextHook(engine_ctxhook, 0, &engine_ctxhook_h); 448 450 … … 481 483 { 482 484 DPRINTF(DBG_FUNCBEG, DBG_PREFIX": IOCTL 0x%x/0x%x\n", ioctl->ioctl.bCategory, ioctl->ioctl.bFunction); 483 AhciStats.ulTestCount2++;484 485 485 486 switch (ioctl->ioctl.bCategory) … … 599 600 memset(&pIorb->ADDWorkSpace, 0x00, sizeof(ADD_WORKSPACE)); 600 601 601 #ifdef DEBUG602 DumpIorb(pIorb); /* DAZ TESTING */603 #endif602 //#ifdef DEBUG 603 //DumpIorb(pIorb); /* DAZ TESTING */ 604 //#endif 604 605 605 606 if (iorb_driver_level(pIorb)) … … 622 623 { 623 624 /* unit handle outside of the allowed range */ 624 dprintf(0, "warning: IORB for %d.%d.%dout of range\n", a, p, d);625 dprintf(0, DBG_PREFIX": ERROR: IORB for %d.%d.%d is out of range\n", a, p, d); 625 626 pIorb->Status = IORB_ERROR; 626 627 pIorb->ErrorCode = IOERR_CMD_SYNTAX; … … 920 921 921 922 /* trigger reset context hook which will finish the abort processing */ 922 KernArmHook(reset_ctxhook_h, 0, 0);923 SafeArmCtxHook(ResetCtxHook_h, 0); 923 924 break; 924 925 … … 1071 1072 if ((u32)(pPtr + 1) - (u32)pDt > pIorb_conf->DeviceTableLen) 1072 1073 { 1073 dprintf(0, "error: device table provided by DASD too small\n");1074 dprintf(0, DBG_PREFIX": error: device table provided by DASD too small\n"); 1074 1075 iorb_seterr(pIorb, IOERR_CMD_SW_RESOURCE); 1075 1076 goto iocm_device_table_done; … … 1100 1101 if (ad_info->busy) 1101 1102 { 1102 dprintf(0, "error: port scan requested while adapter was busy\n");1103 dprintf(0, DBG_PREFIX": error: port scan requested while adapter was busy\n"); 1103 1104 iorb_seterr(pIorb, IOERR_CMD_SW_RESOURCE); 1104 1105 goto iocm_device_table_done; … … 1112 1113 if (rc != 0) 1113 1114 { 1114 dprintf(0, "error: port scan failed on adapter #%d\n", dta);1115 dprintf(0, DBG_PREFIX": error: port scan failed on adapter #%d\n", dta); 1115 1116 iorb_seterr(pIorb, IOERR_CMD_SW_RESOURCE); 1116 1117 goto iocm_device_table_done; … … 1533 1534 * separate function which is invoked via a context hook. 1534 1535 */ 1535 void __syscall timeout_callback(ULONG timer_handle, ULONG p1)1536 { 1537 IORBH FAR16DATA *vIorb = (IORBH FAR16DATA *)CastULONGToFar16( p1);1536 void __syscall timeout_callback(ULONG timer_handle, ULONG ulArg) 1537 { 1538 IORBH FAR16DATA *vIorb = (IORBH FAR16DATA *)CastULONGToFar16(ulArg); 1538 1539 IORBH *pIorb = Far16ToFlat(vIorb); 1539 1540 int a = iorb_unit_adapter(pIorb); … … 1541 1542 1542 1543 Timer_CancelTimer(timer_handle); 1543 dprintf(0,"timeout for IORB %x port=%x\n", vIorb, p); 1544 1545 /* Move the timed-out IORB to the abort queue. Since it's possible that the 1546 * IORB has completed after the timeout has expired but before we got to 1547 * this line of code, we'll check the return code of iorb_queue_del(): If it 1548 * returns an error, the IORB must have completed a few microseconds ago and 1549 * there is no timeout. 1550 */ 1551 spin_lock(drv_lock); 1552 if (iorb_queue_del(&ad_infos[a].ports[p].iorb_queue, vIorb) == 0) 1553 { 1554 iorb_queue_add(&abort_queue, vIorb, pIorb); 1555 pIorb->ErrorCode = IOERR_ADAPTER_TIMEOUT; 1556 } 1557 spin_unlock(drv_lock); 1544 dprintf(0, DBG_PREFIX": timeout for IORB %x port=%x.%x\n", ulArg, a, p); 1558 1545 1559 1546 /* Trigger abort processing function. We don't really care whether this … … 1568 1555 * will process our IORB as well. 1569 1556 */ 1570 KernArmHook(reset_ctxhook_h, 0, 0); 1571 1572 /* Set up a watchdog timer which calls the context hook manually in case 1573 * some kernel thread is looping around the IORB_COMPLETE status bit 1574 * without yielding the CPU (kernel threads don't preempt). This shouldn't 1575 * happen per design because kernel threads are supposed to yield but it 1576 * does in the early boot phase. 1577 */ 1578 Timer_StartTimerMS(&th_reset_watchdog, 5000, reset_watchdog, 0); 1557 SafeArmCtxHook(ResetCtxHook_h, ulArg); 1579 1558 } 1580 1559 … … 1590 1569 * problems during the early boot phase. 1591 1570 */ 1592 void __syscall reset_watchdog(ULONG timer_handle, ULONG p1)1571 void __syscall WatchdogTimer(ULONG timer_handle, ULONG ulArg) 1593 1572 { 1594 1573 /* reset watchdog timer */ 1595 1574 Timer_CancelTimer(timer_handle); 1596 th_ reset_watchdog = 0;1597 dprintf(0, "reset watchdog invoked\n");1598 1599 /* You cannot call the reset_ctxhookdirectly because it does things1575 th_watchdog = 0; 1576 dprintf(0, DBG_PREFIX": BEG %s\n", ulArg==ResetCtxHook_h?"Reset":"Restart"); 1577 1578 /* The ctxhook cannot be called directly because it does things 1600 1579 * that are illegal in an interrupt handler. 1601 1580 */ 1602 1603 KernArmHook(reset_ctxhook_h, 0, 0); 1604 1605 /* call context hook manually */ 1606 //reset_ctxhook(0); 1581 SafeArmCtxHook(ulArg, 0); 1607 1582 } 1608 1583 … … 1634 1609 if ((u32)(pUi + 1) - (u32)pDt > pIorb_conf->DeviceTableLen) 1635 1610 { 1636 dprintf(0, "error: device table provided by DASD too small\n");1611 dprintf(0, DBG_PREFIX": error: device table provided by DASD too small\n"); 1637 1612 iorb_seterr(&pIorb_conf->iorbh, IOERR_CMD_SW_RESOURCE); 1638 1613 return(-1);
Note:
See TracChangeset
for help on using the changeset viewer.