Subversion Repositories Kolibri OS

Rev

Rev 4515 | Rev 5166 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4515 Rev 4788
Line 81... Line 81...
81
button:                                 ; button
81
button:                                 ; button
82
        mcall   17                      ; get id
82
        mcall   17                      ; get id
Line 83... Line 83...
83
 
83
 
84
        cmp     ah, 1                   ; button id = 1 ?
84
        cmp     ah, 1                   ; button id = 1 ?
-
 
85
        jne     @f
85
        jne     @f
86
exit:
86
exit:   mcall   -1                      ; close this program
87
        mcall   -1                      ; close this program
87
       @@:
88
       @@:
88
        cmp     eax,0x0000ff00
89
        cmp     eax, 0x0000ff00
Line 89... Line 90...
89
        jg      load_drv
90
        jg      load_drv
Line 100... Line 101...
100
        jmp     still
101
        jmp     still
Line 101... Line 102...
101
 
102
 
102
 
103
 
103
load_drv:
104
load_drv:
Line 104... Line 105...
104
        shr     eax, 16
105
        shr     eax, 16
105
        mov     word [selected], ax
106
        mov     [selected], ax
106
 
107
 
107
        mov     bl , 6                  ; get a dword
108
        mov     bl, 6                   ; get a dword
108
        mov     bh , ah                 ; bus
109
        mov     bh, ah                  ; bus
Line 109... Line 110...
109
        mov     ch , al                 ; dev
110
        mov     ch, al                  ; dev
110
        mov     cl , 0                  ; offset to device/vendor id
111
        mov     cl, 0                   ; offset to device/vendor id
111
        mcall   62                      ; get ID's
112
        mcall   62                      ; get ID's
112
 
113
 
Line 113... Line 114...
113
        mov     word [PCI_Vendor], ax
114
        mov     [PCI_Vendor], ax
114
        shr     eax, 16
115
        shr     eax, 16
Line 143... Line 144...
143
        mov     [IOCTL.input], hardwareinfo
144
        mov     [IOCTL.input], hardwareinfo
144
        mov     [IOCTL.out_size], 0
145
        mov     [IOCTL.out_size], 0
145
        mov     [IOCTL.output], 0
146
        mov     [IOCTL.output], 0
Line 146... Line 147...
146
 
147
 
147
        mcall   68, 17, IOCTL
-
 
148
 
148
        mcall   68, 17, IOCTL
Line 149... Line 149...
149
        mov     byte[drivernumber], al
149
        mov     [drivernumber], al
Line 150... Line 150...
150
 
150
 
151
        jmp     still
151
        jmp     still
152
 
152
 
Line 153... Line 153...
153
reset:
153
reset:
Line 154... Line 154...
154
        movzx   ebx, byte[drivernumber]
154
        movzx   ebx, [drivernumber]
155
        mcall   74,,2
155
        mcall   74,,2
156
 
156
 
Line 157... Line 157...
157
        jmp     still
157
        jmp     still
Line 158... Line 158...
158
 
158
 
Line 200... Line 200...
200
 
200
 
201
;------------------------------------------------------------------
201
;------------------------------------------------------------------
202
;* Gets the PCI Version and Last Bus
202
;* Gets the PCI Version and Last Bus
203
Get_PCI_Info:
203
Get_PCI_Info:
204
        mcall   62, 0
204
        mcall   62, 0
205
        mov     word [PCI_Version], ax
205
        mov     [PCI_Version], ax
206
        mcall   62, 1
206
        mcall   62, 1
207
        mov     byte [PCI_LastBus], al
207
        mov     [PCI_LastBus], al
208
        ;----------------------------------------------------------
208
        ;----------------------------------------------------------
209
        ;* Get all devices on PCI Bus
-
 
210
        mov     edx, 20 shl 16 + 110  ; set start write position
209
        ;* Get all devices on PCI Bus
211
        cmp     al , 0xff                ; 0xFF means no pci bus found
210
        cmp     al, 0xff                ; 0xFF means no pci bus found
212
        jne     Pci_Exists              ;
211
        jne     Pci_Exists              ;
-
 
212
        ret                             ; if no bus then leave
213
        ret                             ; if no bus then leave
213
 
214
Pci_Exists:
214
Pci_Exists:
215
        mov     byte [V_Bus], 0         ; reset varibles
215
        mov     [V_Bus], 0
-
 
216
        mov     [V_Dev], 0
-
 
217
        mov     edx, 20 shl 16 + 110    ; set start write position
216
        mov     byte [V_Dev], 0         ;
218
 
