Subversion Repositories Kolibri OS

Rev

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

Rev 3908 Rev 5201
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2013. 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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 7... Line 7...
7
 
7
 
Line 8... Line 8...
8
$Revision: 3908 $
8
$Revision: 5201 $
-
 
9
 
9
 
10
search_partitions:
-
 
11
        push    ecx
10
search_partitions:
12
; 1. Fill missing parameters in HD_DATA structures.
-
 
13
        xor     eax, eax
11
; 1. Fill missing parameters in HD_DATA structures.
14
        mov     edx, IDE_controller_1
12
        mov     eax, [hd_address_table]
15
        mov     ax, [edx + IDE_DATA.BAR0_val]
13
        mov     [hd0_data.hdbase], eax   ;0x1f0
16
        mov     [hd0_data.hdbase], eax
14
        mov     [hd1_data.hdbase], eax
17
        mov     [hd1_data.hdbase], eax
15
        mov     eax, [hd_address_table+16]
18
        mov     ax, [edx + IDE_DATA.BAR2_val]
-
 
19
        mov     [hd2_data.hdbase], eax
-
 
20
        mov     [hd3_data.hdbase], eax
-
 
21
 
-
 
22
        mov     edx, IDE_controller_2
-
 
23
        mov     ax, [edx + IDE_DATA.BAR0_val]
-
 
24
        mov     [hd4_data.hdbase], eax
-
 
25
        mov     [hd5_data.hdbase], eax
-
 
26
        mov     ax, [edx + IDE_DATA.BAR2_val]
-
 
27
        mov     [hd6_data.hdbase], eax
-
 
28
        mov     [hd7_data.hdbase], eax
-
 
29
 
-
 
30
        mov     edx, IDE_controller_3
-
 
31
        mov     ax, [edx + IDE_DATA.BAR0_val]
-
 
32
        mov     [hd8_data.hdbase], eax
-
 
33
        mov     [hd9_data.hdbase], eax
-
 
34
        mov     ax, [edx + IDE_DATA.BAR2_val]
16
        mov     [hd2_data.hdbase], eax
35
        mov     [hd10_data.hdbase], eax
17
        mov     [hd3_data.hdbase], eax
36
        mov     [hd11_data.hdbase], eax
18
; 2. Notify the system about /hd* disks.
37
; 2. Notify the system about /hd* disks.
-
 
38
; For every existing disk, call ide_disk_add with correct parameters.
19
; For every existing disk, call ide_disk_add with correct parameters.
39
; Generate name "hdN" on the stack; this is 4 bytes including terminating zero.
20
; Generate name "hdN" on the stack; this is 4 bytes including terminating zero.
40
;-----------------------------------------------------------------------------
21
; 2a. /hd0: exists if mask 0x40 in [DRIVE_DATA+1] is set,
41
; 2a. /hd0: exists if mask 0x40 in [DRIVE_DATA+1] is set,
22
;     data: hd0_data,
42
;     data: hd0_data,
23
;     number of partitions: [DRIVE_DATA+2]
43
;     number of partitions: [DRIVE_DATA+2]
-
 
44
        test    [DRIVE_DATA+1], byte 0x40
24
        test    [DRIVE_DATA+1], byte 0x40
45
        jz      @f
25
        jz      @f
46
 
26
        push    'hd0'
47
        push    'hd0'
27
        mov     eax, esp        ; name
48
        mov     eax, esp        ; name
28
        mov     edx, hd0_data
49
        mov     edx, hd0_data
29
        call    ide_disk_add
50
        call    ide_disk_add
-
 
51
        mov     [DRIVE_DATA+2], al
30
        mov     [DRIVE_DATA+2], al
52
        pop     ecx             ; restore the stack
31
        pop     ecx             ; restore the stack
53
;-----------------------------------------------------------------------------
32
@@:
54
@@:
33
; 2b. /hd1: exists if mask 0x10 in [DRIVE_DATA+1] is set,
55
; 2b. /hd1: exists if mask 0x10 in [DRIVE_DATA+1] is set,
34
;     data: hd1_data,
56
;     data: hd1_data,
35
;     number of partitions: [DRIVE_DATA+3]
57
;     number of partitions: [DRIVE_DATA+3]
-
 
58
        test    [DRIVE_DATA+1], byte 0x10
36
        test    [DRIVE_DATA+1], byte 0x10
59
        jz      @f
37
        jz      @f
60
 
38
        push    'hd1'
61
        push    'hd1'
39
        mov     eax, esp
62
        mov     eax, esp
40
        mov     edx, hd1_data
63
        mov     edx, hd1_data
41
        call    ide_disk_add
64
        call    ide_disk_add
-
 
65
        mov     [DRIVE_DATA+3], al
42
        mov     [DRIVE_DATA+3], al
66
        pop     ecx
43
        pop     ecx
