Subversion Repositories Kolibri OS

Rev

Rev 214 | 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
7
 
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
extrn SysMsgBoardStr
31
extrn PciApi
32
extrn PciRead32
33
extrn PciRead8
34
extrn PciWrite8
35
extrn AllocKernelSpace
36
extrn KernelAlloc
37
extrn MapPage
38
extrn GetPgAddr
39
extrn RegService
40
extrn ServiceHandler
41
extrn SetHwCursor
42
extrn LFBAddress
43
extrn LoadFile
44
extrn FpuSave
45
extrn FpuRestore
46
47
 
48
49
 
50
DRV_EXIT   equ -1
51
STRIDE     equ 4      ;size of row in devices table
52
53
 
54
55
 
56
57
 
227 serge 58
           jne .exit
59
.entry:
214 serge 60
227 serge 61
 
214 serge 62
           mov esi, msgInit
63
           call SysMsgBoardStr
64
     end if
65
66
 
67
	   ret
68
.fail:
69
.exit:
70
           xor eax, eax
71
           ret
72
endp
73
74
 
75
io_code    equ  IOCTL.io_code
76
input      equ  IOCTL.input
77
inp_size   equ  IOCTL.inp_size
78
output     equ  IOCTL.output
79
out_size   equ  IOCTL.out_size
80
81
 
82
proc service_proc stdcall, ioctl:dword
83
84
 
85
;           mov eax, [edi+io_code]
86
87
 
88
	   ret
89
endp
90
91
 
92
restore   io_code
93
restore   input
94
restore   inp_size
95
restore   output
96
restore   out_size
97
98
 
99
proc detect
100
	   locals
101
	     last_bus dd ?
102
	   endl
103
104
 
105
	   mov [bus], eax
106
	   inc eax
107
           call PciApi
108
	   cmp eax, -1
109
           je .err
110
111
 
112
113
 
114
	   and [devfn], 0
115
.next_dev:
116
           stdcall PciRead32, [bus], [devfn], dword 0
117
	   test eax, eax
118
	   jz .next
119
	   cmp eax, -1
120
	   je .next
121
122
 
123
@@:
124
	   mov ebx, [edi]
125
	   test ebx, ebx
126
	   jz .next
127
128
 
129
	   je .found
130
           add edi, STRIDE
131
           jmp @B
132
133
 
134
	   cmp [devfn], 256
135
	   jb  .next_dev
136
	   mov eax, [bus]
137
	   inc eax
138
	   mov [bus], eax
139
	   cmp eax, [last_bus]
140
	   jna .next_bus
141
	   xor eax, eax
142
	   ret
143
.found:
144
	   xor eax, eax
145
           inc eax
146
	   ret
147
.err:
148
           xor eax, eax
149
           ret
150
endp
151
152
 
153
 
154
;VENDOR_ID equ  ; device vendor id
155
156
 
157
 
158
159
 
160
devices dd (DEVICE_ID shl 16)+VENDOR_ID
161
        dd 0    ;terminator
162
163
 
227 serge 164
165
 
214 serge 166
167
 
168
msgPCI       db 'PCI accsess not supported',13,10,0
169
msgFail      db 'device not found',13,10,0
170
171
 
172
173
 
174