Rev 227 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
214 | serge | 1 | |
2 | |||
3 | |||
4 | |||
5 | |||
6 | include 'imports.inc' |
||
281 | serge | 7 | |
214 | serge | 8 | |
9 | new_app_base equ 0x60400000 |
||
10 | PROC_BASE equ OS_BASE+0x0080000 |
||
11 | |||
12 | |||
13 | { .handle dd ? |
||
14 | .io_code dd ? |
||
15 | .input dd ? |
||
16 | .inp_size dd ? |
||
17 | .output dd ? |
||
18 | .out_size dd ? |
||
19 | } |
||
20 | |||
21 | |||
22 | IOCTL IOCTL |
||
23 | end virtual |
||
24 | |||
25 | |||
26 | public service_proc |
||
27 | public version |
||
227 | serge | 28 | |
214 | serge | 29 | |
30 | |||
31 | |||
32 | DRV_EXIT equ -1 |
||
33 | STRIDE equ 4 ;size of row in devices table |
||
34 | |||
35 | |||
36 | |||
37 | |||
38 | |||
39 | |||
227 | serge | 40 | jne .exit |
41 | .entry: |
||
214 | serge | 42 | |
227 | serge | 43 | |
214 | serge | 44 | mov esi, msgInit |
45 | call SysMsgBoardStr |
||
46 | end if |
||
47 | |||
48 | |||
49 | ret |
||
50 | .fail: |
||
51 | .exit: |
||
52 | xor eax, eax |
||
53 | ret |
||
54 | endp |
||
55 | |||
56 | |||
57 | io_code equ IOCTL.io_code |
||
58 | input equ IOCTL.input |
||
59 | inp_size equ IOCTL.inp_size |
||
60 | output equ IOCTL.output |
||
61 | out_size equ IOCTL.out_size |
||
62 | |||
63 | |||
64 | proc service_proc stdcall, ioctl:dword |
||
65 | |||
66 | |||
67 | ; mov eax, [edi+io_code] |
||
68 | |||
69 | |||
70 | ret |
||
71 | endp |
||
72 | |||
73 | |||
74 | restore io_code |
||
75 | restore input |
||
76 | restore inp_size |
||
77 | restore output |
||
78 | restore out_size |
||
79 | |||
80 | |||
81 | proc detect |
||
82 | locals |
||
83 | last_bus dd ? |
||
84 | endl |
||
85 | |||
86 | |||
87 | mov [bus], eax |
||
88 | inc eax |
||
89 | call PciApi |
||
90 | cmp eax, -1 |
||
91 | je .err |
||
92 | |||
93 | |||
94 | |||
95 | |||
96 | and [devfn], 0 |
||
97 | .next_dev: |
||
98 | stdcall PciRead32, [bus], [devfn], dword 0 |
||
99 | test eax, eax |
||
100 | jz .next |
||
101 | cmp eax, -1 |
||
102 | je .next |
||
103 | |||
104 | |||
105 | @@: |
||
106 | mov ebx, [edi] |
||
107 | test ebx, ebx |
||
108 | jz .next |
||
109 | |||
110 | |||
111 | je .found |
||
112 | add edi, STRIDE |
||
113 | jmp @B |
||
114 | |||
115 | |||
116 | cmp [devfn], 256 |
||
117 | jb .next_dev |
||
118 | mov eax, [bus] |
||
119 | inc eax |
||
120 | mov [bus], eax |
||
121 | cmp eax, [last_bus] |
||
122 | jna .next_bus |
||
123 | xor eax, eax |
||
124 | ret |
||
125 | .found: |
||
126 | xor eax, eax |
||
127 | inc eax |
||
128 | ret |
||
129 | .err: |
||
130 | xor eax, eax |
||
131 | ret |
||
132 | endp |
||
133 | |||
134 | |||
135 | |||
136 | ;VENDOR_ID equ ; device vendor id |
||
137 | |||
138 | |||
139 | |||
140 | |||
141 | |||
142 | devices dd (DEVICE_ID shl 16)+VENDOR_ID |
||
143 | dd 0 ;terminator |
||
144 | |||
145 | |||
281 | serge | 146 | |
227 | serge | 147 | |
214 | serge | 148 | |
149 | |||
150 | msgPCI db 'PCI accsess not supported',13,10,0 |
||
151 | msgFail db 'device not found',13,10,0 |
||
152 | |||
153 | |||
154 | |||
155 | |||
156 |