Subversion Repositories Kolibri OS

Rev

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

Rev 4700 Rev 4772
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2011. 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: 4700 $
8
$Revision: 4772 $
9
 
9
 
10
 
10
 
Line 63... Line 63...
63
        ret
63
        ret
64
;-----------------------------------------------------------------------------
64
;-----------------------------------------------------------------------------
65
FindHDD_1:
65
FindHDD_1:
66
        DEBUGF  1, "K : Channel %d ",[ChannelNumber]:2
66
        DEBUGF  1, "K : Channel %d ",[ChannelNumber]:2
67
        DEBUGF  1, "Disk %d\n",[DiskNumber]:1
67
        DEBUGF  1, "Disk %d\n",[DiskNumber]:1
68
        push    ebx
68
        push    ebx ecx
69
        call    ReadHDD_ID
69
        call    ReadHDD_ID
70
        pop     ebx
70
        pop     ecx ebx
71
        cmp     [DevErrorCode], 0
71
        cmp     [DevErrorCode], 0
72
        jne     .FindCD
72
        jne     .FindCD
Line 73... Line 73...
73
 
73
 
74
        cmp     [Sector512+6], word 16
74
        cmp     [Sector512+6], word 16
Line 79... Line 79...
79
 
79
 
80
        inc     byte [ebx+DRIVE_DATA]
80
        inc     byte [ebx+DRIVE_DATA]
81
        jmp     .Print_Device_Name
81
        jmp     .Print_Device_Name
82
;--------------------------------------
82
;--------------------------------------
83
.FindCD:
83
.FindCD:
84
        push    ebx
84
        push    ebx ecx
85
        call    DeviceReset
85
        call    DeviceReset
86
        pop     ebx
86
        pop     ecx ebx
87
        cmp     [DevErrorCode], 0
87
        cmp     [DevErrorCode], 0
Line 88... Line 88...
88
        jne     .end
88
        jne     .end
89
 
89
 
90
        push    ebx
90
        push    ebx ecx
91
        call    ReadCD_ID
91
        call    ReadCD_ID
92
        pop     ebx
92
        pop     ecx ebx
Line 93... Line 93...
93
        cmp     [DevErrorCode], 0
93
        cmp     [DevErrorCode], 0
94
        jne     .end
94
        jne     .end
95
 
95
 
96
        add     [ebx+DRIVE_DATA], byte 2
96
        add     [ebx+DRIVE_DATA], byte 2
97
;--------------------------------------
97
;--------------------------------------
-
 
98
.Print_Device_Name: 
-
 
99
        pushad
-
 
100
        pushfd
-
 
101
 
-
 
102
        xor     ebx, ebx
-
 
103
        mov     bx, [ChannelNumber]
-
 
104
        dec     ebx
-
 
105
        shl     ebx, 1
-
 
106
        add     bl, [DiskNumber]
-
 
107
        shl     ebx, 1
-
 
108
 
98
.Print_Device_Name: 
109
        call    calculate_IDE_device_values_storage
99
        pushad
110
;--------------------------------------
100
        pushfd
111
.copy_dev_name:
101
        mov     esi, Sector512+27*2
112
        mov     esi, Sector512+27*2
-
 
113
        mov     edi, dev_name
102
        mov     edi, dev_name
114
        mov     ecx, 20
103
        mov     ecx, 20
115
        cld
104
        cld
116
;--------------------------------------
105
@@:
117
@@:
106
        lodsw
118
        lodsw
Line 107... Line 119...
107
        xchg    ah, al
119
        xchg    ah, al
Line 108... Line 120...
108
        stosw
120
        stosw
109
        loop    @b
121
        loop    @b
110
 
122
 
Line 111... Line 123...
111
        DEBUGF 1, "K : Dev: %s \n", dev_name
123
        DEBUGF 1, "K : Dev: %s \n", dev_name
112
 
124
 
113
        xor     eax, eax
125
        xor     eax, eax
114
        mov     ax, [Sector512+64*2]
126
        mov     ax, [Sector512+64*2]
Line 115... Line 127...
115
        DEBUGF  1, "K : PIO mode possible modes %x\n", al
127
        DEBUGF  1, "K : PIO possible modes %x\n", al
116
 
128
 
Line 117... Line 129...
117
        mov     ax, [Sector512+51*2]
129
        mov     ax, [Sector512+51*2]
Line 127... Line 139...
127
        DEBUGF  1, "K : Multiword DMA set mode %x\n", ah
139
        DEBUGF  1, "K : Multiword DMA set mode %x\n", ah
Line 128... Line 140...
128
 
140
 
129
        mov     ax, [Sector512+88*2]
141
        mov     ax, [Sector512+88*2]
Line -... Line 142...
-
 
142
        DEBUGF  1, "K : Ultra DMA possible modes %x\n", al
-
 
143
 
130
        DEBUGF  1, "K : Ultra DMA possible modes %x\n", al
144
        mov     [ebx+IDE_DEVICE.UDMA_possible_modes], al
131
 
145
 
132
        mov     al, ah
146
        mov     al, ah
Line -... Line 147...
-
 
147
        call    convert_Sector512_value
-
 
148
        DEBUGF  1, "K : Ultra DMA set mode %x\n", ah
133
        call    convert_Sector512_value
149
 
134
        DEBUGF  1, "K : Ultra DMA set mode %x\n", ah
150
        mov     [ebx+IDE_DEVICE.UDMA_set_mode], ah
135
 
151
 
136
        popfd
152
        popfd
137
        popad
153
        popad
138
        ret
154
        ret
139
;--------------------------------------
155
;--------------------------------------
140
.end:
156
.end:
-
 
157
        DEBUGF  1, "K : Device not found\n"
-
 
158
        ret
-
 
159
;-----------------------------------------------------------------------------
-
 
160
calculate_IDE_device_values_storage:
-
 
161
        cmp     ecx, IDE_controller_1
-
 
162
        jne     @f
-
 
163
 
-
 
164
        add     ebx, IDE_device_1
-
 
165
        jmp     .exit
-
 
166
;--------------------------------------
-
 
167
@@:
-
 
168
        cmp     ecx, IDE_controller_2
-
 
169
        jne     @f
-
 
170
 
-
 
171
        add     ebx, IDE_device_2
-
 
172
        jmp     .exit
-
 
173
;--------------------------------------
-
 
174
@@:
-
 
175
        add     ebx, IDE_device_3
-
 
176
;--------------------------------------
141
        DEBUGF  1, "K : Device not found\n"
177
.exit:
142
        ret
178
        ret
143
;-----------------------------------------------------------------------------
179
;-----------------------------------------------------------------------------
-
 
180
convert_Sector512_value:
144
convert_Sector512_value:
181
        mov     ecx, 8
145
        mov     ecx, 8
182
        xor     ah, ah
146
        xor     ah, ah
183
;--------------------------------------
Line 147... Line 184...
147
@@:
184
@@:
148
        test    al, 1b
185
        test    al, 1b
149
        jnz     .end
186
        jnz     .end
Line 150... Line 187...
150
 
187
 
-
 
188
        shr     al, 1
151
        shr     al, 1
189
        inc     ah
152
        inc     ah
190
        loop    @b
153
        loop    @b
191
 
154
 
192
        xor     ah, ah
155
        xor     ah, ah
193
;--------------------------------------