Subversion Repositories Kolibri OS

Rev

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

Rev 2465 Rev 3555
Line 5... Line 5...
5
;;                                                              ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 7... Line 7...
7
 
7
 
8
; Detect all BIOS hard drives.
8
; Detect all BIOS hard drives.
-
 
9
; diamond, 2008
Line 9... Line 10...
9
; diamond, 2008
10
; Do not include USB mass storages. CleverMouse, 2013
10
 
11
 
11
        xor     cx, cx
12
        xor     cx, cx
12
        mov     es, cx
13
        mov     es, cx
Line 22... Line 23...
22
        pop     di dx cx
23
        pop     di dx cx
23
        jc      bddc
24
        jc      bddc
24
        test    ah, ah
25
        test    ah, ah
25
        jz      bddc
26
        jz      bddc
26
        inc     cx
27
        inc     cx
-
 
28
; We are going to call int 13h/func 48h, Extended get drive parameters.
-
 
29
; The latest version of the EDD specification is 3.0.
-
 
30
; There are two slightly incompatible variants for version 3.0;
-
 
31
; original one from Phoenix in 1998, see e.g.
-
 
32
; http://www.t10.org/t13/technical/d98120r0.pdf, and T13 draft,
-
 
33
; http://www.t13.org/documents/UploadedDocuments/docs2004/d1572r3-EDD3.pdf
-
 
34
; T13 draft addresses more possible buses, so it gives additional 8 bytes
-
 
35
; for device path.
-
 
36
; Most BIOSes follow Phoenix, but T13 version is also known to be used
-
 
37
; (e.g. systems based on AMD Geode).
-
 
38
; Fortunately, there is an in/out length field, so
-
 
39
; it is easy to tell what variant was selected by the BIOS:
-
 
40
; Phoenix-3.0 has 42h bytes, T13-3.0 has 4Ah bytes.
-
 
41
; Note that 2.0 has 1Eh bytes, 1.1 has 1Ah bytes; both variants of 3.0 have
-
 
42
; the same structure for first 1Eh bytes, compatible with previous versions.
-
 
43
; Note also that difference between Phoenix-3.0 and T13-3.0 starts near the
-
 
44
; end of the structure, so the current code doesn't even need to distinguish.
-
 
45
; It needs, however, give at least 4Ah bytes as input and expect that BIOS
-
 
46
; could return 42h bytes as output while still giving all the information.
27
        mov     ah, 48h
47
        mov     ah, 48h
28
        push    ds
48
        push    ds
29
        push    es
49
        push    es
30
        pop     ds
50
        pop     ds
31
        mov     si, 0xA000
51
        mov     si, 0xA000
32
        mov     word [si], 1Eh
52
        mov     word [si], 4Ah
33
        mov     ah, 48h
53
        mov     ah, 48h
34
        int     13h
54
        int     13h
35
        pop     ds
55
        pop     ds
36
        jc      bddc2
56
        jc      bddc2
37
        inc     byte [es:0x907F]
-
 
38
        cmp     word [es:si], 1Eh
57
        cmp     word [es:si], 1Eh
39
        jb      bddl
58
        jb      .noide
40
        cmp     word [es:si+1Ah], 0xFFFF
59
        cmp     word [es:si+1Ah], 0xFFFF
41
        jz      bddl
60
        jz      .noide
-
 
61
        inc     byte [es:0x907F]
42
        mov     al, dl
62
        mov     al, dl
43
        stosb
63
        stosb
44
        push    ds
64
        push    ds
45
        lds     si, [es:si+1Ah]
65
        lds     si, [es:si+1Ah]
46
        mov     al, [si+6]
66
        mov     al, [si+6]
Line 59... Line 79...
59
;        mov     ax, -1
79
;        mov     ax, -1
60
@@:
80
@@:
61
        stosw
81
        stosw
62
        pop     ds
82
        pop     ds
63
        jmp     bddc2
83
        jmp     bddc2
64
bddl:
84
.noide:
-
 
85
        cmp     word [es:si], 42h
-
 
86
        jb      .nousb
-
 
87
        cmp     word [es:si+28h], 'US'
-
 
88
        jnz     .nousb
-
 
89
        cmp     byte [es:si+2Ah], 'B'
-
 
90
        jz      bddc2
-
 
91
.nousb:
-
 
92
        inc     byte [es:0x907F]
65
        mov     al, dl
93
        mov     al, dl
66
        stosb
94
        stosb
67
        xor     ax, ax
95
        xor     ax, ax
68
        stosb
96
        stosb
69
        dec     ax
97
        dec     ax