67
;-----------------------------------------------------------------------------
44
@@:
68
@@:
45
; 2c. /hd2: exists if mask 4 in [DRIVE_DATA+1] is set,
69
; 2c. /hd2: exists if mask 4 in [DRIVE_DATA+1] is set,
46
;     data: hd2_data,
70
;     data: hd2_data,
47
;     number of partitions: [DRIVE_DATA+4]
71
;     number of partitions: [DRIVE_DATA+4]
-
 
72
        test    [DRIVE_DATA+1], byte 4
48
        test    [DRIVE_DATA+1], byte 4
73
        jz      @f
49
        jz      @f
74
 
50
        push    'hd2'
75
        push    'hd2'
51
        mov     eax, esp
76
        mov     eax, esp
52
        mov     edx, hd2_data
77
        mov     edx, hd2_data
53
        call    ide_disk_add
78
        call    ide_disk_add
-
 
79
        mov     [DRIVE_DATA+4], al
54
        mov     [DRIVE_DATA+4], al
80
        pop     ecx
55
        pop     ecx
81
;-----------------------------------------------------------------------------
56
@@:
82
@@:
57
; 2d. /hd3: exists if mask 1 in [DRIVE_DATA+1] is set,
83
; 2d. /hd3: exists if mask 1 in [DRIVE_DATA+1] is set,
58
;     data: hd3_data,
84
;     data: hd3_data,
59
;     number of partitions: [DRIVE_DATA+5]
85
;     number of partitions: [DRIVE_DATA+5]
-
 
86
        test    [DRIVE_DATA+1], byte 1
60
        test    [DRIVE_DATA+1], byte 1
87
        jz      @f
61
        jz      @f
88
 
62
        push    'hd3'
89
        push    'hd3'
63
        mov     eax, esp
90
        mov     eax, esp
64
        mov     edx, hd3_data
91
        mov     edx, hd3_data
65
        call    ide_disk_add
92
        call    ide_disk_add
-
 
93
        mov     [DRIVE_DATA+5], al
-
 
94
        pop     ecx
-
 
95
;-----------------------------------------------------------------------------
-
 
96
@@:
-
 
97
; 2e. /hd4: exists if mask 0x40 in [DRIVE_DATA+6] is set,
-
 
98
;     data: hd4_data,
-
 
99
;     number of partitions: [DRIVE_DATA+7]
-
 
100
        test    [DRIVE_DATA+6], byte 0x40
-
 
101
        jz      @f
-
 
102
 
-
 
103
        push    'hd4'
-
 
104
        mov     eax, esp        ; name
-
 
105
        mov     edx, hd4_data
-
 
106
        call    ide_disk_add
-
 
107
        mov     [DRIVE_DATA+7], al
-
 
108
        pop     ecx
-
 
109
;-----------------------------------------------------------------------------
-
 
110
@@:
-
 
111
; 2f. /hd5: exists if mask 0x10 in [DRIVE_DATA+6] is set,
-
 
112
;     data: hd5_data,
-
 
113
;     number of partitions: [DRIVE_DATA+8]
-
 
114
        test    [DRIVE_DATA+6], byte 0x10
-
 
115
        jz      @f
-
 
116
 
-
 
117
        push    'hd5'
-
 
118
        mov     eax, esp
-
 
119
        mov     edx, hd5_data
-
 
120
        call    ide_disk_add
-
 
121
        mov     [DRIVE_DATA+8], al
-
 
122
        pop     ecx
-
 
123
;-----------------------------------------------------------------------------
-
 
124
@@:
-
 
125
; 2g. /hd6: exists if mask 4 in [DRIVE_DATA+6] is set,
-
 
126
;     data: hd6_data,
-
 
127
;     number of partitions: [DRIVE_DATA+9]
-
 
128
        test    [DRIVE_DATA+6], byte 4
-
 
129
        jz      @f
-
 
130
 
-
 
131
        push    'hd6'
-
 
132
        mov     eax, esp
-
 
133
        mov     edx, hd6_data
-
 
134
        call    ide_disk_add
-
 
135
        mov     [DRIVE_DATA+9], al
-
 
136
        pop     ecx
-
 
137
;-----------------------------------------------------------------------------
-
 
138
@@:
-
 
139
; 2h. /hd7: exists if mask 1 in [DRIVE_DATA+6] is set,
-
 
140
;     data: hd7_data,
-
 
141
;     number of partitions: [DRIVE_DATA+10]
-
 
142
        test    [DRIVE_DATA+6], byte 1
-
 
143
        jz      @f
-
 
144
 
-
 
145
        push    'hd7'
-
 
146
        mov     eax, esp
-
 
147
        mov     edx, hd7_data
-
 
148
        call    ide_disk_add
-
 
149
        mov     [DRIVE_DATA+10], al
-
 
150
        pop     ecx
-
 
