forked from KolibriOS/kolibrios
PIO LBA48 write for HDD
git-svn-id: svn://kolibrios.org@3706 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
41339ef767
commit
178ccd95f9
@ -117,35 +117,37 @@ hd_read_pio:
|
|||||||
cmp eax, 0x10000000
|
cmp eax, 0x10000000
|
||||||
jae .lba48
|
jae .lba48
|
||||||
.lba28:
|
.lba28:
|
||||||
|
pushfd
|
||||||
cli
|
cli
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov edx, [hdbase]
|
mov edx, [hdbase]
|
||||||
inc edx
|
inc edx
|
||||||
out dx, al; ATAFeatures регистр "особенностей"
|
out dx, al ; ATA Features регистр "особенностей"
|
||||||
inc edx
|
inc edx
|
||||||
inc eax
|
inc eax
|
||||||
out dx, al; ATASectorCount счётчик секторов
|
out dx, al ; ATA Sector Counter счётчик секторов
|
||||||
inc edx
|
inc edx
|
||||||
mov eax, [esp+4]
|
mov eax, [esp+4+4]
|
||||||
out dx, al; ATASectorNumber регистр номера сектора
|
out dx, al ; LBA Low LBA (7:0)
|
||||||
shr eax, 8
|
shr eax, 8
|
||||||
inc edx
|
inc edx
|
||||||
out dx, al; ATACylinder номер цилиндра (младший байт)
|
out dx, al ; LBA Mid LBA (15:8)
|
||||||
shr eax, 8
|
shr eax, 8
|
||||||
inc edx
|
inc edx
|
||||||
out dx, al; номер цилиндра (старший байт)
|
out dx, al ; LBA High LBA (23:16)
|
||||||
shr eax, 8
|
shr eax, 8
|
||||||
inc edx
|
inc edx
|
||||||
and al, 1+2+4+8
|
and al, 1+2+4+8 ; LBA (27:24)
|
||||||
add al, byte [hdid]
|
add al, byte [hdid]
|
||||||
add al, 128+64+32
|
add al, 128+64+32
|
||||||
out dx, al; номер головки/номер диска
|
out dx, al ; номер головки/номер диска
|
||||||
inc edx
|
inc edx
|
||||||
mov al, 20h
|
mov al, 20h ; READ SECTOR(S)
|
||||||
out dx, al; ATACommand регистр команд
|
out dx, al ; ATACommand регистр команд
|
||||||
sti
|
popfd
|
||||||
jmp .continue
|
jmp .continue
|
||||||
.lba48:
|
.lba48:
|
||||||
|
pushfd
|
||||||
cli
|
cli
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov edx, [hdbase]
|
mov edx, [hdbase]
|
||||||
@ -157,7 +159,7 @@ hd_read_pio:
|
|||||||
inc eax
|
inc eax
|
||||||
out dx, al ; Sector Count Current Sector count (7:0)
|
out dx, al ; Sector Count Current Sector count (7:0)
|
||||||
inc edx
|
inc edx
|
||||||
mov eax, [esp+4]
|
mov eax, [esp+4+4]
|
||||||
rol eax,8
|
rol eax,8
|
||||||
out dx, al ; LBA Low Previous LBA (31:24)
|
out dx, al ; LBA Low Previous LBA (31:24)
|
||||||
xor eax,eax ; because only 32 bit cache
|
xor eax,eax ; because only 32 bit cache
|
||||||
@ -166,7 +168,7 @@ hd_read_pio:
|
|||||||
inc edx
|
inc edx
|
||||||
out dx, al ; LBA High Previous LBA (47:40)
|
out dx, al ; LBA High Previous LBA (47:40)
|
||||||
sub edx,2
|
sub edx,2
|
||||||
mov eax, [esp+4]
|
mov eax, [esp+4+4]
|
||||||
out dx, al ; LBA Low Current LBA (7:0)
|
out dx, al ; LBA Low Current LBA (7:0)
|
||||||
shr eax, 8
|
shr eax, 8
|
||||||
inc edx
|
inc edx
|
||||||
@ -181,7 +183,7 @@ hd_read_pio:
|
|||||||
inc edx
|
inc edx
|
||||||
mov al, 24h ; READ SECTOR(S) EXT
|
mov al, 24h ; READ SECTOR(S) EXT
|
||||||
out dx, al; ATACommand регистр команд
|
out dx, al; ATACommand регистр команд
|
||||||
sti
|
popfd
|
||||||
.continue:
|
.continue:
|
||||||
call wait_for_sector_buffer
|
call wait_for_sector_buffer
|
||||||
|
|
||||||
@ -291,8 +293,6 @@ hd_write:
|
|||||||
|
|
||||||
align 4
|
align 4
|
||||||
cache_write_pio:
|
cache_write_pio:
|
||||||
cmp dword[esi], 0x10000000
|
|
||||||
jae .bad
|
|
||||||
; call disable_ide_int
|
; call disable_ide_int
|
||||||
|
|
||||||
; Выбрать нужный диск
|
; Выбрать нужный диск
|
||||||
@ -306,34 +306,79 @@ cache_write_pio:
|
|||||||
cmp [hd_error], 0
|
cmp [hd_error], 0
|
||||||
jne hd_write_error
|
jne hd_write_error
|
||||||
|
|
||||||
|
; ATA with 28 or 48 bit for sector number?
|
||||||
|
mov eax, [esi]
|
||||||
|
cmp eax, 0x10000000
|
||||||
|
jae .lba48
|
||||||
|
.lba28:
|
||||||
|
pushfd
|
||||||
cli
|
cli
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov edx, [hdbase]
|
mov edx, [hdbase]
|
||||||
inc edx
|
inc edx
|
||||||
out dx, al
|
out dx, al ; ATA Features регистр "особенностей"
|
||||||
inc edx
|
inc edx
|
||||||
inc eax
|
inc eax
|
||||||
out dx, al
|
out dx, al ; ATA Sector Counter счётчик секторов
|
||||||
inc edx
|
inc edx
|
||||||
mov eax, [esi] ; eax = sector to write
|
mov eax, [esi] ; eax = sector to write
|
||||||
out dx, al
|
out dx, al ; LBA Low LBA (7:0)
|
||||||
shr eax, 8
|
shr eax, 8
|
||||||
inc edx
|
inc edx
|
||||||
out dx, al
|
out dx, al ; LBA Mid LBA (15:8)
|
||||||
shr eax, 8
|
shr eax, 8
|
||||||
inc edx
|
inc edx
|
||||||
out dx, al
|
out dx, al ; LBA High LBA (23:16)
|
||||||
shr eax, 8
|
shr eax, 8
|
||||||
inc edx
|
inc edx
|
||||||
and al, 1+2+4+8
|
and al, 1+2+4+8 ; LBA (27:24)
|
||||||
add al, byte [hdid]
|
add al, byte [hdid]
|
||||||
add al, 128+64+32
|
add al, 128+64+32
|
||||||
out dx, al
|
out dx, al ; номер головки/номер диска
|
||||||
inc edx
|
inc edx
|
||||||
mov al, 30h
|
mov al, 30h ; WRITE SECTOR(S)
|
||||||
out dx, al
|
out dx, al ; ATACommand регистр команд
|
||||||
sti
|
popfd
|
||||||
|
jmp .continue
|
||||||
|
.lba48:
|
||||||
|
pushfd
|
||||||
|
cli
|
||||||
|
xor eax, eax
|
||||||
|
mov edx, [hdbase]
|
||||||
|
inc edx
|
||||||
|
out dx, al ; Features Previous Reserved
|
||||||
|
out dx, al ; Features Current Reserved
|
||||||
|
inc edx
|
||||||
|
out dx, al ; Sector Count Previous Sector count (15:8)
|
||||||
|
inc eax
|
||||||
|
out dx, al ; Sector Count Current Sector count (7:0)
|
||||||
|
inc edx
|
||||||
|
mov eax, [esi]
|
||||||
|
rol eax,8
|
||||||
|
out dx, al ; LBA Low Previous LBA (31:24)
|
||||||
|
xor eax,eax ; because only 32 bit cache
|
||||||
|
inc edx
|
||||||
|
out dx, al ; LBA Mid Previous LBA (39:32)
|
||||||
|
inc edx
|
||||||
|
out dx, al ; LBA High Previous LBA (47:40)
|
||||||
|
sub edx,2
|
||||||
|
mov eax, [esi]
|
||||||
|
out dx, al ; LBA Low Current LBA (7:0)
|
||||||
|
shr eax, 8
|
||||||
|
inc edx
|
||||||
|
out dx, al ; LBA Mid Current LBA (15:8)
|
||||||
|
shr eax, 8
|
||||||
|
inc edx
|
||||||
|
out dx, al ; LBA High Current LBA (23:16)
|
||||||
|
inc edx
|
||||||
|
mov al, byte [hdid]
|
||||||
|
add al, 128+64+32
|
||||||
|
out dx, al; номер головки/номер диска
|
||||||
|
inc edx
|
||||||
|
mov al, 34h ; WRITE SECTOR(S) EXT
|
||||||
|
out dx, al; ATACommand регистр команд
|
||||||
|
popfd
|
||||||
|
.continue:
|
||||||
call wait_for_sector_buffer
|
call wait_for_sector_buffer
|
||||||
|
|
||||||
cmp [hd_error], 0
|
cmp [hd_error], 0
|
||||||
@ -360,9 +405,6 @@ cache_write_pio:
|
|||||||
pop esi ecx
|
pop esi ecx
|
||||||
|
|
||||||
ret
|
ret
|
||||||
.bad:
|
|
||||||
inc [hd_error]
|
|
||||||
ret
|
|
||||||
|
|
||||||
save_hd_wait_timeout:
|
save_hd_wait_timeout:
|
||||||
|
|
||||||
|
@ -44,10 +44,8 @@ FindHDD:
|
|||||||
jmp EndFindHDD
|
jmp EndFindHDD
|
||||||
|
|
||||||
FindHDD_1:
|
FindHDD_1:
|
||||||
movzx eax,word [ChannelNumber]
|
DEBUGF 1, "K : Channel %d ",[ChannelNumber]:2
|
||||||
DEBUGF 1, "K : Channel %d ",eax
|
DEBUGF 1, "Disk %d\n",[DiskNumber]:1
|
||||||
movzx eax,byte [DiskNumber]
|
|
||||||
DEBUGF 1, "Disk %d\n",eax
|
|
||||||
call ReadHDD_ID
|
call ReadHDD_ID
|
||||||
cmp [DevErrorCode], 0
|
cmp [DevErrorCode], 0
|
||||||
jne FindHDD_2
|
jne FindHDD_2
|
||||||
|
@ -1046,18 +1046,12 @@ end if
|
|||||||
@@:
|
@@:
|
||||||
DEBUGF 1, "K : %d CPU detected\n", eax
|
DEBUGF 1, "K : %d CPU detected\n", eax
|
||||||
|
|
||||||
movzx eax,[IDE_BAR0_val]
|
DEBUGF 1, "K : BAR0 %x \n", [IDE_BAR0_val]:4
|
||||||
DEBUGF 1, "K : BAR0 %x \n", eax
|
DEBUGF 1, "K : BAR1 %x \n", [IDE_BAR1_val]:4
|
||||||
movzx eax,[IDE_BAR1_val]
|
DEBUGF 1, "K : BAR2 %x \n", [IDE_BAR2_val]:4
|
||||||
DEBUGF 1, "K : BAR1 %x \n", eax
|
DEBUGF 1, "K : BAR3 %x \n", [IDE_BAR3_val]:4
|
||||||
movzx eax,[IDE_BAR2_val]
|
DEBUGF 1, "K : BAR4 %x \n", [IDEContrRegsBaseAddr]:4
|
||||||
DEBUGF 1, "K : BAR2 %x \n", eax
|
DEBUGF 1, "K : IDEContrProgrammingInterface %x \n", [IDEContrProgrammingInterface]:4
|
||||||
movzx eax,[IDE_BAR3_val]
|
|
||||||
DEBUGF 1, "K : BAR3 %x \n", eax
|
|
||||||
movzx eax,[IDEContrRegsBaseAddr]
|
|
||||||
DEBUGF 1, "K : BAR4 %x \n", eax
|
|
||||||
movzx eax,[IDEContrProgrammingInterface]
|
|
||||||
DEBUGF 1, "K : IDEContrProgrammingInterface %x \n", eax
|
|
||||||
; START MULTITASKING
|
; START MULTITASKING
|
||||||
|
|
||||||
; A 'All set - press ESC to start' messages if need
|
; A 'All set - press ESC to start' messages if need
|
||||||
|
Loading…
Reference in New Issue
Block a user