Subversion Repositories Kolibri OS

Rev

Rev 4850 | Rev 7122 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4850 Rev 5363
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
2
;;                                                              ;;
3
;; Copyright (C) KolibriOS team 2008-2014. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2008-2015. All rights reserved. ;;
4
;; Distributed under terms of the GNU General Public License    ;;
4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7
 
7
 
8
$Revision: 4850 $
8
$Revision: 5363 $
9
 
9
 
10
 
10
 
11
; Detect all BIOS hard drives.
11
; Detect all BIOS hard drives.
12
; diamond, 2008
12
; diamond, 2008
13
; Do not include USB mass storages. CleverMouse, 2013
13
; Do not include USB mass storages. CleverMouse, 2013
14
 
14
 
15
        xor     cx, cx
15
        xor     cx, cx
16
        mov     es, cx
16
        mov     es, cx
17
        mov     di, 0x9080
17
        mov     di, 0x9080
18
        mov     byte [es:di-1], cl
18
        mov     byte [es:di-1], cl
19
        cmp     [preboot_biosdisk], 1
19
        cmp     [preboot_biosdisk], 1
20
        jnz     bdde
20
        jnz     bdde
21
        mov     dl, 80h
21
        mov     dl, 80h
22
bdds:
22
bdds:
23
        mov     ah, 15h
23
        mov     ah, 15h
24
        push    cx dx di
24
        push    cx dx di
25
        int     13h
25
        int     13h
26
        pop     di dx cx
26
        pop     di dx cx
27
        jc      bddc
27
        jc      bddc
28
        test    ah, ah
28
        test    ah, ah
29
        jz      bddc
29
        jz      bddc
30
        inc     cx
30
        inc     cx
31
; We are going to call int 13h/func 48h, Extended get drive parameters.
31
; We are going to call int 13h/func 48h, Extended get drive parameters.
32
; The latest version of the EDD specification is 3.0.
32
; The latest version of the EDD specification is 3.0.
33
; There are two slightly incompatible variants for version 3.0;
33
; There are two slightly incompatible variants for version 3.0;
34
; original one from Phoenix in 1998, see e.g.
34
; original one from Phoenix in 1998, see e.g.
35
; http://www.t10.org/t13/technical/d98120r0.pdf, and T13 draft,
35
; http://www.t10.org/t13/technical/d98120r0.pdf, and T13 draft,
36
; http://www.t13.org/documents/UploadedDocuments/docs2004/d1572r3-EDD3.pdf
36
; http://www.t13.org/documents/UploadedDocuments/docs2004/d1572r3-EDD3.pdf
37
; T13 draft addresses more possible buses, so it gives additional 8 bytes
37
; T13 draft addresses more possible buses, so it gives additional 8 bytes
38
; for device path.
38
; for device path.
39
; Most BIOSes follow Phoenix, but T13 version is also known to be used
39
; Most BIOSes follow Phoenix, but T13 version is also known to be used
40
; (e.g. systems based on AMD Geode).
40
; (e.g. systems based on AMD Geode).
41
; Fortunately, there is an in/out length field, so
41
; Fortunately, there is an in/out length field, so
42
; it is easy to tell what variant was selected by the BIOS:
42
; it is easy to tell what variant was selected by the BIOS:
43
; Phoenix-3.0 has 42h bytes, T13-3.0 has 4Ah bytes.
43
; Phoenix-3.0 has 42h bytes, T13-3.0 has 4Ah bytes.
44
; Note that 2.0 has 1Eh bytes, 1.1 has 1Ah bytes; both variants of 3.0 have
44
; Note that 2.0 has 1Eh bytes, 1.1 has 1Ah bytes; both variants of 3.0 have
45
; the same structure for first 1Eh bytes, compatible with previous versions.
45
; the same structure for first 1Eh bytes, compatible with previous versions.
46
; Note also that difference between Phoenix-3.0 and T13-3.0 starts near the
46
; Note also that difference between Phoenix-3.0 and T13-3.0 starts near the
47
; end of the structure, so the current code doesn't even need to distinguish.
47
; end of the structure, so the current code doesn't even need to distinguish.
48
; It needs, however, give at least 4Ah bytes as input and expect that BIOS
48
; It needs, however, give at least 4Ah bytes as input and expect that BIOS
49
; could return 42h bytes as output while still giving all the information.
49
; could return 42h bytes as output while still giving all the information.
50
        mov     ah, 48h
