Subversion Repositories Kolibri OS

Rev

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

Rev 6464 Rev 6842
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 7... Line 7...
7
 
7
 
Line 8... Line 8...
8
$Revision: 6464 $
8
$Revision: 6842 $
Line 9... Line 9...
9
 
9
 
10
; HDD and CD search
10
; HDD and CD search
11
 
11
 
12
        cmp     [ecx+IDE_DATA.ProgrammingInterface], 0
-
 
13
        je      EndFindHDD
12
        cmp     [ecx+IDE_DATA.ProgrammingInterface], 0
14
FindHDD:
13
        je      EndFindHDD
15
        push    ecx
14
FindHDD:
16
        xor     ebx, ebx
15
        xor     ebx, ebx
17
        inc     ebx
16
        inc     ebx
Line 26... Line 25...
26
        add     [DeviceNumber], sizeof.HD_DATA*4
25
        add     [DeviceNumber], sizeof.HD_DATA*4
27
.find:
26
.find:
28
        mov     [ChannelNumber], 1
27
        mov     [ChannelNumber], 1
29
        mov     [DiskNumber], 0
28
        mov     [DiskNumber], 0
30
        call    FindHDD_1
29
        call    FindHDD_1
31
 
-
 
32
        inc     [DiskNumber]
30
        inc     [DiskNumber]
33
        call    FindHDD_2
31
        call    FindHDD_2
34
 
-
 
35
        inc     [ChannelNumber]
32
        inc     [ChannelNumber]
36
        dec     [DiskNumber]
33
        dec     [DiskNumber]
37
        call    FindHDD_2
34
        call    FindHDD_2
38
 
-
 
39
        inc     [DiskNumber]
35
        inc     [DiskNumber]
40
        call    FindHDD_2
36
        call    FindHDD_2
41
 
-
 
42
        pop     ecx
-
 
43
        jmp     EndFindHDD
37
        jmp     EndFindHDD
44
;-----------------------------------------------------------------------------
38
;-----------------------------------------------------------------------------
45
FindHDD_2:
39
FindHDD_2:
46
        add     [DeviceNumber], sizeof.HD_DATA
40
        add     [DeviceNumber], sizeof.HD_DATA
47
        shl     byte [ebx+DRIVE_DATA], 2
41
        shl     byte [ebx+DRIVE_DATA], 2
48
FindHDD_1:
42
FindHDD_1:
49
        DEBUGF  1, "K : Channel %d ",[ChannelNumber]:1
43
        DEBUGF  1, "K : Channel %d ",[ChannelNumber]:1
50
        DEBUGF  1, "Disk %d\n",[DiskNumber]:1
44
        DEBUGF  1, "Disk %d\n",[DiskNumber]:1
51
        push    ebx ecx
45
        push    ecx ebx
52
        call    ReadHDD_ID
46
        call    ReadHDD_ID
53
        pop     ecx ebx
-
 
54
        cmp     [DevErrorCode], 7
47
        cmp     [DevErrorCode], 7
55
        je      .end
48
        je      .end
56
        cmp     [DevErrorCode], 0
49
        cmp     [DevErrorCode], 0
57
        jne     .FindCD
50
        jne     .FindCD
58
 
-
 
59
        cmp     [Sector512+6], word 16
51
        cmp     [Sector512+6], word 16
60
        ja      .FindCD
52
        ja      .FindCD
61
 
-
 
62
        cmp     [Sector512+12], word 255
53
        cmp     [Sector512+12], word 255
63
        ja      .FindCD
54
        ja      .FindCD
64
 
-
 
65
        inc     byte [ebx+DRIVE_DATA]
55
        pop     ebx
66
        movzx   eax, [DeviceNumber]
56
        movzx   eax, [DeviceNumber]
-
 
57
        mov     ecx, [Sector512+120]
-
 
58
        mov     dword[eax+hd0_data.sectors], ecx
-
 
59
        and     dword[eax+hd0_data.sectors+4], 0
67
        bt      word [Sector512+166], 10
60
        bt      word [Sector512+166], 10
-
 
61
        jnc     .Print_Device_Name
68
        adc     [eax+hd0_data.hd48], 0
62
        mov     [eax+hd0_data.hd48], 1
-
 
63
        mov     ecx, [Sector512+200]
-
 
64
        mov     dword[eax+hd0_data.sectors], ecx
-
 
65
        mov     ecx, [Sector512+204]
-
 
66
        mov     dword[eax+hd0_data.sectors+4], ecx
69
        jmp     .Print_Device_Name
67
        jmp     .Print_Device_Name
70
;--------------------------------------
68
;--------------------------------------
71
.FindCD:
69
.FindCD:
72
        push    ebx ecx
-
 
73
        call    DeviceReset
70
        call    DeviceReset
