forked from KolibriOS/kolibrios
1) SATA IDE support for HDD and ATAPI
2) PIO LBA48 read for HDD git-svn-id: svn://kolibrios.org@3702 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
1812e8064e
commit
d9b8117616
@ -50,11 +50,11 @@ hd_read:
|
|||||||
cmp [hdpos], 0x80
|
cmp [hdpos], 0x80
|
||||||
jae .bios
|
jae .bios
|
||||||
; hd_read_{dma,pio} use old ATA with 28 bit for sector number
|
; hd_read_{dma,pio} use old ATA with 28 bit for sector number
|
||||||
cmp eax, 0x10000000
|
; cmp eax, 0x10000000
|
||||||
jb @f
|
; jb @f
|
||||||
inc [hd_error]
|
; inc [hd_error]
|
||||||
jmp return_01
|
; jmp return_01
|
||||||
@@:
|
;@@:
|
||||||
; DMA read is permitted if [allow_dma_access]=1 or 2
|
; DMA read is permitted if [allow_dma_access]=1 or 2
|
||||||
cmp [allow_dma_access], 2
|
cmp [allow_dma_access], 2
|
||||||
ja .nodma
|
ja .nodma
|
||||||
@ -101,10 +101,22 @@ align 4
|
|||||||
hd_read_pio:
|
hd_read_pio:
|
||||||
push eax edx
|
push eax edx
|
||||||
|
|
||||||
|
; Выбрать нужный диск
|
||||||
|
mov edx, [hdbase]
|
||||||
|
add edx, 6 ;адрес регистра головок
|
||||||
|
mov al, byte [hdid]
|
||||||
|
add al, 128+64+32
|
||||||
|
out dx, al; номер головки/номер диска
|
||||||
|
|
||||||
call wait_for_hd_idle
|
call wait_for_hd_idle
|
||||||
cmp [hd_error], 0
|
cmp [hd_error], 0
|
||||||
jne hd_read_error
|
jne hd_read_error
|
||||||
|
|
||||||
|
; ATA with 28 or 48 bit for sector number?
|
||||||
|
mov eax, [esp+4]
|
||||||
|
cmp eax, 0x10000000
|
||||||
|
jae .lba48
|
||||||
|
.lba28:
|
||||||
cli
|
cli
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov edx, [hdbase]
|
mov edx, [hdbase]
|
||||||
@ -132,7 +144,45 @@ hd_read_pio:
|
|||||||
mov al, 20h
|
mov al, 20h
|
||||||
out dx, al; ATACommand регистр команд
|
out dx, al; ATACommand регистр команд
|
||||||
sti
|
sti
|
||||||
|
jmp .continue
|
||||||
|
.lba48:
|
||||||
|
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, [esp+4]
|
||||||
|
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, [esp+4]
|
||||||
|
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, 24h ; READ SECTOR(S) EXT
|
||||||
|
out dx, al; ATACommand регистр команд
|
||||||
|
sti
|
||||||
|
.continue:
|
||||||
call wait_for_sector_buffer
|
call wait_for_sector_buffer
|
||||||
|
|
||||||
cmp [hd_error], 0
|
cmp [hd_error], 0
|
||||||
@ -245,6 +295,13 @@ cache_write_pio:
|
|||||||
jae .bad
|
jae .bad
|
||||||
; call disable_ide_int
|
; call disable_ide_int
|
||||||
|
|
||||||
|
; Выбрать нужный диск
|
||||||
|
mov edx, [hdbase]
|
||||||
|
add edx, 6 ;адрес регистра головок
|
||||||
|
mov al, byte [hdid]
|
||||||
|
add al, 128+64+32
|
||||||
|
out dx, al; номер головки/номер диска
|
||||||
|
|
||||||
call wait_for_hd_idle
|
call wait_for_hd_idle
|
||||||
cmp [hd_error], 0
|
cmp [hd_error], 0
|
||||||
jne hd_write_error
|
jne hd_write_error
|
||||||
@ -596,6 +653,12 @@ hdd_irq15:
|
|||||||
|
|
||||||
align 4
|
align 4
|
||||||
hd_read_dma:
|
hd_read_dma:
|
||||||
|
; hd_read_dma use old ATA with 28 bit for sector number
|
||||||
|
cmp eax, 0x10000000
|
||||||
|
jb @f
|
||||||
|
inc [hd_error]
|
||||||
|
ret
|
||||||
|
@@:
|
||||||
push eax
|
push eax
|
||||||
push edx
|
push edx
|
||||||
mov edx, [dma_hdpos]
|
mov edx, [dma_hdpos]
|
||||||
@ -819,6 +882,11 @@ write_cache_chain:
|
|||||||
|
|
||||||
uglobal
|
uglobal
|
||||||
IDEContrRegsBaseAddr dw ?
|
IDEContrRegsBaseAddr dw ?
|
||||||
|
IDEContrProgrammingInterface dw ?
|
||||||
|
IDE_BAR0_val dw ?
|
||||||
|
IDE_BAR1_val dw ?
|
||||||
|
IDE_BAR2_val dw ?
|
||||||
|
IDE_BAR3_val dw ?
|
||||||
endg
|
endg
|
||||||
; \end{Mario79}
|
; \end{Mario79}
|
||||||
|
|
||||||
|
@ -387,7 +387,12 @@ sayerr:
|
|||||||
|
|
||||||
push 0
|
push 0
|
||||||
pop es
|
pop es
|
||||||
and word [es:BOOT_IDE_BASE_ADDR], 0
|
xor ax,ax
|
||||||
|
and word [es:BOOT_IDE_BASE_ADDR], ax ;0
|
||||||
|
and word [es:BOOT_IDE_BAR0_16], ax ;0
|
||||||
|
and word [es:BOOT_IDE_BAR1_16], ax ;0
|
||||||
|
and word [es:BOOT_IDE_BAR2_16], ax ;0
|
||||||
|
and word [es:BOOT_IDE_BAR3_16], ax ;0
|
||||||
; \begin{Mario79}
|
; \begin{Mario79}
|
||||||
; find HDD IDE DMA PCI device
|
; find HDD IDE DMA PCI device
|
||||||
; check for PCI BIOS
|
; check for PCI BIOS
|
||||||
@ -402,29 +407,81 @@ sayerr:
|
|||||||
; a) class 1, subclass 1, programming interface 0x80
|
; a) class 1, subclass 1, programming interface 0x80
|
||||||
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
|
||||||
xor si, si ; device index = 0
|
xor si, si ; device index = 0
|
||||||
int 0x1A
|
int 0x1A
|
||||||
jnc .found
|
jnc .found_1
|
||||||
; b) class 1, subclass 1, programming interface 0x8A
|
; b) class 1, subclass 1, programming interface 0x8f
|
||||||
mov ax, 0xB103
|
mov ax, 0xB103
|
||||||
mov ecx, 1*10000h + 1*100h + 0x8A
|
mov ecx, 1*10000h + 1*100h + 0x8f
|
||||||
|
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
|
||||||
; c) class 1, subclass 1, programming interface 0x85
|
; c) class 1, subclass 1, programming interface 0x85
|
||||||
mov ax, 0xB103
|
mov ax, 0xB103
|
||||||
mov ecx, 1*10000h + 1*100h + 0x85
|
mov ecx, 1*10000h + 1*100h + 0x85
|
||||||
xor si, si
|
mov [es:BOOT_IDE_PI_16], cx
|
||||||
|
xor si, si ; device index = 0
|
||||||
int 0x1A
|
int 0x1A
|
||||||
jc .nopci
|
jnc .found
|
||||||
.found:
|
; d) class 1, subclass 1, programming interface 0x8A
|
||||||
; get memory base
|
mov ax, 0xB103
|
||||||
|
mov ecx, 1*10000h + 1*100h + 0x8A
|
||||||
|
mov [es:BOOT_IDE_PI_16], cx
|
||||||
|
xor si, si ; device index = 0
|
||||||
|
int 0x1A
|
||||||
|
jnc .found
|
||||||
|
|
||||||
|
jmp .nopci
|
||||||
|
.found_1:
|
||||||
|
; get memory base BAR4
|
||||||
mov ax, 0xB10A
|
mov ax, 0xB10A
|
||||||
mov di, 0x20 ; memory base is config register at 0x20
|
mov di, 0x20 ; memory base is config register at 0x20
|
||||||
|
push cx
|
||||||
int 0x1A
|
int 0x1A
|
||||||
jc .nopci
|
jc .no_BAR4 ;.nopci
|
||||||
and cx, 0xFFF0 ; clear address decode type
|
and cx, 0xFFF0 ; clear address decode type
|
||||||
mov [es:BOOT_IDE_BASE_ADDR], cx
|
mov [es:BOOT_IDE_BASE_ADDR], cx
|
||||||
|
.no_BAR4:
|
||||||
|
pop cx
|
||||||
|
.found:
|
||||||
|
; get memory base BAR0
|
||||||
|
mov ax, 0xB10A
|
||||||
|
mov di, 0x10 ; memory base is config register at 0x20
|
||||||
|
push cx
|
||||||
|
int 0x1A
|
||||||
|
jc .no_BAR0 ;.nopci
|
||||||
|
mov [es:BOOT_IDE_BAR0_16], cx
|
||||||
|
.no_BAR0:
|
||||||
|
pop cx
|
||||||
|
; get memory base BAR1
|
||||||
|
mov ax, 0xB10A
|
||||||
|
mov di, 0x14 ; memory base is config register at 0x20
|
||||||
|
push cx
|
||||||
|
int 0x1A
|
||||||
|
jc .no_BAR1 ;.nopci
|
||||||
|
mov [es:BOOT_IDE_BAR1_16], cx
|
||||||
|
.no_BAR1:
|
||||||
|
pop cx
|
||||||
|
; get memory base BAR2
|
||||||
|
mov ax, 0xB10A
|
||||||
|
mov di, 0x18 ; memory base is config register at 0x20
|
||||||
|
push cx
|
||||||
|
int 0x1A
|
||||||
|
jc .no_BAR2 ;.nopci
|
||||||
|
mov [es:BOOT_IDE_BAR2_16], cx
|
||||||
|
.no_BAR2:
|
||||||
|
pop cx
|
||||||
|
; get memory base BAR3
|
||||||
|
mov ax, 0xB10A
|
||||||
|
mov di, 0x1C ; memory base is config register at 0x20
|
||||||
|
push cx
|
||||||
|
int 0x1A
|
||||||
|
jc .no_BAR3 ;.nopci
|
||||||
|
mov [es:BOOT_IDE_BAR3_16], cx
|
||||||
|
.no_BAR3:
|
||||||
|
pop cx
|
||||||
.nopci:
|
.nopci:
|
||||||
; \end{Mario79}
|
; \end{Mario79}
|
||||||
|
|
||||||
@ -550,8 +607,8 @@ end if
|
|||||||
; following 4 lines set variables to 1 if its current value is 0
|
; following 4 lines set variables to 1 if its current value is 0
|
||||||
cmp byte [di+preboot_dma-preboot_device], 1
|
cmp byte [di+preboot_dma-preboot_device], 1
|
||||||
adc byte [di+preboot_dma-preboot_device], 0
|
adc byte [di+preboot_dma-preboot_device], 0
|
||||||
cmp byte [di+preboot_biosdisk-preboot_device], 1
|
; cmp byte [di+preboot_biosdisk-preboot_device], 1
|
||||||
adc byte [di+preboot_biosdisk-preboot_device], 0
|
; adc byte [di+preboot_biosdisk-preboot_device], 0
|
||||||
;; default value for VRR is OFF
|
;; default value for VRR is OFF
|
||||||
; cmp byte [di+preboot_vrrm-preboot_device], 0
|
; cmp byte [di+preboot_vrrm-preboot_device], 0
|
||||||
; jnz @f
|
; jnz @f
|
||||||
|
@ -322,6 +322,11 @@ BOOT_APM_FLAGS equ 0x9046 ;unused
|
|||||||
BOOT_APM_CODE_32 equ 0x9050
|
BOOT_APM_CODE_32 equ 0x9050
|
||||||
BOOT_APM_CODE_16 equ 0x9052
|
BOOT_APM_CODE_16 equ 0x9052
|
||||||
BOOT_APM_DATA_16 equ 0x9054
|
BOOT_APM_DATA_16 equ 0x9054
|
||||||
|
BOOT_IDE_BAR0_16 equ 0x9056
|
||||||
|
BOOT_IDE_BAR1_16 equ 0x9058
|
||||||
|
BOOT_IDE_BAR2_16 equ 0x905A
|
||||||
|
BOOT_IDE_BAR3_16 equ 0x905C
|
||||||
|
BOOT_IDE_PI_16 equ 0x905E
|
||||||
|
|
||||||
TMP_FILE_NAME equ 0
|
TMP_FILE_NAME equ 0
|
||||||
TMP_CMD_LINE equ 1024
|
TMP_CMD_LINE equ 1024
|
||||||
|
@ -44,6 +44,10 @@ FindHDD:
|
|||||||
jmp EndFindHDD
|
jmp EndFindHDD
|
||||||
|
|
||||||
FindHDD_1:
|
FindHDD_1:
|
||||||
|
movzx eax,word [ChannelNumber]
|
||||||
|
DEBUGF 1, "K : Channel %d ",eax
|
||||||
|
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
|
||||||
@ -52,7 +56,7 @@ FindHDD_1:
|
|||||||
cmp [Sector512+12], word 255
|
cmp [Sector512+12], word 255
|
||||||
ja FindHDD_2
|
ja FindHDD_2
|
||||||
inc byte [DRIVE_DATA+1]
|
inc byte [DRIVE_DATA+1]
|
||||||
jmp FindHDD_2_2
|
jmp Print_Device_Name
|
||||||
FindHDD_2:
|
FindHDD_2:
|
||||||
call DeviceReset
|
call DeviceReset
|
||||||
cmp [DevErrorCode], 0
|
cmp [DevErrorCode], 0
|
||||||
@ -62,6 +66,21 @@ FindHDD_1:
|
|||||||
jne FindHDD_2_2
|
jne FindHDD_2_2
|
||||||
inc byte [DRIVE_DATA+1]
|
inc byte [DRIVE_DATA+1]
|
||||||
inc byte [DRIVE_DATA+1]
|
inc byte [DRIVE_DATA+1]
|
||||||
|
Print_Device_Name:
|
||||||
|
pushad
|
||||||
|
pushfd
|
||||||
|
mov esi,Sector512+27*2
|
||||||
|
mov edi,dev_name
|
||||||
|
mov ecx,20
|
||||||
|
cld
|
||||||
|
@@:
|
||||||
|
lodsw
|
||||||
|
xchg ah,al
|
||||||
|
stosw
|
||||||
|
loop @b
|
||||||
|
popfd
|
||||||
|
popad
|
||||||
|
DEBUGF 1, "K : Dev: %s \n", dev_name
|
||||||
FindHDD_2_2:
|
FindHDD_2_2:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@ -70,10 +89,11 @@ FindHDD_3:
|
|||||||
shl byte [DRIVE_DATA+1], 2
|
shl byte [DRIVE_DATA+1], 2
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
; Адрес считываемого сектора в режиме LBA
|
; Адрес считываемого сектора в режиме LBA
|
||||||
uglobal
|
uglobal
|
||||||
SectorAddress DD ?
|
SectorAddress DD ?
|
||||||
|
dev_name:
|
||||||
|
rb 41
|
||||||
endg
|
endg
|
||||||
;*************************************************
|
;*************************************************
|
||||||
;* ЧТЕНИЕ ИДЕНТИФИКАТОРА ЖЕСТКОГО ДИСКА *
|
;* ЧТЕНИЕ ИДЕНТИФИКАТОРА ЖЕСТКОГО ДИСКА *
|
||||||
|
@ -17,7 +17,8 @@ $Revision$
|
|||||||
search_partitions_ide0:
|
search_partitions_ide0:
|
||||||
test [DRIVE_DATA+1], byte 0x40
|
test [DRIVE_DATA+1], byte 0x40
|
||||||
jz search_partitions_ide1
|
jz search_partitions_ide1
|
||||||
mov [hdbase], 0x1f0
|
mov eax,[hd_address_table]
|
||||||
|
mov [hdbase], eax ;0x1f0
|
||||||
mov [hdid], 0x0
|
mov [hdid], 0x0
|
||||||
mov [hdpos], 1
|
mov [hdpos], 1
|
||||||
mov [known_part], 1
|
mov [known_part], 1
|
||||||
@ -39,7 +40,8 @@ $Revision$
|
|||||||
search_partitions_ide1:
|
search_partitions_ide1:
|
||||||
test [DRIVE_DATA+1], byte 0x10
|
test [DRIVE_DATA+1], byte 0x10
|
||||||
jz search_partitions_ide2
|
jz search_partitions_ide2
|
||||||
mov [hdbase], 0x1f0
|
mov eax,[hd_address_table]
|
||||||
|
mov [hdbase], eax ;0x1f0
|
||||||
mov [hdid], 0x10
|
mov [hdid], 0x10
|
||||||
mov [hdpos], 2
|
mov [hdpos], 2
|
||||||
mov [known_part], 1
|
mov [known_part], 1
|
||||||
@ -61,7 +63,8 @@ $Revision$
|
|||||||
search_partitions_ide2:
|
search_partitions_ide2:
|
||||||
test [DRIVE_DATA+1], byte 0x4
|
test [DRIVE_DATA+1], byte 0x4
|
||||||
jz search_partitions_ide3
|
jz search_partitions_ide3
|
||||||
mov [hdbase], 0x170
|
mov eax,[hd_address_table+16]
|
||||||
|
mov [hdbase], eax ;0x170
|
||||||
mov [hdid], 0x0
|
mov [hdid], 0x0
|
||||||
mov [hdpos], 3
|
mov [hdpos], 3
|
||||||
mov [known_part], 1
|
mov [known_part], 1
|
||||||
@ -83,7 +86,8 @@ $Revision$
|
|||||||
search_partitions_ide3:
|
search_partitions_ide3:
|
||||||
test [DRIVE_DATA+1], byte 0x1
|
test [DRIVE_DATA+1], byte 0x1
|
||||||
jz end_search_partitions_ide
|
jz end_search_partitions_ide
|
||||||
mov [hdbase], 0x170
|
mov eax,[hd_address_table+16]
|
||||||
|
mov [hdbase], eax ;0x170
|
||||||
mov [hdid], 0x10
|
mov [hdid], 0x10
|
||||||
mov [hdpos], 4
|
mov [hdpos], 4
|
||||||
mov [known_part], 1
|
mov [known_part], 1
|
||||||
|
@ -525,25 +525,29 @@ fs_NumFloppyServices = ($ - fs_FloppyServices)/4
|
|||||||
|
|
||||||
fs_OnHd0:
|
fs_OnHd0:
|
||||||
call reserve_hd1
|
call reserve_hd1
|
||||||
mov [hdbase], 0x1F0
|
mov eax,[hd_address_table]
|
||||||
|
mov [hdbase], eax ;0x1F0
|
||||||
mov [hdid], 0
|
mov [hdid], 0
|
||||||
push 1
|
push 1
|
||||||
jmp fs_OnHd
|
jmp fs_OnHd
|
||||||
fs_OnHd1:
|
fs_OnHd1:
|
||||||
call reserve_hd1
|
call reserve_hd1
|
||||||
mov [hdbase], 0x1F0
|
mov eax,[hd_address_table]
|
||||||
|
mov [hdbase], eax ;0x1F0
|
||||||
mov [hdid], 0x10
|
mov [hdid], 0x10
|
||||||
push 2
|
push 2
|
||||||
jmp fs_OnHd
|
jmp fs_OnHd
|
||||||
fs_OnHd2:
|
fs_OnHd2:
|
||||||
call reserve_hd1
|
call reserve_hd1
|
||||||
mov [hdbase], 0x170
|
mov eax,[hd_address_table+16]
|
||||||
|
mov [hdbase], eax ;0x170
|
||||||
mov [hdid], 0
|
mov [hdid], 0
|
||||||
push 3
|
push 3
|
||||||
jmp fs_OnHd
|
jmp fs_OnHd
|
||||||
fs_OnHd3:
|
fs_OnHd3:
|
||||||
call reserve_hd1
|
call reserve_hd1
|
||||||
mov [hdbase], 0x170
|
mov eax,[hd_address_table+16]
|
||||||
|
mov [hdbase], eax ;0x170
|
||||||
mov [hdid], 0x10
|
mov [hdid], 0x10
|
||||||
push 4
|
push 4
|
||||||
fs_OnHd:
|
fs_OnHd:
|
||||||
|
@ -358,8 +358,40 @@ high_code:
|
|||||||
call mutex_init
|
call mutex_init
|
||||||
|
|
||||||
; SAVE REAL MODE VARIABLES
|
; SAVE REAL MODE VARIABLES
|
||||||
|
xor eax,eax
|
||||||
|
mov ax, [BOOT_VAR + BOOT_IDE_PI_16]
|
||||||
|
mov [IDEContrProgrammingInterface], ax
|
||||||
mov ax, [BOOT_VAR + BOOT_IDE_BASE_ADDR]
|
mov ax, [BOOT_VAR + BOOT_IDE_BASE_ADDR]
|
||||||
mov [IDEContrRegsBaseAddr], ax
|
mov [IDEContrRegsBaseAddr], ax
|
||||||
|
mov ax, [BOOT_VAR + BOOT_IDE_BAR0_16]
|
||||||
|
mov [IDE_BAR0_val], ax
|
||||||
|
|
||||||
|
cmp ax,0
|
||||||
|
je @f
|
||||||
|
cmp ax,1
|
||||||
|
je @f
|
||||||
|
and ax,0xfff0
|
||||||
|
mov [StandardATABases],ax
|
||||||
|
mov [hd_address_table],eax
|
||||||
|
mov [hd_address_table+8],eax
|
||||||
|
@@:
|
||||||
|
mov ax, [BOOT_VAR + BOOT_IDE_BAR1_16]
|
||||||
|
mov [IDE_BAR1_val], ax
|
||||||
|
mov ax, [BOOT_VAR + BOOT_IDE_BAR2_16]
|
||||||
|
mov [IDE_BAR2_val], ax
|
||||||
|
|
||||||
|
cmp ax,0
|
||||||
|
je @f
|
||||||
|
cmp ax,1
|
||||||
|
je @f
|
||||||
|
and ax,0xfff0
|
||||||
|
mov [StandardATABases+2],ax
|
||||||
|
mov [hd_address_table+16],eax
|
||||||
|
mov [hd_address_table+24],eax
|
||||||
|
@@:
|
||||||
|
mov ax, [BOOT_VAR + BOOT_IDE_BAR3_16]
|
||||||
|
mov [IDE_BAR3_val], ax
|
||||||
|
|
||||||
; --------------- APM ---------------------
|
; --------------- APM ---------------------
|
||||||
|
|
||||||
; init selectors
|
; init selectors
|
||||||
@ -1014,6 +1046,18 @@ 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", eax
|
||||||
|
movzx eax,[IDE_BAR1_val]
|
||||||
|
DEBUGF 1, "K : BAR1 %x \n", eax
|
||||||
|
movzx eax,[IDE_BAR2_val]
|
||||||
|
DEBUGF 1, "K : BAR2 %x \n", eax
|
||||||
|
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
|
||||||
@ -1028,6 +1072,17 @@ end if
|
|||||||
|
|
||||||
cmp [IDEContrRegsBaseAddr], 0
|
cmp [IDEContrRegsBaseAddr], 0
|
||||||
setnz [dma_hdd]
|
setnz [dma_hdd]
|
||||||
|
|
||||||
|
cmp [dma_hdd],0
|
||||||
|
je .print_pio
|
||||||
|
.print_dma:
|
||||||
|
DEBUGF 1, "K : IDE DMA mode\n"
|
||||||
|
jmp .continue
|
||||||
|
|
||||||
|
.print_pio:
|
||||||
|
DEBUGF 1, "K : IDE PIO mode\n"
|
||||||
|
.continue:
|
||||||
|
|
||||||
mov [timer_ticks_enable], 1 ; for cd driver
|
mov [timer_ticks_enable], 1 ; for cd driver
|
||||||
|
|
||||||
sti
|
sti
|
||||||
@ -1585,23 +1640,27 @@ endg
|
|||||||
|
|
||||||
dec ecx
|
dec ecx
|
||||||
jnz noprma
|
jnz noprma
|
||||||
mov [cdbase], 0x1f0
|
mov eax,[hd_address_table]
|
||||||
|
mov [cdbase], eax ;0x1f0
|
||||||
mov [cdid], 0xa0
|
mov [cdid], 0xa0
|
||||||
noprma:
|
noprma:
|
||||||
|
|
||||||
dec ecx
|
dec ecx
|
||||||
jnz noprsl
|
jnz noprsl
|
||||||
mov [cdbase], 0x1f0
|
mov eax,[hd_address_table]
|
||||||
|
mov [cdbase], eax ;0x1f0
|
||||||
mov [cdid], 0xb0
|
mov [cdid], 0xb0
|
||||||
noprsl:
|
noprsl:
|
||||||
dec ecx
|
dec ecx
|
||||||
jnz nosema
|
jnz nosema
|
||||||
mov [cdbase], 0x170
|
mov eax,[hd_address_table+16]
|
||||||
|
mov [cdbase], eax ;0x170
|
||||||
mov [cdid], 0xa0
|
mov [cdid], 0xa0
|
||||||
nosema:
|
nosema:
|
||||||
dec ecx
|
dec ecx
|
||||||
jnz nosesl
|
jnz nosesl
|
||||||
mov [cdbase], 0x170
|
mov eax,[hd_address_table+16]
|
||||||
|
mov [cdbase], eax ;0x170
|
||||||
mov [cdid], 0xb0
|
mov [cdid], 0xb0
|
||||||
nosesl:
|
nosesl:
|
||||||
ret
|
ret
|
||||||
@ -1630,7 +1689,8 @@ endg
|
|||||||
|
|
||||||
cmp ecx, 1
|
cmp ecx, 1
|
||||||
jnz noprmahd
|
jnz noprmahd
|
||||||
mov [hdbase], 0x1f0
|
mov eax,[hd_address_table]
|
||||||
|
mov [hdbase], eax ;0x1f0
|
||||||
and dword [hdid], 0x0
|
and dword [hdid], 0x0
|
||||||
mov dword [hdpos], ecx
|
mov dword [hdpos], ecx
|
||||||
; call set_FAT32_variables
|
; call set_FAT32_variables
|
||||||
@ -1638,7 +1698,8 @@ endg
|
|||||||
|
|
||||||
cmp ecx, 2
|
cmp ecx, 2
|
||||||
jnz noprslhd
|
jnz noprslhd
|
||||||
mov [hdbase], 0x1f0
|
mov eax,[hd_address_table]
|
||||||
|
mov [hdbase], eax ;0x1f0
|
||||||
mov [hdid], 0x10
|
mov [hdid], 0x10
|
||||||
mov dword [hdpos], ecx
|
mov dword [hdpos], ecx
|
||||||
; call set_FAT32_variables
|
; call set_FAT32_variables
|
||||||
@ -1646,7 +1707,8 @@ endg
|
|||||||
|
|
||||||
cmp ecx, 3
|
cmp ecx, 3
|
||||||
jnz nosemahd
|
jnz nosemahd
|
||||||
mov [hdbase], 0x170
|
mov eax,[hd_address_table+16]
|
||||||
|
mov [hdbase], eax ;0x170
|
||||||
and dword [hdid], 0x0
|
and dword [hdid], 0x0
|
||||||
mov dword [hdpos], ecx
|
mov dword [hdpos], ecx
|
||||||
; call set_FAT32_variables
|
; call set_FAT32_variables
|
||||||
@ -1654,7 +1716,8 @@ endg
|
|||||||
|
|
||||||
cmp ecx, 4
|
cmp ecx, 4
|
||||||
jnz noseslhd
|
jnz noseslhd
|
||||||
mov [hdbase], 0x170
|
mov eax,[hd_address_table+16]
|
||||||
|
mov [hdbase], eax ;0x170
|
||||||
mov [hdid], 0x10
|
mov [hdid], 0x10
|
||||||
mov dword [hdpos], ecx
|
mov dword [hdpos], ecx
|
||||||
; call set_FAT32_variables
|
; call set_FAT32_variables
|
||||||
|
Loading…
Reference in New Issue
Block a user