217
Start_Enum:
219
Start_Enum:
218
        mov     bl , 6                   ; get a dword
220
        mov     bl, 6                   ; read dword
219
        mov     bh , byte [V_Bus]        ; bus of pci device
221
        mov     bh, [V_Bus]
220
        mov     ch , byte [V_Dev]        ; device number/function
222
        mov     ch, [V_Dev]
221
        mov     cl , 0                   ; offset to device/vendor id
223
        mov     cl, 0                   ; offset to device/vendor id
Line 222... Line 224...
222
        mcall   62                      ; get ID's
224
        mcall   62                      ; get ID's
223
 
225
 
-
 
226
        cmp     ax, 0                   ; Vendor ID should not be 0 or 0xFFFF
224
        cmp     ax, 0                   ; Vendor ID should not be 0 or 0xFFFF
227
        je      nextDev                 ; check next device if nothing exists here
225
        je      nextDev                 ; check next device if nothing exists here
228
 
Line 226... Line 229...
226
        cmp     ax, 0xffff              ;
229
        cmp     ax, 0xffff              ;
227
        je      nextDev                 ;
230
        je      nextDev                 ;
228
 
231
 
229
        mov     word [PCI_Vendor], ax   ; There is a device here, save the ID's
232
        mov     [PCI_Vendor], ax        ; There is a device here, save the ID's
230
        shr     eax, 16                 ;
233
        shr     eax, 16                 ;
231
        mov     word [PCI_Device], ax   ;
234
        mov     [PCI_Device], ax        ;
232
        mov     bl , 4                   ; Read config byte
235
        mov     bl, 4                   ; Read config byte
233
        mov     bh , byte [V_Bus]        ; Bus #
236
        mov     bh, [V_Bus]             ; Bus #
234
        mov     ch , byte [V_Dev]        ; Device # on bus
237
        mov     ch, [V_Dev]             ; Device # on bus
235
        mov     cl , 0x08                ; Register to read (Get Revision)
238
        mov     cl, 0x08                ; Register to read (Get Revision)
236
        mcall   62                      ; Read it
239
        mcall   62                      ; Read it
Line 237... Line 240...
237
        mov     byte [PCI_Rev], al      ; Save it
240
        mov     [PCI_Rev], al           ; Save it
238
        mov     cl , 0x0b                ; Register to read (Get class)
241
        mov     cl, 0x0b                ; Register to read (Get class)
239
        mcall   62                      ; Read it
242
        mcall   62                      ; Read it
240
        
243
        
241
        mov     byte [PCI_Class], al    ; Save it
244
        mov     [PCI_Class], al         ; Save it
242
        mov     cl , 0x0a                ; Register to read (Get Subclass)
245
        mov     cl, 0x0a                ; Register to read (Get Subclass)
243
        mcall   62                      ; Read it
246
        mcall   62                      ; Read it
244
        mov     byte [PCI_SubClass], al ; Save it
247
        mov     [PCI_SubClass], al      ; Save it
245
        mov     cl , 0x09                ; Register to read (Get Interface)
248
        mov     cl, 0x09                ; Register to read (Get Interface)
Line 271... Line 274...
271
        pop     eax
274
        pop     eax
272
        test    al, al
275
        test    al, al
273
        js      nextDev
276
        js      nextDev
Line 274... Line 277...
274
 
277
 
275
nextdev2:
278
nextdev2:
276
        test    byte [V_Dev], 7
279
        test    [V_Dev], 7
Line 277... Line 280...
277
        jnz     nextDev
280
        jnz     nextDev
Line 278... Line 281...
278
        
281
        
279
        or      byte [V_Dev], 7
282
        or      [V_Dev], 7
280
 
-
 
281
nextDev:
283
 
-
 
284
nextDev:
282
        inc     [V_Dev]                 ; lower 3 bits are the function number
285
        inc     [V_Dev]                 ; lower 3 bits are the function number
283
 
286
        jnz     Start_Enum              ; jump until we reach zero
284
        jnz     Start_Enum              ; jump until we reach zero
287
 
285
        mov     byte [V_Dev], 0         ; reset device number
288
        mov     [V_Dev], 0              ; reset device number
286
        inc     byte [V_Bus]            ; next bus
289
        inc     [V_Bus]                 ; next bus
287
        mov     al , byte [PCI_LastBus]  ; get last bus
290
        mov     al, [PCI_LastBus]       ; get last bus
Line 336... Line 339...
336
        mov     cx , dx
339
        mov     cx, dx
337
        dec     cx
340
        dec     cx
338
        shl     ecx, 16
341
        shl     ecx, 16
