- Timestamp:
- Jun 27, 2011, 6:40:13 PM (14 years ago)
- Location:
- trunk/src/os2ahci
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/os2ahci/Makefile
r102 r111 117 117 # emacs TAGS file creation 118 118 # NOTE: OS/2 emacs etags.exe expects an empty file named c:\dev\null... 119 tags: $(SRCS) $(INCS) 120 etags.exe $(SRCS) $(INCS) Makefile 119 tags: $(SRCS) $(INCS) Makefile 120 etags.exe $(SRCS) $(INCS) $(DDK)\base\src\dev\dasd\diskh\dhcalls.h \ 121 $(DDK)\base\src\dev\dasd\diskh\iorb.h \ 122 $(DDK)\base\h\bsedos16.h 121 123 122 124 bldday.h: -
trunk/src/os2ahci/ahci.c
r110 r111 542 542 if (rc == 0) { 543 543 /* we have a valid IDENTIFY or IDENTIFY_PACKET response */ 544 ddphex(id_buf, 512, "ATA_IDENTIFY%s results:\n", (is_ata) ? "" : "_PACKET"); 544 ddphex(id_buf, 512, TRACE_MINOR_ATA_IDENTIFY, 545 "ATA_IDENTIFY%s results:\n", (is_ata) ? "" : "_PACKET"); 545 546 ahci_setup_device(ai, p, 0, id_buf); 546 547 } else { … … 1550 1551 dphex(((IORB_ADAPTER_PASSTHRU _far *) iorb)->pControllerCmd, 1551 1552 ((IORB_ADAPTER_PASSTHRU _far *) iorb)->ControllerCmdLen, 1552 "ahci_execute_cdb(%d.%d.%d): ", a, p, d);1553 TRACE_MINOR_EXEC_CDB, "ahci_execute_cdb(%d.%d.%d): ", a, p, d); 1553 1554 1554 1555 if (ad_infos[a].ports[p].devs[d].atapi) { … … 1572 1573 dphex(((IORB_ADAPTER_PASSTHRU _far *) iorb)->pControllerCmd, 1573 1574 ((IORB_ADAPTER_PASSTHRU _far *) iorb)->ControllerCmdLen, 1574 "ahci_execute_ata(%d.%d.%d): ", a, p, d);1575 TRACE_MINOR_EXEC_ATA, "ahci_execute_ata(%d.%d.%d): ", a, p, d); 1575 1576 1576 1577 ahci_exec_iorb(iorb, 0, ata_execute_ata); -
trunk/src/os2ahci/ata.c
r110 r111 279 279 if (debug >= 2) { 280 280 printf("ATA command for %d.%d.%d:\n", ad_no(ai), p, d); 281 phex(cmd_hdr, offsetof(AHCI_CMD_HDR, reserved), "cmd_hdr: "); 282 phex(&ata_cmd, sizeof(ata_cmd), "ata_cmd: "); 281 phex(cmd_hdr, offsetof(AHCI_CMD_HDR, reserved), 282 TRACE_MINOR_CMD_HDR, "cmd_hdr: "); 283 phex(&ata_cmd, sizeof(ata_cmd), TRACE_MINOR_ATA_CMD, "ata_cmd: "); 283 284 if (atapi_cmd != NULL) { 284 phex(atapi_cmd, atapi_cmd_len, "atapi_cmd: ");285 phex(atapi_cmd, atapi_cmd_len, TRACE_MINOR_ATAPI_CMD, "atapi_cmd: "); 285 286 } 286 287 if (n > 0) { 287 phex(cmd_tbl->sg_list, sizeof(*cmd_tbl->sg_list) * n, "sg_list: "); 288 phex(cmd_tbl->sg_list, sizeof(*cmd_tbl->sg_list) * n, 289 TRACE_MINOR_SG_LIST, "sg_list: "); 288 290 } 289 291 } -
trunk/src/os2ahci/atapi.c
r110 r111 340 340 ATAPI_SENSE_DATA *psd = (ATAPI_SENSE_DATA *) aws->buf; 341 341 342 dphex(psd, sizeof(*psd), "sense buffer:\n");342 dphex(psd, sizeof(*psd), TRACE_MINOR_SENSE_BUF, "sense buffer:\n"); 343 343 344 344 if ((iorb->RequestControl & IORB_REQ_STATUSBLOCK) && -
trunk/src/os2ahci/libc.c
r110 r111 58 58 ULONG parm2); 59 59 static int mdelay_cal_end (void); 60 static int trace_enabled (void); 60 61 61 62 /* ------------------------ global/static variables ------------------------ */ … … 98 99 static ULONG heap_phys_addr; 99 100 101 /* global info segment */ 102 volatile PGINFOSEG gis; 103 104 100 105 /* ----------------------------- start of code ----------------------------- */ 101 106 … … 105 110 void init_libc(void) 106 111 { 112 PSEL p; 113 107 114 DevHelp_CreateSpinLock(&mem_lock); 108 115 DevHelp_CreateSpinLock(&com_lock); 109 116 110 117 DevHelp_VirtToPhys(heap_buf, &heap_phys_addr); 118 119 /* get global info segment */ 120 if (DevHelp_GetDOSVar(DHGETDOSV_SYSINFOSEG, 0, (PPVOID) &p) == 0) { 121 gis = (PGINFOSEG) ((u32) *p << 16); 122 } 123 111 124 } 112 125 … … 263 276 static char buf[1024]; 264 277 char *s; 278 int len; 265 279 266 280 spin_lock(com_lock); 267 281 268 vsprintf(buf, fmt, va); 282 len = vsprintf(buf, fmt, va); 283 284 if (com_base == 0) { 285 /* write debug message to trace buffer, not COM port */ 286 trace(debug, len, buf); 287 spin_unlock(com_lock); 288 return; 289 } 269 290 270 291 /* write debug message to serial port */ … … 329 350 vsprintf(buf, fmt, va); 330 351 331 if (debug ) {352 if (debug && com_base != 0) { 332 353 /* print the same message to COM1 as well */ 333 354 printf("%s", buf); … … 346 367 * Print hex buffer to COM port. 347 368 */ 348 void phex(const void _far *p, int len, const char *fmt, ...)369 void phex(const void _far *p, int len, u16 trace_minor_code, const char *fmt, ...) 349 370 { 350 371 va_list va; … … 353 374 354 375 if (!debug) { 376 return; 377 } 378 379 if (!com_base) { 380 /* dump to kernel trace buffer, not serial port; 381 * just dump the buffer, it is formatted by TRACEFMT 382 * 383 * NOTE: writing the header to the trace buffer causes 384 * the trace facility to hick up and swallow the 385 * binary data that follows... 386 */ 387 trace(trace_minor_code, len, buf); 355 388 return; 356 389 } … … 705 738 void msleep(u32 millies) 706 739 { 707 volatile PGINFOSEG gis;708 740 ULONG start; 709 741 ULONG end; 710 PSEL p; 711 712 if (DevHelp_GetDOSVar(DHGETDOSV_SYSINFOSEG, 0, (PPVOID) &p)) { 742 743 if (gis == NULL) { 713 744 /* no global info segment; use mdelay() */ 714 745 mdelay(millies); 715 746 return; 716 747 } 717 gis = (PGINFOSEG) ((u32) *p << 16); 748 718 749 start = gis->msecs; 719 750 end = start + millies; … … 834 865 return(mdelay_cal_status == MD_CALIBRATION_END); 835 866 } 867 868 /****************************************************************************** 869 * is_trace_enabled - checks if kernel tracing is enabled 870 */ 871 int is_trace_enabled(void) 872 { 873 int ret = 1; /* if global info seg is not present/known, 874 * we enable tracing for now */ 875 876 /* check global info segment's trace enabled bitmap if our 877 * major trace code is enabled 878 */ 879 if (gis) { 880 u8 trace_bitmap = gis->amecRAS[AHCI_TRACE_MAJOR / 8]; 881 if (trace_bitmap & (0x80 >> (AHCI_TRACE_MAJOR % 8))) { 882 ret = 1; 883 } else { 884 ret = 0; 885 } 886 } 887 888 return ret; 889 } 890 891 /****************************************************************************** 892 * trace - write a buffer to the kernel trace buffer 893 */ 894 void trace(u16 minor_code, u16 cb_buf, const char _far *buf) 895 { 896 if (!is_trace_enabled()) { 897 return; 898 } 899 900 DevHelp_RAS(AHCI_TRACE_MAJOR, minor_code, cb_buf, (PBYTE) buf); 901 } 902 -
trunk/src/os2ahci/os2ahci.c
r110 r111 307 307 308 308 default: 309 cprintf("unknown option: /%c - ignored\n", *s);310 break;309 cprintf("unknown option: /%c\n", *s); 310 goto init_fail; 311 311 } 312 312 } -
trunk/src/os2ahci/os2ahci.h
r110 r111 250 250 #define ANSI_CLR_WHITE "\x1b[37m" 251 251 #define ANSI_RESET "\x1b[0m" 252 253 /****************************************************************************** 254 * trace constants 255 */ 256 #define AHCI_TRACE_MAJOR 0x00faU 257 #define TRACE_MINOR_ATA_IDENTIFY 0x0020 258 #define TRACE_MINOR_EXEC_CDB 0x0021 259 #define TRACE_MINOR_EXEC_ATA 0x0022 260 #define TRACE_MINOR_ATA_CMD 0x0023 261 #define TRACE_MINOR_ATAPI_CMD 0x0024 262 #define TRACE_MINOR_SG_LIST 0x0025 263 #define TRACE_MINOR_SENSE_BUF 0x0026 264 #define TRACE_MINOR_OEMHLP_PARM 0x0027 265 #define TRACE_MINOR_OEMHLP_DATA 0x0028 266 #define TRACE_MINOR_CMD_HDR 0x0029 267 268 252 269 253 270 /* ------------------------ typedefs and structures ------------------------ */ … … 447 464 extern void cprintf (const char *fmt, ...); 448 465 extern void phex (const void _far *p, int len, 449 const char *fmt, ...);466 u16 trace_minor_code, const char *fmt, ...); 450 467 extern size_t strlen (const char _far *s); 451 468 extern char _far *strcpy (char _far *dst, const char _far *src); … … 465 482 extern int disable (void); 466 483 extern void enable (void); 484 extern void trace (u16 minor_code, u16 cb_buf, 485 const char _far *buf); 467 486 468 487 /* pci.c */ … … 488 507 extern USHORT ioctl_passthrough (RP_GENIOCTL _far *ioctl); 489 508 509 490 510 /* ---------------------------- global variables --------------------------- */ 491 511 -
trunk/src/os2ahci/pci.c
r108 r111 937 937 } 938 938 939 dddphex(parm, sizeof(*parm), "oemhlp_parm: ");940 dddphex(data, sizeof(*data), "oemhlp_data: ");939 dddphex(parm, sizeof(*parm), TRACE_MINOR_OEMHLP_PARM, "oemhlp_parm: "); 940 dddphex(data, sizeof(*data), TRACE_MINOR_OEMHLP_DATA, "oemhlp_data: "); 941 941 942 942 if (ioctl.rph.Status & STERR) { -
trunk/src/os2ahci/version.h
r110 r111 14 14 15 15 16 #define VERSION 11 5/* driver version (2 implied decimals) */16 #define VERSION 116 /* driver version (2 implied decimals) */ 17 17
Note:
See TracChangeset
for help on using the changeset viewer.