1) DMA LBA48 read and write for HDD

2) Some optimization of code

git-svn-id: svn://kolibrios.org@3712 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Marat Zakiyanov (Mario79) 2013-06-27 06:11:10 +00:00
parent 65d0cef44b
commit 93e7aee516
4 changed files with 302 additions and 305 deletions

File diff suppressed because it is too large Load Diff

View File

@ -136,14 +136,7 @@ found_slot_access_denied:
ret ret
;-------------------------------------------------------------------- ;--------------------------------------------------------------------
align 4 align 4
clear_hd_cache:
ret
;--------------------------------------------------------------------
align 4
calculate_cache: calculate_cache:
; mov ecx,cache_max ; entries in cache
; mov esi,HD_CACHE+8
; 1 - IDE0 ... 4 - IDE3 ; 1 - IDE0 ... 4 - IDE3
.ide0: .ide0:
cmp [hdpos], 1 cmp [hdpos], 1
@ -221,7 +214,6 @@ calculate_cache:
;-------------------------------------------------------------------- ;--------------------------------------------------------------------
align 4 align 4
calculate_cache_1: calculate_cache_1:
; lea esi,[edi*8+HD_CACHE]
; 1 - IDE0 ... 4 - IDE3 ; 1 - IDE0 ... 4 - IDE3
.ide0: .ide0:
cmp [hdpos], 1 cmp [hdpos], 1
@ -290,7 +282,6 @@ calculate_cache_1:
;-------------------------------------------------------------------- ;--------------------------------------------------------------------
align 4 align 4
calculate_cache_2: calculate_cache_2:
; add esi,HD_CACHE+65536
; 1 - IDE0 ... 4 - IDE3 ; 1 - IDE0 ... 4 - IDE3
.ide0: .ide0:
cmp [hdpos], 1 cmp [hdpos], 1
@ -644,9 +635,6 @@ clear_CD_cache:
;-------------------------------------------------------------------- ;--------------------------------------------------------------------
align 4 align 4
cd_calculate_cache: cd_calculate_cache:
; mov ecx,cache_max ; entries in cache
; mov esi,HD_CACHE+8
; 1 - IDE0 ... 4 - IDE3 ; 1 - IDE0 ... 4 - IDE3
.ide0: .ide0:
cmp [cdpos], 1 cmp [cdpos], 1
@ -697,7 +685,6 @@ cd_calculate_cache:
;-------------------------------------------------------------------- ;--------------------------------------------------------------------
align 4 align 4
cd_calculate_cache_1: cd_calculate_cache_1:
; lea esi,[edi*8+HD_CACHE]
; 1 - IDE0 ... 4 - IDE3 ; 1 - IDE0 ... 4 - IDE3
.ide0: .ide0:
cmp [cdpos], 1 cmp [cdpos], 1
@ -740,7 +727,6 @@ cd_calculate_cache_1:
;-------------------------------------------------------------------- ;--------------------------------------------------------------------
align 4 align 4
cd_calculate_cache_2: cd_calculate_cache_2:
; add esi,HD_CACHE+65536
; 1 - IDE0 ... 4 - IDE3 ; 1 - IDE0 ... 4 - IDE3
.ide0: .ide0:
cmp [cdpos], 1 cmp [cdpos], 1

View File

@ -405,12 +405,13 @@ sayerr:
; class 1 = mass storage ; class 1 = mass storage
; subclass 1 = IDE controller ; subclass 1 = IDE controller
; a) class 1, subclass 1, programming interface 0x80 ; a) class 1, subclass 1, programming interface 0x80
; This is a Parallel IDE Controller which uses IRQs 14 and 15.
mov ax, 0xB103 mov ax, 0xB103
mov ecx, 1*10000h + 1*100h + 0x80 mov ecx, 1*10000h + 1*100h + 0x80
mov [es:BOOT_IDE_PI_16], cx mov [es:BOOT_IDE_PI_16], cx
xor si, si ; device index = 0 xor si, si ; device index = 0
int 0x1A int 0x1A
jnc .found_1 jnc .found_1 ; Parallel IDE Controller
; b) class 1, subclass 1, programming interface 0x8f ; b) class 1, subclass 1, programming interface 0x8f
mov ax, 0xB103 mov ax, 0xB103
mov ecx, 1*10000h + 1*100h + 0x8f mov ecx, 1*10000h + 1*100h + 0x8f
@ -426,12 +427,13 @@ sayerr:
int 0x1A int 0x1A
jnc .found jnc .found
; d) class 1, subclass 1, programming interface 0x8A ; d) class 1, subclass 1, programming interface 0x8A
; This is a Parallel IDE Controller which uses IRQs 14 and 15.
mov ax, 0xB103 mov ax, 0xB103
mov ecx, 1*10000h + 1*100h + 0x8A mov ecx, 1*10000h + 1*100h + 0x8A
mov [es:BOOT_IDE_PI_16], cx mov [es:BOOT_IDE_PI_16], cx
xor si, si ; device index = 0 xor si, si ; device index = 0
int 0x1A int 0x1A
jnc .found jnc .found_1 ; Parallel IDE Controller
jmp .nopci jmp .nopci
.found_1: .found_1:
@ -448,7 +450,7 @@ sayerr:
.found: .found:
; get memory base BAR0 ; get memory base BAR0
mov ax, 0xB10A mov ax, 0xB10A
mov di, 0x10 ; memory base is config register at 0x20 mov di, 0x10 ; memory base is config register at 0x10
push cx push cx
int 0x1A int 0x1A
jc .no_BAR0 ;.nopci jc .no_BAR0 ;.nopci
@ -457,7 +459,7 @@ sayerr:
pop cx pop cx
; get memory base BAR1 ; get memory base BAR1
mov ax, 0xB10A mov ax, 0xB10A
mov di, 0x14 ; memory base is config register at 0x20 mov di, 0x14 ; memory base is config register at 0x14
push cx push cx
int 0x1A int 0x1A
jc .no_BAR1 ;.nopci jc .no_BAR1 ;.nopci
@ -466,7 +468,7 @@ sayerr:
pop cx pop cx
; get memory base BAR2 ; get memory base BAR2
mov ax, 0xB10A mov ax, 0xB10A
mov di, 0x18 ; memory base is config register at 0x20 mov di, 0x18 ; memory base is config register at 0x18
push cx push cx
int 0x1A int 0x1A
jc .no_BAR2 ;.nopci jc .no_BAR2 ;.nopci
@ -475,7 +477,7 @@ sayerr:
pop cx pop cx
; get memory base BAR3 ; get memory base BAR3
mov ax, 0xB10A mov ax, 0xB10A
mov di, 0x1C ; memory base is config register at 0x20 mov di, 0x1C ; memory base is config register at 0x1c
push cx push cx
int 0x1A int 0x1A
jc .no_BAR3 ;.nopci jc .no_BAR3 ;.nopci

View File

@ -206,7 +206,4 @@ clear_ide_cache:
ret ret
end_get_cache: end_get_cache:
; mov [cache_ide0_pointer],HD_CACHE
; mov [cache_ide0_system_data],HD_CACHE+65536
; mov [cache_ide0_system_sad_size],1919
popa popa