- Timestamp:
- Jan 3, 2013, 1:22:56 PM (13 years ago)
- Location:
- trunk/src/os2ahci
- Files:
-
- 2 added
- 7 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/os2ahci/Makefile
r143 r144 55 55 -I$(DDK)\base\src\dev\dasd\diskh \ 56 56 -I$(DDK)\base\src\dev\thinkpad\dockii\apmcalls \ 57 -I$(CC16)\include57 # -I$(CC16)\include 58 58 59 59 AS_INCLUDE = -I:$(DDK)\base\inc \ … … 63 63 $(DDK)\base\src\dev\dasd\devhlp\ \ 64 64 $(DDK)\base\src\dev\thinkpad\dockii\apmcalls\ \ 65 $(CC16)\lib\ \65 # $(CC16)\lib\ \ 66 66 67 67 … … 85 85 86 86 clean: 87 rm -f $(OBJS) $(TARGET) *.cod *.lst *.def *.map *.sym bldday.h 87 rm -f $(OBJS) $(TARGET) *.cod *.lst *.def *.map *.sym *.err *.lnk \ 88 bldday.h 88 89 89 90 … … 132 133 .asm.obj: 133 134 $(AS) $(AFLAGS) $(AS_INCLUDE) $*.asm 135 wdis -l $*.obj 134 136 135 137 .c.obj: 136 138 $(CC) $(CFLAGS) $(CC_INCLUDE) $*.c 139 wdis -l $*.obj 137 140 138 141 os2ahci.def: … … 143 146 $(LD) $(LFLAGS) $(OBJS),$(TARGET),$*.map,$(LIB_DIRS) $(LIBS),$*.def 144 147 $(MAPSYM) os2ahci 145 146 -
trunk/src/os2ahci/_ibuild.cmd
r143 r144 1 1 @echo off 2 2 nmake 3 -
trunk/src/os2ahci/ahci.c
r121 r144 1467 1467 } 1468 1468 1469 dprintf("port #%d interrupt error status: 0x%08lx; restarting port\n", 1469 dprintf("port #%d interrupt error status: 0x%08lx; restarting port\n", 1470 1470 p, irq_stat); 1471 1471 -
trunk/src/os2ahci/init.asm
r141 r144 8 8 ; Constants 9 9 DEV_IDC EQU 0400h ; IDC bit for ADD flags 10 10 11 11 ; ----------------------------------------------------------------------------- 12 12 ; Public symbols 13 13 14 14 PUBLIC _asm_strat ; low-level strategy routine 15 PUBLIC _asm_idc_entry ; low-level IDC entry point 15 PUBLIC _asm_idc_entry ; low-level IDC entry point 16 16 PUBLIC _asm_krnl_exit ; low-level kernel exit routine 17 17 PUBLIC _readl ; MMIO read (32 bits) … … 29 29 PUBLIC _end_of_data ; end of all data (label) 30 30 PUBLIC _end_of_code ; end of all code (label) 31 31 32 32 ; ---------------------------------------------------------------------------- 33 33 ; Device Driver Header … … 65 65 ; such as C. 66 66 67 ; When using the Watcom Linker, the segment ordering can be overridden in 68 ; the Watcom Makefile (wmakefile) where the Linker response-file is generated 69 ; containing statements for segment ordering. First you can order by class and 70 ; for each class you can specify the order of the segments within that class. 71 ; See the ORDER directive in the wlink documentation. 67 72 _DATA SEGMENT WORD PUBLIC 'DATA' 68 73 readl_dbg_fmt db "readl(%04x:%04x) = 0x%08lx" … … 72 77 _DATA ENDS 73 78 79 LIBDATA SEGMENT WORD PUBLIC 'DATA' 80 LIBDATA ENDS 81 74 82 CONST SEGMENT WORD PUBLIC 'CONST' 75 83 CONST ENDS … … 83 91 84 92 _z_data SEGMENT WORD PUBLIC 'BSS' 85 _end_of_data db 093 _end_of_data db ? 86 94 _z_data ENDS 87 95 … … 98 106 CODE ENDS 99 107 108 LIBCODE SEGMENT WORD PUBLIC 'CODE' 109 LIBCODE ENDS 110 100 111 RMCode SEGMENT WORD PUBLIC 'CODE' 101 112 RMCode ENDS 102 103 LIBCODE SEGMENT WORD PUBLIC 'CODE'104 LIBCODE ENDS105 113 106 114 _z_text SEGMENT WORD PUBLIC 'CODE' … … 108 116 _z_text ENDS 109 117 110 DGROUP GROUP DEVHDR, _DATA, CONST, _BSS, c_common, _z_data 111 TGROUP GROUP _TEXT, CODE, _z_text 118 119 ; The Watcom Linker behaves differently than the IBM/MS Linkers when segments 120 ; are defined but not added to the corresponding group. So when you define a 121 ; a new (logical) segment and want it to be part of a physical segment (group) 122 ; then don't forget to add it below or unresolvable or miscalculated 123 ; relocations can be the result. 124 DGROUP GROUP DEVHDR, _DATA, LIBDATA, _BSS, c_common, _z_data 125 TGROUP GROUP _TEXT, CODE, LIBCODE, RMCode, _z_text 126 112 127 113 128 ; ---------------------------------------------------------------------------- … … 140 155 ; IDC entry point (Assembler stub) 141 156 _asm_idc_entry PROC FAR 142 157 143 158 ; push request packet address 144 159 PUSH ES … … 171 186 172 187 RET 173 _asm_krnl_exit ENDP 174 188 _asm_krnl_exit ENDP 189 175 190 176 191 .386 … … 293 308 294 309 295 ; Halfway-decent 32-bit implementation of memcpy(). 310 ; Halfway-decent 32-bit implementation of memcpy(). 296 311 ; 297 312 ; C prototype: void *memcpy(void _far *d, void _far *s, size_t n); … … 377 392 378 393 379 ; Unsigned long divide routine; 394 ; Unsigned long divide routine; 380 395 ; taken from OS/2 Uniaud project, original author: Timur Tabi 381 396 __U4D proc near … … 394 409 ret 395 410 __U4D endp 396 397 ; Long multiply routine; 411 412 ; Long multiply routine; 398 413 ; taken from OS/2 Uniaud project, original author: Timur Tabi 399 414 __U4M proc near … … 412 427 413 428 414 ; Signed long divide routine; 429 ; Signed long divide routine; 415 430 ; taken from OS/2 Uniaud project, original author: Timur Tabi 416 431 __I4D proc near … … 429 444 ret 430 445 __I4D endp 431 446 432 447 .286 433 448 -
trunk/src/os2ahci/os2ahci.c
r141 r144 164 164 rc = char_dev_input((RP_RWV _far *) req); 165 165 break; 166 166 167 167 default: 168 168 rc = STDON | STATUS_ERR_UNKCMD; … … 358 358 359 359 #ifdef ECS_BUILD 360 ciprintf("This driver is licensed for use only in conjunction with eComStation."); 360 ciprintf("This driver is licensed for use only in conjunction with eComStation.\n"); 361 #else 362 ciprintf("This is the Open Watcom build.\n"); 361 363 #endif 362 364 … … 455 457 456 458 case OS2AHCI_IDC_BIOSMODE: 457 /* reconfigure adapters in BIOS/int13 mode; needed for generating 459 /* reconfigure adapters in BIOS/int13 mode; needed for generating 458 460 * trap dumps on some machines. This is called by ACPI.PSD. 459 461 * 460 462 * To enter BIOS mode, we flush all write caches, turn off interrupts 461 * and restore the BIOS configuration. This is exactly what 463 * and restore the BIOS configuration. This is exactly what 462 464 * apm_suspend() does. 463 465 */ … … 474 476 case DSKSP_CAT_GENERIC: 475 477 return(ioctl_gen_dsk(ioctl)); 476 478 477 479 case DSKSP_CAT_SMART: 478 480 return(ioctl_smart(ioctl)); … … 1521 1523 { 1522 1524 _asm { 1523 1524 1525 push ds 1525 1526 push es … … 1533 1534 mov si, OFFSET asm_krnl_exit 1534 1535 mov dl, DevHlp_RegisterKrnlExit 1535 call Device_Help 1536 1537 call dword ptr [Device_Help] 1536 1538 1537 1539 pop di -
trunk/src/os2ahci/os2ahci.def.template
r95 r144 4 4 5 5 segments 6 DEVHDR CLASS 'DATA' 7 _DATA CLASS 'DATA' 8 CONST CLASS 'CONST' 9 _BSS CLASS 'BSS' 10 c_common CLASS 'BSS' 11 _z_data CLASS 'BSS' 12 _TEXT CLASS 'CODE' IOPL 6 'DEVHDR' CLASS 'DATA' 7 '_DATA' CLASS 'DATA' 8 'LIBDATA' CLASS 'DATA' 9 'CONST' CLASS 'CONST' 10 '_BSS' CLASS 'BSS' 11 'c_common' CLASS 'BSS' 12 '_z_data' CLASS 'BSS' 13 '_TEXT' CLASS 'CODE' IOPL 13 14 'CODE' CLASS 'CODE' IOPL 14 RMCode CLASS 'CODE' IOPL 15 LIBCODE CLASS 'CODE' IOPL 16 _z_text CLASS 'CODE' IOPL 17 15 'LIBCODE' CLASS 'CODE' IOPL 16 'RMCode' CLASS 'CODE' IOPL 17 '_z_text' CLASS 'CODE' IOPL -
trunk/src/os2ahci/os2ahci.h
r141 r144 28 28 29 29 /* IMPORTANT NOTE: The DDK headers require tight structure packing and this 30 * is controlled via compiler parameters. Thus, all stuctures in os2ahci. sys30 * is controlled via compiler parameters. Thus, all stuctures in os2ahci.add 31 31 * are expected to be byte-aligned without the need of explicit pragma pack() 32 32 * directives. Where possible, the structures are layed out such that words … … 49 49 #include <reqpkt.h> 50 50 51 /* NOTE: (Rousseau) 52 * The regular dhcalls.h from $(DDK)\base\h also works. 53 * The devhelp.h from $(DDK)\base\h produces inline assembler errors. 54 * The modified devhelp.h from ..\include works OK and is used because it 55 * generates a slightly smaller driver image. 56 */ 51 57 #ifdef __WATCOMC__ 52 58 /* include WATCOM specific DEVHELP stubs */ … … 106 112 #define dddphex if (debug > 2) phex 107 113 108 /* verbosity console print macros 114 /* verbosity console print macros 109 115 * (we use 'i' in ciprintf here to avoid name clash 110 116 * with vprintf-like funcs) … … 380 386 SG_TO_BUF, /* copy from S/G list to buffer */ 381 387 BUF_TO_SG /* copy from buffer to S/G list */ 382 } SG_MEMCPY_DIRECTION; 388 } SG_MEMCPY_DIRECTION; 383 389 384 390 /* -------------------------- function prototypes -------------------------- */ -
trunk/src/os2ahci/wmakefile
r112 r144 29 29 # 30 30 31 #32 # THE WATCOM BUILD IS BROKEN!33 #34 # It might run through but produces a non-working driver35 #36 37 31 ############################################################################### 38 32 # wmake directives … … 43 37 ############################################################################### 44 38 # Environment 39 45 40 46 41 # main path to OS/2 DDK; this needs to be set before this makefile will work … … 57 52 -I$(DDK)\base\h \ 58 53 -I$(DDK)\base\ibmh \ 59 54 -I$(DDK)\base\src\dev\dasd\diskh \ 60 55 -I$(DDK)\base\src\dev\thinkpad\dockii\apmcalls \ 61 -I$(CC16)\include62 63 AS_INCLUDE = -I :$(DDK)\base\inc \64 -I :$(DDK)\base\src\dev\dasd\diskinc56 # -I$(CC16)\include 57 58 AS_INCLUDE = -I=$(DDK)\base\inc \ 59 -I=$(DDK)\base\src\dev\dasd\diskinc 65 60 66 61 LIB_DIRS = $(DDK)\base\lib\ \ 67 62 $(DDK)\base\src\dev\dasd\devhlp\ \ 68 63 $(DDK)\base\src\dev\thinkpad\dockii\apmcalls\ \ 69 64 65 66 67 70 68 ############################################################################### 71 69 # Tool Chain 72 70 # 73 # This makefile uses the Watcom 16bit compiler. 74 # Linker and assembler are link.exe and alp.exe that ship with the OS/2 DDK 75 # 76 77 AS = $(DDK)\tools\alp.exe 71 # This makefile uses the Watcom 16-bit compiler, Watcom Assembler and Linker. 72 # You can change to the DDK Linker and Assembler by modifying the macros below. 73 # 74 75 76 #LINKER=ibm 77 LINKER=watcom 78 79 80 #AS = $(DDK)\tools\alp.exe 81 #AS = jwasm -Cp 82 AS = wasm 78 83 CC = wcc 79 84 LD = $(DDK)\base\tools\link.exe … … 82 87 MAPSYM = $(DDK)\base\tools\mapsym.exe 83 88 84 AFLAGS = -Mb 85 CFLAGS = -d3 -hc -bt=os2 -ms -zu -5 -w3 -wcd=138 -wcd=300 -ecc -zp1 -q -s -zgp -zfp -oi 86 CFLAGS_DEBUG = -d3 -hc 89 #AFLAGS = -Mb 90 #CFLAGS = -ei -5 -d3 -hc -bt=os2 -ms -zu -w3 -wcd=138 -wcd=300 -ecc -zp1 -q -s -zgp -zfp -oi 91 CFLAGS = -ei -5 -d0 -bt=os2 -ms -zu -w=0 -ecc -zp=1 -q -s -zgp -zfp -oi 92 CFLAGS_DEBUG = -ei -5 -d3 -hc -bt=os2 -ms -zu -ecc -zp=1 -q -s -zgp -zfp -od 93 87 94 LFLAGS = /noe /nod /packd /a:16 /batch /map /line 88 95 … … 92 99 TARGET = os2ahci.add 93 100 94 LIBS = addcalls doscalls rmcalls apmcalls # dhcalls not needed, see local devhelp.h 101 #LIBS = addcalls doscalls rmcalls apmcalls # dhcalls not needed, see local devhelp.h 102 LIBS = addcalls doscalls rmcalls apmcalls dhcalls 95 103 96 104 SRCS = init.asm math.asm libc.c os2ahci.c pci.c ahci.c ata.c atapi.c \ 97 105 ctxhook.c trace.c ioctl.c apm.c 98 106 99 107 OBJS = init.obj libc.obj os2ahci.obj pci.obj ahci.obj ata.obj atapi.obj \ … … 106 114 107 115 clean: 108 rm -f $(OBJS) $(TARGET) *.lst *.cod 116 rm -f $(OBJS) $(TARGET) *.cod *.lst *.def *.map *.sym *.err *.lnk \ 117 bldday.h 109 118 110 119 ############################################################################### 111 120 # Object/source dependencies 112 121 113 init.obj: init.asm Makefile114 115 libc.obj: libc.c Makefile $(INCS)116 117 os2ahci.obj: os2ahci.c Makefile $(INCS) bldday.h ioctl.h118 119 pci.obj: pci.c Makefile $(INCS)120 121 ahci.obj: ahci.c Makefile $(INCS) ata.h atapi.h122 123 ata.obj: ata.c Makefile $(INCS) ata.h124 125 atapi.obj: atapi.c Makefile $(INCS) ata.h atapi.h126 127 ctxhook.obj: ctxhook.c Makefile $(INCS) ata.h atapi.h128 129 apm.obj: apm.c Makefile $(INCS)130 131 ioctl.obj: ioctl.c Makefile $(INCS) atapi.h ioctl.h132 133 trace.obj: trace.c Makefile $(INCS)134 135 os2ahci.def: version.h os2ahci.def.template122 init.obj: $*.asm wmakefile 123 124 libc.obj: $*.c wmakefile $(INCS) 125 126 os2ahci.obj: $*.c wmakefile $(INCS) bldday.h ioctl.h 127 128 pci.obj: $*.c wmakefile $(INCS) 129 130 ahci.obj: $*.c wmakefile $(INCS) ata.h atapi.h 131 132 ata.obj: $*.c wmakefile $(INCS) $*.h 133 134 atapi.obj: $*.c wmakefile $(INCS) $*.h ata.h 135 136 ctxhook.obj: $*.c wmakefile $(INCS) ata.h atapi.h 137 138 apm.obj: $*.c wmakefile $(INCS) 139 140 ioctl.obj: $*.c wmakefile $(INCS) $*.h atapi.h 141 142 trace.obj: $*.c wmakefile $(INCS) 143 144 os2ahci.def: version.h $*.def.template 136 145 137 146 ############################################################################### … … 140 149 # emacs TAGS file creation 141 150 # NOTE: OS/2 emacs etags.exe expects an empty file named c:\dev\null... 142 tags: 143 151 tags: $(SRCS) $(INCS) 152 etags.exe $(SRCS) $(INCS) 144 153 145 154 bldday.h: 146 155 $(BLDDATE) > bldday.h 147 156 148 157 .asm.obj: 149 $(AS) $(AFLAGS) $(AS_INCLUDE) $*.asm 158 $(AS) $(AFLAGS) $(AS_INCLUDE) $*.asm 159 wdis -l $*.obj 150 160 151 161 .c.obj: 152 153 162 $(CC) $(CFLAGS) $(CC_INCLUDE) $*.c 163 wdis -l $*.obj 154 164 155 165 os2ahci.def: 156 $(BLDLEVEL) os2ahci.def.template os2ahci.def version.h 157 158 $(TARGET): $(OBJS) os2ahci.def wmakefile 159 $(LD) $(LFLAGS) $(OBJS),$(TARGET),$*.map,$(LIB_DIRS) $(LIBS),$*.def 160 mapsym os2ahci 161 162 166 $(BLDLEVEL) $*.def.template $*.def version.h 167 168 $(TARGET): $(OBJS) $*.def wmakefile 169 170 !if "$(LINKER)"=="watcom" 171 # Target name, system and type 172 @%create $*.lnk 173 @%append $*.lnk name $*.add 174 @%append $*.lnk sys os2 dll 175 # Merge BLDLEVEL information 176 @%append $*.lnk option 177 @qgrep -y -e "description" $*.def >> $*.lnk 178 # Set various options 179 @%append $*.lnk option protmode 180 @%append $*.lnk option map 181 @%append $*.lnk option quiet 182 @%append $*.lnk option nocase 183 @%append $*.lnk option stack=0 184 # Generate directives for objects, libraries and library search-paths 185 @for %f in ($(OBJS)) do @%append $*.lnk file %f 186 @for %f in ($(LIBS)) do @%append $*.lnk lib %f 187 @for %f in ($(LIB_DIRS)) do @%append $*.lnk libpath %f 188 # Attributes for the DATA and CODE segments 189 @%append $*.lnk segment type DATA SHARED 190 @%append $*.lnk segment type CODE IOPL 191 # Order segments by class 192 @%append $*.lnk order 193 @%append $*.lnk clname 'DATA' 194 @%append $*.lnk clname 'CONST' 195 @%append $*.lnk clname 'BSS' 196 @%append $*.lnk clname 'CODE' 197 # Link the stuff together and build the target 198 wlink @$*.lnk 199 200 !elseif "$(LINKER)"=="ibm" 201 $(LD) $(LFLAGS) $(OBJS),$(TARGET),$*.map,$(LIB_DIRS) $(LIBS),$*.def 202 mapsym $* 203 !else 204 @echo "Error: No valid linker specified" 205 !endif 206
Note:
See TracChangeset
for help on using the changeset viewer.