Changeset 156
- Timestamp:
- May 6, 2013, 7:57:39 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/os2ahci/Makefile
r155 r156 32 32 BLD_MINOR=27 # must be 2 digits 33 33 BLD_REV=0 # not used at this time 34 FIXPACK=Test Build 34 35 35 36 !ifndef %WATCOM # if not defined in the environment -
trunk/src/os2ahci/README
r154 r156 93 93 ============ 94 94 95 - Copy the driver file, OS2AHCI.ADD, to C:\OS2\BOOT 95 - Run the included update.cmd, 96 or copy the driver file, OS2AHCI.ADD, to \OS2\BOOT on your boot disk. 96 97 97 98 - Add the following line to CONFIG.SYS: … … 106 107 Option Description 107 108 ------------------------------------------------------------------------------ 108 /c:<addr> Set debug COM port base address in hex (default = 0); 109 if used, this option should come before any /d options. 110 If <addr> is set to 0, the COM port is turned off and 111 all output is directed to an internal trace ring buffer 112 that can be dumped on an OS/2 command prompt with the 113 command "type os2ahci$"; see the OS2AHCI project page 114 at http://svn.ecomstation.nl/ahci/wiki/AhciTrace 115 for more info. COM0=3f8, COM1=2f8 116 /d Debug output on COM port/trace buffer; multiple "/d" 117 options will increase verbosity: 109 /b:<baud> Initialize the COM port to the specified baud rate. Allowable 110 baud values are: 300, 600, 1200, 2400, 4800, 9600, 19200, 111 38400, 57600, and 115200. /b has no effect if /c is not also 112 specified. If /b is not specified, the COM port is not 113 initialized. For example, if you are using the kernel debugger, 114 the kernel debugger initializes the COM port so you should not 115 use this switch. 116 117 /c:<n> Set debug COM port base address. Values for n can be: 118 1 = COM1 119 2 = COM2 120 a hex value (COM port base address) COM1=3f8, COM2=2f8 121 The default is 0. If set to 0 then no output goes to the COM port. 122 123 /d[:n] Debug output to COM port/trace buffer. Values for n can be: 118 124 1 = requests 119 125 2 = detailed 120 126 3 = verbose, including MMIO operations 121 /v display adapter info during boot 127 If :n is not specified the debug level is incremented for 128 each /d specified. 129 130 /w Allows the trace buffer to wrap when full. 131 132 /v[:n] Display informational messages during boot. Values for n can be: 133 1 = Display sign on banner 134 2 = Display adapter information 135 If :n is not specified the verbosity level is incremented for 136 each /v specified. 137 122 138 /g:<vendor>:<device> Add generic PCI ID to list of supported AHCI adapters 123 139 (e.g. /g:8086:2829) 140 124 141 /t Perform thorough PCI ID scan; default = on, can be 125 142 turned off with /!t to perform only a PCI class scan 143 126 144 /f Force the use of the HW write cache when using NCQ 127 145 commands; see "Native Command Queuing" below for 128 146 further explanation (default = off) 147 129 148 /r Reset ports during initialization (default = on) 130 149 Can be turned off with /!r, however, when the … … 132 151 initialized by the BIOS in SATA mode, ports will 133 152 always be reset even when /!r was specified 134 /a Set adapter for adapter-specific options 153 154 /a:n Set adapter to n for adapter-specific options 135 155 (default = -1, all adapters) 136 /p Set port for port-specific options 156 157 /p:n Set port to n for port-specific options 137 158 (default = -1, all ports) 138 159 … … 149 170 /s Enable SCSI emulation for ATAPI units (default = off) 150 171 SCSI emulation is required for tools like cdrecord. 172 151 173 /n Enable NCQ (Native Command Queuing) for hard disks 152 174 (default = off) 175 153 176 /ls Set link speed (default = 0): 154 177 0 = maximum, … … 156 179 2 = limit to generation 2 157 180 3 = limit to generation 3 181 158 182 /lp Set link power management (default = 0): 159 183 0 = full power management, 160 184 1 = transitions to "partial slumber state" disabled, 161 185 2 = transitions to "slumber state" disabled, 162 3 = transitions to both partial and slumber states 163 disabled 186 3 = transitions to both partial and slumber states disabled 187 164 188 /4 Force track size to be 56 sectors regardless of the 165 189 reported disk geometry to optimize partition boundaries … … 371 395 DSKSP_GEN_GET_COUNTERS IOCTL request. 372 396 397 398 Change Log 399 ========== 400 401 v.1.27 23-Apr-2013 - David Azarewicz 402 Added LVM aware disk geometry reporting. 403 Begin to add disk information report - not finished yet. 404 Removed undocumented /q switch and made the driver quiet by default. 405 Debug output improvements. 406 Added /b switch for setting debug baud rate. 407 408 v.1.26 26-Mar-2013 - David Azarewicz 409 Fix spin-up / power-up issue on some hardware 410 Reorganized and improved debug output. 411 412 v.1.26 21-Feb-2013 - rousseau 413 Virtual box fix 414 Some SMP fixes 415 Changed default for port reset to always 416 417 v.1.25 02-Oct-2012 - markus.thi 418 Added support for trap dumps 419 420 v.1.24 21-May-2012 - markus.thi 421 Fixed JFS long format hang (ticket 16) 422 423 V.1.23 16-May-2012 - markus.thi 424 added IDC entry point to allow switching back to BIOS mode 425 426 v.1.22 17-Oct-2011 - markus.thi 427 Added "IBMS506" header to accomodate broken SMART tools. -
trunk/src/os2ahci/ahci.c
r155 r156 957 957 writel(port_mmio + PORT_CMD, tmp); 958 958 959 /* wait for completion, spec says 500ms, give it 1000 */959 /* wait for completion, spec says 500ms, give it 1000ms */ 960 960 while (timeout > 0 && (readl(port_mmio + PORT_CMD) & PORT_CMD_FIS_ON)) { 961 961 mdelay(10); -
trunk/src/os2ahci/ata.c
r155 r156 441 441 } 442 442 443 /****************************************************************************** 444 * Try to read LVM information from the disk. If found, use the LVM geometry. 445 * This function will only work at init time. A better strategy would be to 446 * calculate the geometry during ahci_scan_ports and save it away and then just 447 * return the saved values when ata_get_geometry() is called. 448 */ 449 int is_lvm_geometry(IORBH _far *iorb) 443 int check_lvm(IORBH _far *iorb, ULONG sector) 450 444 { 451 445 ADD_WORKSPACE _far *aws = add_workspace(iorb); … … 454 448 PDLA_Table_Sector pDLA; 455 449 int p = iorb_unit_port(iorb); 450 int rc; 451 452 rc = ahci_exec_polled_cmd(ai, p, 0, 500, ATA_CMD_READ, 453 AP_SECTOR_28, (u32) sector-1, 454 AP_COUNT, (u16) 1, 455 AP_VADDR, (void _far *) aws->buf, 512, 456 AP_DEVICE, 0x40, 457 AP_END); 458 if (rc) return 0; 459 460 pDLA = (PDLA_Table_Sector)aws->buf; 461 ddphex(pDLA, sizeof(DLA_Table_Sector), "DLA sector %d:\n", sector-1); 462 463 if ((pDLA->DLA_Signature1 == DLA_TABLE_SIGNATURE1) && (pDLA->DLA_Signature2 == DLA_TABLE_SIGNATURE2)) { 464 ddprintf("is_lvm_geometry found at sector %d\n", sector); 465 geometry->TotalCylinders = pDLA->Cylinders; 466 geometry->NumHeads = pDLA->Heads_Per_Cylinder; 467 geometry->SectorsPerTrack = pDLA->Sectors_Per_Track; 468 return 1; 469 } 470 471 return 0; 472 } 473 474 /****************************************************************************** 475 * Try to read LVM information from the disk. If found, use the LVM geometry. 476 * This function will only work at init time. A better strategy would be to 477 * calculate the geometry during ahci_scan_ports and save it away and then just 478 * return the saved values when ata_get_geometry() is called. 479 */ 480 int is_lvm_geometry(IORBH _far *iorb) 481 { 482 GEOMETRY _far *geometry = ((IORB_GEOMETRY _far *) iorb)->pGeometry; 483 AD_INFO *ai = ad_infos + iorb_unit_adapter(iorb); 484 int p = iorb_unit_port(iorb); 456 485 int d = iorb_unit_device(iorb); 457 int rc;458 486 ULONG sector; 459 487 … … 463 491 ddprintf("is_lvm_geometry (%d.%d.%d)\n", ad_no(ai), p, d); 464 492 493 /* First check the sector reported by the hardware */ 494 if (check_lvm(iorb, geometry->SectorsPerTrack)) return 1; 495 465 496 for (sector = 255; sector >= 63; sector >>= 1) { 466 rc = ahci_exec_polled_cmd(ai, p, 0, 500, ATA_CMD_READ, 467 AP_SECTOR_28, (u32) sector-1, 468 AP_COUNT, (u16) 1, 469 AP_VADDR, (void _far *) aws->buf, 512, 470 AP_DEVICE, 0x40, 471 AP_END); 472 if (rc) continue; 473 474 pDLA = (PDLA_Table_Sector)aws->buf; 475 ddphex(pDLA, sizeof(DLA_Table_Sector), "DLA sector %d:\n", sector-1); 476 477 if ((pDLA->DLA_Signature1 == DLA_TABLE_SIGNATURE1) && (pDLA->DLA_Signature2 == DLA_TABLE_SIGNATURE2)) { 478 ddprintf("is_lvm_geometry found at sector %d\n", sector); 479 geometry->TotalCylinders = pDLA->Cylinders; 480 geometry->NumHeads = pDLA->Heads_Per_Cylinder; 481 geometry->SectorsPerTrack = pDLA->Sectors_Per_Track; 482 return 1; 483 } 497 if (sector == geometry->SectorsPerTrack) continue; 498 if (check_lvm(iorb, sector)) return 1; 484 499 } 485 500 } -
trunk/src/os2ahci/libc.c
r154 r156 75 75 }; 76 76 77 /* COM port initialization sequence */78 77 static struct { 79 int reg; 80 u8 data; 81 } com_init_sequence[] = { 82 3, 0x80, /* overlay divisor latch register at 0x3f8 and 0x3f9 */ 83 0, 0x01, /* set low byte of divisor to 1 (115200 baud) */ 84 1, 0x00, /* set high byte of divisor to 0 */ 85 3, 0x03, /* reset divisor latch register overlay and set 8,n,1 */ 86 1, 0x00, /* disable interrupts */ 87 4, 0x0f, /* modem control register */ 88 -1, 0x00 78 long Baud; 79 u16 Data; 80 } BaudCodes[] = { 81 115200, 0x0001, 82 57600, 0x0002, 83 38400, 0x0003, 84 19200, 0x0006, 85 9600, 0x000C, 86 4800, 24, 87 2400, 48, 88 1200, 96, 89 600, 192, 90 300, 384, 91 0, 0 /* end of list */ 89 92 }; 90 93 … … 132 135 * to be fixed eventually... 133 136 */ 134 void init_com( void)137 void init_com(long BaudRate) 135 138 { 136 139 int i; 137 138 if (com_base == 0) { 139 /* no com port in use */ 140 return; 141 } 140 u16 RegData; 141 142 if (com_base == 0) return; /* no com port in use */ 143 144 /* Find the baud code for the given baud rate */ 145 for (i = 0; BaudCodes[i].Baud; i++) if (BaudCodes[i].Baud == BaudRate) break; 146 if (BaudCodes[i].Baud == 0) i = 0; /* default to 115200 */ 147 RegData = BaudCodes[i].Data; 142 148 143 149 spin_lock(com_lock); 144 150 145 for (i = 0; com_init_sequence[i].reg != -1; i++) { 146 u16 port = com_base + com_init_sequence[i].reg; 147 u8 data = com_init_sequence[i].data; 148 _asm { 149 mov dx, port; 150 mov al, data; 151 out dx, al; 152 } 151 __asm { 152 mov bx,RegData 153 mov dx,com_base ; Base address 154 cli 155 add dx,3 ; Line Control (+3) 156 mov al,10000000b ; Set baud flag 157 out dx,al ; for speed setting 158 159 ; Set Baud 160 dec dx ; High divisor address 161 dec dx ; (+1) 162 mov al,bh ; High divisor value 163 out dx,al ; set it 164 dec dx ; Low divisor address (+0) 165 mov al,bl ; Low divisor value 166 out dx,al ; set baud rate 167 168 ; Set frame 169 mov al,00000011b ; Set 8 bit, none, none 170 add dx,3 ; Line Control (+3) 171 out dx,al 172 173 inc dx 174 mov al,3 175 out dx,al ; DTR & RTS to High 176 sti 153 177 } 154 178 … … 753 777 ULONG start; 754 778 ULONG end; 779 ULONG event_id; 755 780 756 781 if (gis == NULL) { … … 762 787 start = gis->msecs; 763 788 end = start + millies; 789 event_id = (ULONG)&msleep; 764 790 765 791 if (end < start) { 766 792 /* wrap-around; wait until 'msecs' has wrapped, too */ 767 793 while (gis->msecs >= start) { 768 DevHelp_ Yield();794 DevHelp_ProcBlock(event_id, 1, WAIT_IS_INTERRUPTABLE); 769 795 } 770 796 } 771 797 772 798 while (gis->msecs <= end) { 773 DevHelp_ Yield();799 DevHelp_ProcBlock(event_id, 1, WAIT_IS_INTERRUPTABLE); 774 800 } 775 801 } -
trunk/src/os2ahci/os2ahci.c
r155 r156 45 45 } 46 46 47 #define drv_parm_int_optional(s, value, type, radix) \ 48 { \ 49 char _far *_ep; \ 50 if ((s)[1] == ':') { \ 51 value = (type) strtol((s) + 2, (const char _far* _far*) &_ep, radix); \ 52 s = _ep; \ 53 } else { \ 54 value++; \ 55 } \ 56 } 57 47 58 /* set two-dimensional array of port options */ 48 59 #define set_port_option(opt, val) \ … … 88 99 int init_reset = 1; /* if != 0, reset ports during init */ 89 100 int force_write_cache; /* if != 0, force write cache */ 90 int verbosity = 1; /* == 1 -> show sign on banner 91 * > 1 -> show adapter info during boot */ 101 int verbosity = 0; /* default is quiet. 1=show sign on banner, >1=show adapter info during boot */ 92 102 int use_lvm_info = 1; 103 int wrap_trace_buffer = 0; 104 long com_baud = 0; 93 105 94 106 PFN Device_Help = 0; /* pointer to device helper entry point */ … … 243 255 goto init_fail; 244 256 257 case 'b': 258 drv_parm_int(s, com_baud, u32, 10); 259 break; 260 245 261 case 'c': 246 262 /* set COM port base address for debug messages */ … … 252 268 case 'd': 253 269 /* increase debug level */ 254 d ebug++;270 drv_parm_int_optional(s, debug, int, 10); 255 271 break; 256 272 … … 347 363 348 364 case 'z': 365 /* Specify to not use the LVM information. There is no reason why anyone would 366 * want to do this, but previous versions of this driver did not have LVM capability, 367 * so this switch is here temporarily just in case. 368 */ 349 369 use_lvm_info = !invert_option; 350 370 break; … … 352 372 case 'v': 353 373 /* be verbose during boot */ 354 verbosity++; 374 drv_parm_int_optional(s, verbosity, int, 10); 375 break; 376 377 case 'w': 378 /* Specify to allow the trace buffer to wrap when full. */ 379 wrap_trace_buffer = !invert_option; 355 380 break; 356 381 357 382 case 'q': 358 /* be quiet */ 359 verbosity = -1000; 383 /* Temporarily output a non-fatal message to get anyone using this 384 * undocumented switch to stop using it. This will be removed soon 385 * and the error will become fatal. 386 */ 387 cprintf("%s: unknown option: /%c\n", drv_name, *s); 360 388 break; 361 389 … … 370 398 ciprintf(init_msg, drv_name, VERSION / 100, VERSION % 100); 371 399 372 //#ifdef ECS_BUILD 373 // ciprintf("This driver is licensed for use only in conjunction with eComStation.\n"); 374 //#else 375 // ciprintf("This is the Open Watcom build.\n"); 376 //#endif 377 378 if (debug) { 379 /* initialize com port for debug output */ 380 //DAZ init_com(); 381 } 400 if (com_baud) init_com(com_baud); /* initialize com port for debug output */ 382 401 383 402 /* initialize trace buffer if applicable */ -
trunk/src/os2ahci/os2ahci.h
r154 r156 500 500 /* libc.c */ 501 501 extern void init_libc (void); 502 extern void init_com ( void);502 extern void init_com (long BaudRate); 503 503 extern int vsprintf (char _far *buf, const char *fmt, va_list va); 504 504 extern int sprintf (char _far *buf, const char *fmt, ...); … … 574 574 extern int verbosity; /* if != 0, show some info during boot */ 575 575 extern int use_lvm_info; 576 extern int wrap_trace_buffer; 576 577 577 578 extern HDRIVER rm_drvh; /* resource manager driver handle */ -
trunk/src/os2ahci/trace.c
r154 r156 136 136 137 137 while (len) { 138 /* The following line causes filling the trace buffer to stop when full. 139 * Comment the following line to keep filling and see the last buffer of data. 140 * Uncomment the following line to stop filling / see the first buffer of data. 141 */ 142 if ( ((ahci_trace_buf.writep+1) & ahci_trace_buf.mask) == ahci_trace_buf.readp ) break; /* buffer is full */ 138 if ( !wrap_trace_buffer && (((ahci_trace_buf.writep+1) & ahci_trace_buf.mask) == ahci_trace_buf.readp) ) break; /* buffer is full */ 143 139 144 140 ahci_trace_buf.tbuf[ahci_trace_buf.writep] = *s++;
Note:
See TracChangeset
for help on using the changeset viewer.