339
        add     ecx, 9
342
        add     ecx, 9
Line 340... Line 343...
340
 
343
 
341
        movzx   edx, byte [V_Bus]
344
        xor     edx, edx
342
        shl     dx , 8
345
        mov     dh, [V_Bus]
Line 343... Line 346...
343
        mov     dl , byte [V_Dev]
346
        mov     dl, [V_Dev]
344
 
347
 
345
        mov     esi, 0x0000c0ff        ; color: yellow if selected, blue otherwise
348
        mov     esi, 0x0000c0ff        ; color: yellow if selected, blue otherwise
346
        cmp     word [selected], dx
349
        cmp     [selected], dx
347
        jne     @f
350
        jne     @f
Line 348... Line 351...
348
        mov     esi, 0x00c0c000
351
        mov     esi, 0x00c0c000
Line 353... Line 356...
353
 
356
 
354
        mcall   8
357
        mcall   8
Line 355... Line 358...
355
        pop     edx
358
        pop     edx
356
 
359
 
357
        xor     esi, esi                ; Color of text
360
        xor     esi, esi                ; Color of text
Line 358... Line 361...
358
        movzx   ecx, word [PCI_Vendor]  ; number to be written
361
        movzx   ecx, [PCI_Vendor]       ; number to be written
359
        mcall   47, 0x00040100          ; Write Vendor ID
362
        mcall   47, 0x00040100          ; Write Vendor ID
360
 
363
 
Line 361... Line 364...
361
        add     edx, (4*6+18) shl 16
364
        add     edx, (4*6+18) shl 16
362
        movzx   ecx, word [PCI_Device]  ; get Vendor ID
365
        movzx   ecx, [PCI_Device]       ; get Vendor ID
363
        mcall                           ; Draw Vendor ID to Window
366
        mcall                           ; Draw Vendor ID to Window
Line 364... Line 367...
364
 
367
 
365
        add     edx, (4*6+18) shl 16
368
        add     edx, (4*6+18) shl 16
366
        movzx   ecx, byte [V_Bus]       ; get bus number
369
        movzx   ecx, [V_Bus]
367
        mcall   ,0x00020100             ; draw bus number to screen
370
        mcall   ,0x00020100             ; draw bus number to screen
Line 368... Line 371...
368
 
371
 
369
        add     edx, (2*6+18) shl 16
372
        add     edx, (2*6+18) shl 16
370
        movzx   ecx, byte [V_Dev]       ; get device number
373
        movzx   ecx, [V_Dev]
Line 371... Line 374...
371
        shr     ecx, 3                  ; device number is bits 3-7
374
        shr     ecx, 3                  ; device number is bits 3-7
372
        mcall                           ; Draw device Number To Window
375
        mcall                           ; Draw device Number To Window
373
 
376
 
Line 388... Line 391...
388
 
391
 
389
;------------------------------------------------------------------
392
;------------------------------------------------------------------
390
; Prints the Vendor's Name based on Vendor ID
393
; Prints the Vendor's Name based on Vendor ID
391
;------------------------------------------------------------------
394
;------------------------------------------------------------------
392
        mov     edx, VendorsTab
395
        mov     edx, VendorsTab
Line 393... Line 396...
393
        mov     cx , word[PCI_Vendor]
396
        mov     cx, [PCI_Vendor]
394
        
397
        
395
.fn:    mov     ax , [edx]
398
.fn:    mov     ax, [edx]
396
        add     edx, 6
399
        add     edx, 6
Line 537... Line 540...
537
selected        dw ?
540
selected        dw ?
538
V_Bus           db ?
541
V_Bus           db ?
539
V_Dev           db ?
542
V_Dev           db ?
540
PCI_Version     dw ?
543
PCI_Version     dw ?
541
PCI_LastBus     db ?
544
PCI_LastBus     db ?
-
 
545
; Dont change order
542
PCI_Vendor      dw ?
546
PCI_Vendor      dw ?
543
PCI_Device      dw ?
547
PCI_Device      dw ?
-
 
548
 
544
PCI_Bus         db ?
549
PCI_Bus         db ?
545
PCI_Dev         db ?
550
PCI_Dev         db ?
546
PCI_Rev         db ?
551
PCI_Rev         db ?
547
; don`t change order!!!
552
; Dont change order
548
PCI_Class       db ?
553
PCI_Class       db ?
549
PCI_SubClass    db ?
554
PCI_SubClass    db ?
550
PCI_Interface   db ?
555
PCI_Interface   db ?
551
PCI_IRQ         db ?
556
PCI_IRQ         db ?