Changeset 25 for trunk/src/os2ahci
- Timestamp:
- Sep 23, 2010, 4:39:43 PM (15 years ago)
- Location:
- trunk/src/os2ahci
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/os2ahci/ahci.c
r14 r25 103 103 #define call_ahci_intr(i) return(ahci_intr(irq_map[i]) >> 1) 104 104 105 static USHORT _far irq_handler_00(void) { call_ahci_intr(0); }106 static USHORT _far irq_handler_01(void) { call_ahci_intr(1); }107 static USHORT _far irq_handler_02(void) { call_ahci_intr(2); }108 static USHORT _far irq_handler_03(void) { call_ahci_intr(3); }109 static USHORT _far irq_handler_04(void) { call_ahci_intr(4); }110 static USHORT _far irq_handler_05(void) { call_ahci_intr(5); }111 static USHORT _far irq_handler_06(void) { call_ahci_intr(6); }112 static USHORT _far irq_handler_07(void) { call_ahci_intr(7); }105 static USHORT _far APIENTRY irq_handler_00(void) { call_ahci_intr(0); } 106 static USHORT _far APIENTRY irq_handler_01(void) { call_ahci_intr(1); } 107 static USHORT _far APIENTRY irq_handler_02(void) { call_ahci_intr(2); } 108 static USHORT _far APIENTRY irq_handler_03(void) { call_ahci_intr(3); } 109 static USHORT _far APIENTRY irq_handler_04(void) { call_ahci_intr(4); } 110 static USHORT _far APIENTRY irq_handler_05(void) { call_ahci_intr(5); } 111 static USHORT _far APIENTRY irq_handler_06(void) { call_ahci_intr(6); } 112 static USHORT _far APIENTRY irq_handler_07(void) { call_ahci_intr(7); } 113 113 114 114 PFN irq_handlers[] = { … … 185 185 if (val & HOST_CAP2_NVMHCI) printf(" nvmhci"); 186 186 if (val & HOST_CAP2_APST) printf(" apst"); 187 187 188 188 } 189 189 printf("\n"); … … 427 427 goto exit_port_scan; 428 428 } 429 429 430 430 /* perform port scan */ 431 431 dprintf("scanning ports on adapter #%d\n", ad_no(ai)); … … 456 456 /* this port has a device attached and is ready to accept commands */ 457 457 ddprintf("port #%d seems to be attached to a device; probing...\n", p); 458 rc = ahci_exec_polled_cmd(ai, p, 0, 500, ATA_CMD_ID_ATA, 458 rc = ahci_exec_polled_cmd(ai, p, 0, 500, ATA_CMD_ID_ATA, 459 459 AP_VADDR, (void _far *) id_buf, 512, 460 460 AP_END); … … 865 865 if (aws->is_ncq && port->reg_cmds == 0 || !aws->is_ncq && port->ncq_cmds == 0) { 866 866 867 /* Find next available command slot. We use a simple round-robin 867 /* Find next available command slot. We use a simple round-robin 868 868 * algorithm for this to prevent commands with higher slot indexes 869 869 * from stalling when new commands are coming in frequently. … … 954 954 goto restore_bios_config; 955 955 } 956 956 957 957 /* save port configuration */ 958 958 if ((pc = ahci_save_port_config(ai, p)) == NULL) { … … 1132 1132 u32 active_cmds; 1133 1133 u32 done_mask; 1134 1134 1135 1135 ddprintf("port interrupt for adapter #%d, port #%d\n", ad_no(ai), p); 1136 1136 memset(&done_queue, 0x00, sizeof(done_queue)); … … 1140 1140 writel(port_mmio + PORT_IRQ_STAT, irq_stat); 1141 1141 readl(port_mmio + PORT_IRQ_STAT); /* flush */ 1142 1142 1143 1143 if (irq_stat & PORT_IRQ_ERROR) { 1144 1144 /* this is an error interrupt */ … … 1258 1258 /* no point analyzing device errors after a reset... */ 1259 1259 return; 1260 } 1260 } 1261 1261 1262 1262 /* Handle device-specific errors. Those errors typically involve restarting … … 1269 1269 } 1270 1270 } 1271 1271 1272 1272 /****************************************************************************** 1273 1273 * Get device or media geometry. Device and media geometry are expected to be … … 1304 1304 1305 1305 ahci_exec_iorb(iorb, 1, cmd_func(iorb, read)); 1306 } 1306 } 1307 1307 1308 1308 /****************************************************************************** … … 1344 1344 ((IORB_ADAPTER_PASSTHRU _far *) iorb)->ControllerCmdLen, 1345 1345 "ahci_execute_cdb(%d.%d.%d)", a, p, d); 1346 1346 1347 1347 if (ad_infos[a].ports[p].devs[d].atapi) { 1348 1348 ahci_exec_iorb(iorb, 0, atapi_execute_cdb); … … 1361 1361 int p = iorb_unit_port(iorb); 1362 1362 int d = iorb_unit_device(iorb); 1363 1363 1364 1364 dphex(((IORB_ADAPTER_PASSTHRU _far *) iorb)->pControllerCmd, 1365 1365 ((IORB_ADAPTER_PASSTHRU _far *) iorb)->ControllerCmdLen, 1366 1366 "ahci_execute_cdb(%d.%d.%d)", a, p, d); 1367 1367 1368 1368 if (ad_infos[a].ports[p].devs[d].atapi) { 1369 1369 iorb_seterr(iorb, IOERR_CMD_NOT_SUPPORTED); -
trunk/src/os2ahci/libc.c
r14 r25 45 45 /* -------------------------- function prototypes -------------------------- */ 46 46 47 static void long_to_asc (long val, char _far *buf, int base, 48 int zero, int flen); 49 static void _far mdelay_timer_callback (ULONG timer_handle, ULONG parm1, 50 ULONG parm2); 51 static int mdelay_cal_end (void); 47 static void long_to_asc (long val, 48 char _far *buf, 49 int base, 50 int zero, int flen); 51 static void APIENTRY _far mdelay_timer_callback (ULONG timer_handle, 52 ULONG parm1, 53 ULONG parm2); 54 static int mdelay_cal_end (void); 52 55 53 56 /* ------------------------ global/static variables ------------------------ */ … … 140 143 } 141 144 } 142 145 143 146 /* data type modifiers */ 144 147 lmod = (*fmt == 'l') ? 1 : 0; … … 161 164 162 165 case 'c': 163 *(buf++) = (char) va_arg(va, int); 166 *(buf++) = (char) va_arg(va, int); 164 167 break; 165 168 … … 246 249 * definitions, it's safer and easier to put the whole thing 247 250 * into an _asm block. 248 * 251 * 249 252 * The C equivalent would look like this: 250 253 * … … 279 282 { 280 283 va_list va; 281 284 282 285 va_start(va, fmt); 283 286 vprintf(fmt, va); … … 296 299 va_list va; 297 300 size_t len; 298 301 299 302 va_start(va, fmt); 300 303 vsprintf(buf, fmt, va); … … 476 479 return(heap_buf + (n - units) * HEAP_UNIT); 477 480 } 478 481 479 482 /* keep searching... */ 480 483 i = n; … … 536 539 537 540 dprintf("calibrating delay loop... "); 541 542 _asm int 3; 538 543 539 544 mdelay_loops_per_ms = 100000; … … 727 732 * Timer callback handler for 'mdelay_calibrate()' 728 733 */ 729 static void _far mdelay_timer_callback(ULONG timer_handle, ULONG parm1, 730 ULONG parm2) 734 static void APIENTRY _far mdelay_timer_callback(ULONG timer_handle, 735 ULONG parm1, 736 ULONG parm2) 731 737 { 732 738 mdelay_cal_status = MD_CALIBRATION_END; -
trunk/src/os2ahci/os2ahci.c
r24 r25 94 94 */ 95 95 USHORT _cdecl c_strat(RPH _far *req) 96 { 96 { 97 97 u16 rc; 98 98 … … 237 237 goto init_fail; 238 238 } 239 239 240 240 /* allocate context hooks */ 241 241 if (DevHelp_AllocateCtxHook(mk_NPFN(restart_hook), &restart_ctxhook_h) != 0 || … … 285 285 * details. 286 286 */ 287 void _far _loadds add_entry(IORBH _far *first_iorb)287 void _far APIENTRY _loadds add_entry(IORBH _far *first_iorb) 288 288 { 289 289 IORBH _far *iorb; … … 315 315 int p = iorb_unit_port(iorb); 316 316 int d = iorb_unit_device(iorb); 317 317 318 318 if (a >= ad_info_cnt || 319 319 p > ad_infos[a].port_max || … … 559 559 560 560 switch (iorb->CommandModifier) { 561 561 562 562 case IOCM_ABORT: 563 563 /* abort all pending commands on specified port and device */ … … 577 577 DevHelp_ArmCtxHook(0, reset_ctxhook_h); 578 578 break; 579 579 580 580 case IOCM_SUSPEND: 581 581 case IOCM_RESUME: … … 842 842 ahci_write(iorb); 843 843 break; 844 844 845 845 default: 846 846 iorb_seterr(iorb, IOERR_CMD_NOT_SUPPORTED); … … 952 952 return(!found); 953 953 } 954 954 955 955 /****************************************************************************** 956 956 * Set the error code in the specified IORB 957 * 957 * 958 958 * NOTE: This function does *not* call iorb_done(). It merely sets the IORB 959 959 * status to the specified error code. … … 1023 1023 1024 1024 /****************************************************************************** 1025 * small_code_ - this dummy func resolves the undefined reference linker 1025 * small_code_ - this dummy func resolves the undefined reference linker 1026 1026 * error that occurrs when linking WATCOM objects with DDK's link.exe 1027 1027 */ -
trunk/src/os2ahci/os2ahci.h
r24 r25 164 164 * mapping comment 165 165 * ----------------------------------------------------------------------- 166 * 4 bits for the adapter current max is 8 adapters 166 * 4 bits for the adapter current max is 8 adapters 167 167 * 4 bits for the port AHCI spec defines up to 32 ports 168 168 * 4 bits for the device SATA spec defines up to 15 devices behind PMP … … 350 350 /* os2ahci.c */ 351 351 extern USHORT init_drv (RPINITIN _far *req); 352 extern void _far _loadds add_entry (IORBH _far *iorb);352 extern void _far APIENTRY _loadds add_entry (IORBH _far *iorb); 353 353 extern void trigger_engine (void); 354 354 extern int trigger_engine_1 (void);
Note:
See TracChangeset
for help on using the changeset viewer.