151
;-----------------------------------------------------------------------------
-
 
152
@@:
-
 
153
; 2i. /hd8: exists if mask 0x40 in [DRIVE_DATA+11] is set,
-
 
154
;     data: hd8_data,
-
 
155
;     number of partitions: [DRIVE_DATA+12]
-
 
156
        test    [DRIVE_DATA+11], byte 0x40
-
 
157
        jz      @f
-
 
158
 
-
 
159
        push    'hd8'
-
 
160
        mov     eax, esp        ; name
-
 
161
        mov     edx, hd8_data
-
 
162
        call    ide_disk_add
-
 
163
        mov     [DRIVE_DATA+12], al
-
 
164
        pop     ecx
-
 
165
;-----------------------------------------------------------------------------
-
 
166
@@:
-
 
167
; 2j. /hd9: exists if mask 0x10 in [DRIVE_DATA+11] is set,
-
 
168
;     data: hd9_data,
-
 
169
;     number of partitions: [DRIVE_DATA+13]
-
 
170
        test    [DRIVE_DATA+11], byte 0x10
-
 
171
        jz      @f
-
 
172
 
-
 
173
        push    'hd9'
-
 
174
        mov     eax, esp
-
 
175
        mov     edx, hd9_data
-
 
176
        call    ide_disk_add
-
 
177
        mov     [DRIVE_DATA+13], al
-
 
178
        pop     ecx
-
 
179
;-----------------------------------------------------------------------------
-
 
180
@@:
-
 
181
; 2k. /hd10: exists if mask 4 in [DRIVE_DATA+11] is set,
-
 
182
;     data: hd10_data,
-
 
183
;     number of partitions: [DRIVE_DATA+14]
-
 
184
        test    [DRIVE_DATA+14], byte 4
-
 
185
        jz      @f
-
 
186
 
-
 
187
        push    'hd10'
-
 
188
        mov     eax, esp
-
 
189
        mov     edx, hd10_data
-
 
190
        call    ide_disk_add
-
 
191
        mov     [DRIVE_DATA+9], al
-
 
192
        pop     ecx
-
 
193
;-----------------------------------------------------------------------------
-
 
194
@@:
-
 
195
; 2l. /hd11: exists if mask 1 in [DRIVE_DATA+11] is set,
-
 
196
;     data: hd11_data,
-
 
197
;     number of partitions: [DRIVE_DATA+15]
-
 
198
        test    [DRIVE_DATA+11], byte 1
-
 
199
        jz      @f
-
 
200
 
-
 
201
        push    'hd11'
-
 
202
        mov     eax, esp
-
 
203
        mov     edx, hd11_data
-
 
204
        call    ide_disk_add
-
 
205
        mov     [DRIVE_DATA+15], al
66
        mov     [DRIVE_DATA+5], al
206
        pop     ecx
67
        pop     ecx
207
;-----------------------------------------------------------------------------
68
@@:
208
@@:
69
; 3. Notify the system about /bd* disks.
209
; 3. Notify the system about /bd* disks.
70
; 3a. Check whether there are BIOS disks. If no, skip step 3.
210
; 3a. Check whether there are BIOS disks. If no, skip step 3.
Line 113... Line 253...
113
        cmp     esi, [NumBiosDisks]
253
        cmp     esi, [NumBiosDisks]
114
        jnz     .bdloop
254
        jnz     .bdloop
115
        pop     ecx ecx ; restore stack after name
255
        pop     ecx ecx ; restore stack after name
116
.nobd:
256
.nobd:
117
        jmp     end_search_partitions
257
        jmp     end_search_partitions
118
 
-
 
-
 
258
;-----------------------------------------------------------------------------
119
; Helper procedure for search_partitions, adds one IDE disk.
259
; Helper procedure for search_partitions, adds one IDE disk.
120
; For compatibility, number of partitions for IDE disks is kept in a separate variable,
260
; For compatibility, number of partitions for IDE disks is kept in a separate
121
; so the procedure returns number of partitions.
261
; variable, so the procedure returns number of partitions.
122
; eax -> name, edx -> disk data
262
; eax -> name, edx -> disk data
123
proc ide_disk_add
263
proc ide_disk_add
124
        stdcall disk_add, ide_callbacks, eax, edx, 0
264
        stdcall disk_add, ide_callbacks, eax, edx, 0
125
        test    eax, eax
265
        test    eax, eax
126
        jz      @f
266
        jz      @f
Line 132... Line 272...
132
        jbe     @f
272
        jbe     @f
133
        mov     eax, 255
273
        mov     eax, 255
134
@@:
274
@@:
135
        ret
275
        ret
136
endp
276
endp
137
 
-
 
-
 
277
;-----------------------------------------------------------------------------
138
 end_search_partitions:
278
end_search_partitions:
139
-
 
-
 
279
        pop     ecx