74
        pop     ecx ebx
-
 
75
        cmp     [DevErrorCode], 0
71
        cmp     [DevErrorCode], 0
76
        jne     .end
72
        jne     .end
77
 
-
 
78
        push    ebx ecx
-
 
79
        call    ReadCD_ID
73
        call    ReadCD_ID
80
        pop     ecx ebx
-
 
81
        cmp     [DevErrorCode], 0
74
        cmp     [DevErrorCode], 0
82
        jne     .end
75
        jne     .end
83
 
-
 
-
 
76
        pop     ebx
84
        add     [ebx+DRIVE_DATA], byte 2
77
        inc     byte [ebx+DRIVE_DATA]
85
;--------------------------------------
78
;--------------------------------------
86
.Print_Device_Name:
79
.Print_Device_Name:
-
 
80
        inc     byte [ebx+DRIVE_DATA]
-
 
81
        pop     ecx
87
        pushad
82
        pushad
88
        pushfd
-
 
89
        movzx   ebx, [ChannelNumber]
83
        movzx   ebx, [ChannelNumber]
90
        dec     ebx
84
        dec     ebx
91
        shl     ebx, 1
85
        shl     ebx, 1
92
        add     bl, [DiskNumber]
86
        add     bl, [DiskNumber]
93
        shl     ebx, 1
87
        shl     ebx, 1
Line 102... Line 96...
102
@@:
96
@@:
103
        lodsw
97
        lodsw
104
        xchg    ah, al
98
        xchg    ah, al
105
        stosw
99
        stosw
106
        loop    @b
100
        loop    @b
107
 
-
 
108
        DEBUGF 1, "K : Dev: %s \n", dev_name
101
        DEBUGF 1, "K : Dev: %s \n", dev_name
109
 
-
 
110
        xor     eax, eax
102
        xor     eax, eax
111
        mov     ax, [Sector512+64*2]
103
        mov     ax, [Sector512+64*2]
112
        DEBUGF  1, "K : PIO possible modes %x\n", al
104
        DEBUGF  1, "K : PIO possible modes %x\n", al
113
 
-
 
114
        mov     ax, [Sector512+51*2]
105
        mov     ax, [Sector512+51*2]
115
        mov     al, ah
106
        mov     al, ah
116
        call    convert_Sector512_value
107
        call    convert_Sector512_value
117
        DEBUGF  1, "K : PIO set mode %x\n", ah
108
        DEBUGF  1, "K : PIO set mode %x\n", ah
118
 
-
 
119
        mov     ax, [Sector512+63*2]
109
        mov     ax, [Sector512+63*2]
120
        DEBUGF  1, "K : Multiword DMA possible modes %x\n", al
110
        DEBUGF  1, "K : Multiword DMA possible modes %x\n", al
121
 
-
 
122
        mov     al, ah
111
        mov     al, ah
123
        call    convert_Sector512_value
112
        call    convert_Sector512_value
124
        DEBUGF  1, "K : Multiword DMA set mode %x\n", ah
113
        DEBUGF  1, "K : Multiword DMA set mode %x\n", ah
125
 
-
 
126
        mov     ax, [Sector512+88*2]
114
        mov     ax, [Sector512+88*2]
127
        DEBUGF  1, "K : Ultra DMA possible modes %x\n", al
115
        DEBUGF  1, "K : Ultra DMA possible modes %x\n", al
128
 
-
 
129
        mov     [ebx+IDE_DEVICE.UDMA_possible_modes], al
116
        mov     [ebx+IDE_DEVICE.UDMA_possible_modes], al
130
 
-
 
131
        mov     al, ah
117
        mov     al, ah
132
        call    convert_Sector512_value
118
        call    convert_Sector512_value
133
        DEBUGF  1, "K : Ultra DMA set mode %x\n", ah
119
        DEBUGF  1, "K : Ultra DMA set mode %x\n", ah
134
 
-
 
135
        mov     [ebx+IDE_DEVICE.UDMA_set_mode], ah
120
        mov     [ebx+IDE_DEVICE.UDMA_set_mode], ah
136
 
-
 
137
        popfd
-
 
138
        popad
121
        popad
139
        ret
122
        ret
140
;--------------------------------------
-
 
-
 
123
 
141
.end:
124
.end:
142
        DEBUGF  1, "K : Device not found\n"
125
        DEBUGF  1, "K : Device not found\n"
-
 
126
        pop     ebx ecx
143
        ret
127
        ret
144
;-----------------------------------------------------------------------------
128
;-----------------------------------------------------------------------------
145
calculate_IDE_device_values_storage:
129
calculate_IDE_device_values_storage:
146
        cmp     ecx, IDE_controller_1
130
        cmp     ecx, IDE_controller_1
147
        jne     @f
131
        jne     @f