Rev 3708 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3708 | Rev 5039 | ||
---|---|---|---|
Line 11... | Line 11... | ||
11 | ; set predefined resolution here |
11 | ; set predefined resolution here |
12 | use_predefined_mode = 0;1 |
12 | use_predefined_mode = 0;1 |
13 | predefined_width = 0;1366 |
13 | predefined_width = 0;1366 |
14 | predefined_height = 0;768 |
14 | predefined_height = 0;768 |
Line 15... | Line 15... | ||
15 | 15 | ||
16 | ; standard driver stuff |
16 | ; standard driver stuff; target OS version = 0.80 |
- | 17 | format PE DLL native 0.80 |
|
- | 18 | entry START |
|
- | 19 | __DEBUG__ equ 1 |
|
- | 20 | __DEBUG_LEVEL__ equ 1 |
|
- | 21 | section '.flat' readable writable executable |
|
- | 22 | include '../proc32.inc' |
|
- | 23 | include '../struct.inc' |
|
- | 24 | include '../macros.inc' |
|
Line 17... | Line 25... | ||
17 | format MS COFF |
25 | ;include 'fdo.inc' |
Line 18... | Line -... | ||
18 | - | ||
19 | DEBUG = 1 |
- | |
20 | - | ||
21 | include 'proc32.inc' |
- | |
22 | include 'imports.inc' |
- | |
23 | - | ||
24 | public START |
- | |
25 | public version |
26 | |
26 | 27 | DEBUG = 1 |
|
27 | section '.flat' code readable align 16 |
28 | |
28 | ; the start procedure (see the description above) |
29 | ; the start procedure (see the description above) |
29 | START: |
30 | START: |
Line 40... | Line 41... | ||
40 | jz .return0_cleanup |
41 | jz .return0_cleanup |
41 | ; 3. Set the detected mode. |
42 | ; 3. Set the detected mode. |
42 | call SetMode |
43 | call SetMode |
43 | ; 4. Cleanup and return. |
44 | ; 4. Cleanup and return. |
44 | .return0_cleanup: |
45 | .return0_cleanup: |
45 | stdcall FreeKernelSpace, esi |
46 | invoke FreeKernelSpace, esi |
46 | .return0: |
47 | .return0: |
47 | pop esi |
48 | pop esi |
48 | xor eax, eax |
49 | xor eax, eax |
49 | ret 4 |
50 | ret |
Line 50... | Line 51... | ||
50 | 51 | ||
51 | ; check that there is Intel videocard |
52 | ; check that there is Intel videocard |
52 | ; if so, map MMIO registers and set internal variables |
53 | ; if so, map MMIO registers and set internal variables |
53 | ; esi points to MMIO block; NULL means no device |
54 | ; esi points to MMIO block; NULL means no device |
Line 57... | Line 58... | ||
57 | xor esi, esi ; initialize return value to NULL |
58 | xor esi, esi ; initialize return value to NULL |
58 | ; 1a. Get PCI VendorID and DeviceID. |
59 | ; 1a. Get PCI VendorID and DeviceID. |
59 | push esi |
60 | push esi |
60 | push 10h |
61 | push 10h |
61 | push esi |
62 | push esi |
62 | call PciRead32 |
63 | invoke PciRead32 |
63 | ; 1b. loword(eax) = ax = VendorID, hiword(eax) = DeviceID. |
64 | ; 1b. loword(eax) = ax = VendorID, hiword(eax) = DeviceID. |
64 | ; Test whether we have Intel chipset. |
65 | ; Test whether we have Intel chipset. |
65 | cmp ax, 8086h |
66 | cmp ax, 8086h |
66 | jnz .return |
67 | jnz .return |
67 | ; 1c. Say hi including DeviceID. |
68 | ; 1c. Say hi including DeviceID. |
Line 69... | Line 70... | ||
69 | push edi |
70 | push edi |
70 | pusha |
71 | pusha |
71 | mov edi, pciid_text |
72 | mov edi, pciid_text |
72 | call WriteWord |
73 | call WriteWord |
73 | mov esi, hellomsg |
74 | mov esi, hellomsg |
74 | call SysMsgBoardStr |
75 | invoke SysMsgBoardStr |
75 | popa |
76 | popa |
76 | ; 1d. Test whether we know this DeviceID. |
77 | ; 1d. Test whether we know this DeviceID. |
77 | ; If this is the case, remember the position of the device in line of Intel cards; |
78 | ; If this is the case, remember the position of the device in line of Intel cards; |
78 | ; this knowledge will be useful later. |
79 | ; this knowledge will be useful later. |
79 | ; Tested on devices with id: 8086:0046, partially 8086:2A02. |
80 | ; Tested on devices with id: 8086:0046, partially 8086:2A02. |
Line 86... | Line 87... | ||
86 | neg ecx |
87 | neg ecx |
87 | mov [deviceType], ecx |
88 | mov [deviceType], ecx |
88 | ; 1e. Continue saying hi with positive intonation. |
89 | ; 1e. Continue saying hi with positive intonation. |
89 | pusha |
90 | pusha |
90 | mov esi, knownmsg |
91 | mov esi, knownmsg |
91 | call SysMsgBoardStr |
92 | invoke SysMsgBoardStr |
92 | popa |
93 | popa |
93 | ; 2. Prepare MMIO region to control the card. |
94 | ; 2. Prepare MMIO region to control the card. |
94 | ; 2a. Read MMIO physical address from PCI config space. |
95 | ; 2a. Read MMIO physical address from PCI config space. |
95 | push 10h |
96 | push 10h |
96 | cmp ecx, i9xx_start |
97 | cmp ecx, i9xx_start |
97 | jae @f |
98 | jae @f |
98 | mov byte [esp], 14h |
99 | mov byte [esp], 14h |
99 | @@: |
100 | @@: |
100 | push 10h |
101 | push 10h |
101 | push esi |
102 | push esi |
102 | call PciRead32 |
103 | invoke PciRead32 |
103 | ; 2b. Mask out PCI region type, lower 4 bits. |
104 | ; 2b. Mask out PCI region type, lower 4 bits. |
104 | and al, not 0xF |
105 | and al, not 0xF |
105 | ; 2c. Create virtual mapping of the physical memory. |
106 | ; 2c. Create virtual mapping of the physical memory. |
106 | push 1Bh |
107 | push 1Bh |
107 | push 100000h |
108 | push 100000h |
108 | push eax |
109 | push eax |
109 | call MapIoMem |
110 | invoke MapIoMem |
110 | ; 3. Return. |
111 | ; 3. Return. |
111 | xchg esi, eax |
112 | xchg esi, eax |
112 | .return: |
113 | .return: |
113 | ret |
114 | ret |
114 | ; 1f. If we do not know DeviceID, continue saying hi with negative intonation. |
115 | ; 1f. If we do not know DeviceID, continue saying hi with negative intonation. |
115 | .return_unknown_pciid: |
116 | .return_unknown_pciid: |
116 | pusha |
117 | pusha |
117 | mov esi, unknownmsg |
118 | mov esi, unknownmsg |
118 | call SysMsgBoardStr |
119 | invoke SysMsgBoardStr |
119 | popa |
120 | popa |
120 | ret |
121 | ret |
Line 121... | Line 122... | ||
121 | 122 | ||
122 | ; Convert word in ax to hexadecimal text in edi, advance edi. |
123 | ; Convert word in ax to hexadecimal text in edi, advance edi. |
Line 215... | Line 216... | ||
215 | stosb |
216 | stosb |
216 | @@: |
217 | @@: |
217 | test cl, cl |
218 | test cl, cl |
218 | jns .dumploop |
219 | jns .dumploop |
219 | mov esi, edidmsg |
220 | mov esi, edidmsg |
220 | call SysMsgBoardStr |
221 | invoke SysMsgBoardStr |
221 | popa |
222 | popa |
222 | end if |
223 | end if |
223 | ; 7. Test whether EDID is good. |
224 | ; 7. Test whether EDID is good. |
224 | ; 7a. Signature: 00 FF FF FF FF FF FF 00. |
225 | ; 7a. Signature: 00 FF FF FF FF FF FF 00. |
225 | mov esi, edid |
226 | mov esi, edid |
Line 381... | Line 382... | ||
381 | or byte [edx+1000Bh], 80h ; PIPEACONF: enable pipe |
382 | or byte [edx+1000Bh], 80h ; PIPEACONF: enable pipe |
382 | ; and byte [edx+1000Ah], not 0Ch ; PIPEACONF: enable Display+Cursor Planes |
383 | ; and byte [edx+1000Ah], not 0Ch ; PIPEACONF: enable Display+Cursor Planes |
383 | or byte [edx+10183h], 80h ; DSPACNTR: enable Display Plane A |
384 | or byte [edx+10183h], 80h ; DSPACNTR: enable Display Plane A |
384 | sti |
385 | sti |
385 | ; 2. Notify the kernel that resolution has changed. |
386 | ; 2. Notify the kernel that resolution has changed. |
386 | call GetDisplay |
387 | invoke GetDisplay |
387 | mov edx, [width] |
388 | mov edx, [width] |
388 | mov dword [eax+8], edx |
389 | mov dword [eax+8], edx |
389 | mov edx, [height] |
390 | mov edx, [height] |
390 | mov dword [eax+0Ch], edx |
391 | mov dword [eax+0Ch], edx |
391 | mov [eax+18h], ecx |
392 | mov [eax+18h], ecx |
392 | mov eax, [width] |
393 | mov eax, [width] |
393 | dec eax |
394 | dec eax |
394 | dec edx |
395 | dec edx |
395 | call SetScreen |
396 | invoke SetScreen |
396 | .return: |
397 | .return: |
397 | ret |
398 | ret |
Line -... | Line 399... | ||
- | 399 | ||
- | 400 | include '../peimport.inc' |
|
- | 401 | data fixups |
|
- | 402 | end data |
|
398 | 403 | ||
399 | align 4 |
404 | align 4 |
400 | hellomsg db 'Intel videocard detected, PciId=8086:' |
405 | hellomsg db 'Intel videocard detected, PciId=8086:' |
401 | pciid_text db '0000' |
406 | pciid_text db '0000' |
402 | db ', which is ', 0 |
407 | db ', which is ', 0 |
Line 407... | Line 412... | ||
407 | edidmsg db 'EDID successfully read:',13,10 |
412 | edidmsg db 'EDID successfully read:',13,10 |
408 | edid_text rb 8*(16*3+1) |
413 | edid_text rb 8*(16*3+1) |
409 | db 0 |
414 | db 0 |
410 | end if |
415 | end if |
Line 411... | Line -... | ||
411 | - | ||
412 | version: |
- | |
413 | dd 0x50005 |
- | |
414 | 416 | ||
415 | width dd predefined_width |
417 | width dd predefined_width |
Line 416... | Line 418... | ||
416 | height dd predefined_height |
418 | height dd predefined_height |
417 | 419 |