50
        mov     ah, 48h
51
        push    ds
51
        push    ds
52
        push    es
52
        push    es
53
        pop     ds
53
        pop     ds
54
        mov     si, 0xA000
54
        mov     si, 0xA000
55
        mov     word [si], 4Ah
55
        mov     word [si], 4Ah
56
        mov     ah, 48h
56
        mov     ah, 48h
57
        int     13h
57
        int     13h
58
        pop     ds
58
        pop     ds
59
        jc      bddc2
59
        jc      bddc2
60
        cmp     word [es:si], 1Eh
60
        cmp     word [es:si], 1Eh
61
        jb      .noide
61
        jb      .noide
62
        cmp     word [es:si+1Ah], 0xFFFF
62
        cmp     word [es:si+1Ah], 0xFFFF
63
        jz      .noide
63
        jz      .noide
64
        inc     byte [es:0x907F]
64
        inc     byte [es:0x907F]
65
        mov     al, dl
65
        mov     al, dl
66
        stosb
66
        stosb
67
        push    ds
67
        push    ds
68
        lds     si, [es:si+1Ah]
68
        lds     si, [es:si+1Ah]
69
        mov     al, [si+6]
69
        mov     al, [si+6]
70
        and     al, 0xF
70
        and     al, 0xF
71
        stosb
71
        stosb
72
        mov     al, byte [si+4]
72
        mov     al, byte [si+4]
73
        shr     al, 4
73
        shr     al, 4
74
        and     ax, 1
74
        and     ax, 1
75
        cmp     word [si], 1F0h
75
        cmp     word [si], 1F0h
76
        jz      @f
76
        jz      @f
77
        inc     ax
77
        inc     ax
78
        inc     ax
78
        inc     ax
79
        cmp     word [si], 170h
79
        cmp     word [si], 170h
80
        jz      @f
80
        jz      @f
81
        or      ax, -1
81
        or      ax, -1
82
;        mov     ax, -1
82
;        mov     ax, -1
83
@@:
83
@@:
84
        stosw
84
        stosw
85
        pop     ds
85
        pop     ds
86
        jmp     bddc2
86
        jmp     bddc2
87
.noide:
87
.noide:
88
        cmp     word [es:si], 42h
88
        cmp     word [es:si], 42h
89
        jb      .nousb
89
        jb      .nousb
90
        cmp     word [es:si+28h], 'US'
90
        cmp     word [es:si+28h], 'US'
91
        jnz     .nousb
91
        jnz     .nousb
92
        cmp     byte [es:si+2Ah], 'B'
92
        cmp     byte [es:si+2Ah], 'B'
93
        jz      bddc2
93
        jz      bddc2
94
.nousb:
94
.nousb:
95
        inc     byte [es:0x907F]
95
        inc     byte [es:0x907F]
96
        mov     al, dl
96
        mov     al, dl
97
        stosb
97
        stosb
98
        xor     ax, ax
98
        xor     ax, ax
99
        stosb
99
        stosb
100
        dec     ax
100
        dec     ax
101
        stosw
101
        stosw
102
;        mov     al, 0
102
;        mov     al, 0
103
;        stosb
103
;        stosb
104
;        mov     ax, -1
104
;        mov     ax, -1
105
;        stosw
105
;        stosw
106
bddc2:
106
bddc2:
107
        cmp     cl, [es:0x475]
107
        cmp     cl, [es:0x475]
108
        jae     bdde
108
        jae     bdde
109
bddc:
109
bddc:
110
        inc     dl
110
        inc     dl
111
        jnz     bdds
111
        jnz     bdds
112
bdde:
112
bdde: