source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeDPT.asm@ 367

Last change on this file since 367 was 365, checked in by aitotat@…, 13 years ago

Changes to XTIDE Universal BIOS:

  • Errors from AH=9h are stored to DPTs again.
  • XT build fits in 8k again.
File size: 4.5 KB
RevLine 
[150]1; Project name : XTIDE Universal BIOS
2; Description : Sets IDE Device specific parameters to DPT.
3
4; Section containing code
5SECTION .text
6
7;--------------------------------------------------------------------
8; IdeDPT_Finalize
9; Parameters:
10; DS:DI: Ptr to Disk Parameter Table
11; ES:SI: Ptr to 512-byte ATA information read from the drive
[160]12; CS:BP: Ptr to IDEVARS for the controller
[150]13; Returns:
[258]14; CF: Clear, IDE interface only supports hard disks
[150]15; Corrupts registers:
[363]16; AX, BX, CX, DX
[150]17;--------------------------------------------------------------------
18IdeDPT_Finalize:
19
20;--------------------------------------------------------------------
21; .StoreBlockMode
22; Parameters:
23; DS:DI: Ptr to Disk Parameter Table
24; ES:SI: Ptr to 512-byte ATA information read from the drive
[160]25; CS:BP: Ptr to IDEVARS for the controller
[150]26; Returns:
27; Nothing
28; Corrupts registers:
[242]29; AX
[150]30;--------------------------------------------------------------------
31.StoreBlockMode:
[365]32 mov BYTE [di+DPT_ATA.bBlockSize], 1
[150]33
[363]34%ifdef MODULE_ADVANCED_ATA
[160]35;--------------------------------------------------------------------
[363]36; .StoreDeviceType
37; Parameters:
38; DS:DI: Ptr to Disk Parameter Table
39; ES:SI: Ptr to 512-byte ATA information read from the drive
40; CS:BP: Ptr to IDEVARS for the controller
41; Returns:
42; Nothing
43; Corrupts registers:
44; Nothing
45;--------------------------------------------------------------------
46.StoreDeviceType:
47 call IdeDPT_StoreDeviceTypeFromIdevarsInCSBPtoDPTinDSDI
48
49;--------------------------------------------------------------------
50; .StorePioModeAndTimings
51; Parameters:
52; DS:DI: Ptr to Disk Parameter Table
53; ES:SI: Ptr to 512-byte ATA information read from the drive
54; CS:BP: Ptr to IDEVARS for the controller
55; Returns:
56; Nothing
57; Corrupts registers:
[364]58; AX, BX, CX
[363]59;--------------------------------------------------------------------
60.StorePioMode:
[364]61 call AtaID_GetMaxPioModeToAXandMinCycleTimeToCX
62 mov [di+DPT_ADVANCED_ATA.wMinPioCycleTime], cx
63 mov [di+DPT_ADVANCED_ATA.bPioMode], al
64 or [di+DPT.bFlagsHigh], ah
[363]65
66;--------------------------------------------------------------------
67; .DetectAdvancedIdeController
68; Parameters:
69; DS:DI: Ptr to Disk Parameter Table
70; ES:SI: Ptr to 512-byte ATA information read from the drive
71; CS:BP: Ptr to IDEVARS for the controller
72; Returns:
73; Nothing
74; Corrupts registers:
75; AX, BX, CX, DX
76;--------------------------------------------------------------------
77.DetectAdvancedIdeController:
[364]78 call AccessDPT_GetIdeBasePortToBX
79 call AdvAtaInit_DetectControllerForIdeBaseInBX
[363]80 mov [di+DPT_ADVANCED_ATA.wControllerID], ax ; Store zero if none detected
[364]81 mov [di+DPT_ADVANCED_ATA.wControllerBasePort], dx
[363]82 jnc SHORT .NoAdvancedControllerDetected
83
84 ; Use highest common PIO mode from controller and drive.
85 ; Many VLB controllers support PIO modes up to 2.
86 call AdvAtaInit_GetControllerMaxPioModeToAL
87 jnc SHORT .ChangeTo32bitDevice
[364]88 and BYTE [di+DPT.bFlagsHigh], ~FLGH_DPT_IORDY ; No IORDY supported if need to limit
89 MIN_U [di+DPT_ADVANCED_ATA.bPioMode], al
[363]90
91 ; We have detected 32-bit controller so change Device Type since
92 ; it might have been set to 16-bit on IDEVARS
93.ChangeTo32bitDevice:
[364]94 mov BYTE [di+DPT_ADVANCED_ATA.bDevice], DEVICE_32BIT_ATA
[363]95
96.NoAdvancedControllerDetected:
97
98%endif ; MODULE_ADVANCED_ATA
99
100;--------------------------------------------------------------------
[160]101; IdeDPT_StoreReversedAddressLinesFlagIfNecessary
102; Parameters:
103; DS:DI: Ptr to Disk Parameter Table
104; CS:BP: Ptr to IDEVARS for the controller
105; Returns:
[363]106; CF: Always clear
[160]107; Corrupts registers:
108; Nothing
109;--------------------------------------------------------------------
110IdeDPT_StoreReversedAddressLinesFlagIfNecessary:
[361]111 cmp BYTE [cs:bp+IDEVARS.bDevice], DEVICE_XTIDE_REV2
112 je SHORT .SetFlagForSwappedA0andA3
113 cmp BYTE [cs:bp+IDEVARS.bDevice], DEVICE_FAST_XTIDE
[160]114 jne SHORT .EndDPT
[361]115.SetFlagForSwappedA0andA3:
[160]116 or BYTE [di+DPT.bFlagsHigh], FLGH_DPT_REVERSED_A0_AND_A3
[150]117.EndDPT:
[258]118 clc
[150]119 ret
[363]120
121
122%ifdef MODULE_ADVANCED_ATA
123;--------------------------------------------------------------------
124; IdeDPT_StoreDeviceTypeFromIdevarsInCSBPtoDPTinDSDI
125; Parameters:
126; DS:DI: Ptr to Disk Parameter Table
127; CS:BP: Ptr to IDEVARS for the controller
128; Returns:
129; Nothing
130; Corrupts registers:
131; AL
132;--------------------------------------------------------------------
133IdeDPT_StoreDeviceTypeFromIdevarsInCSBPtoDPTinDSDI:
134 mov al, [cs:bp+IDEVARS.bDevice]
[364]135 mov [di+DPT_ADVANCED_ATA.bDevice], al
[363]136 ret
[364]137
[363]138%endif
Note: See TracBrowser for help on using the repository browser.