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

Last change on this file since 370 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
Line 
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
12; CS:BP: Ptr to IDEVARS for the controller
13; Returns:
14; CF: Clear, IDE interface only supports hard disks
15; Corrupts registers:
16; AX, BX, CX, DX
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
25; CS:BP: Ptr to IDEVARS for the controller
26; Returns:
27; Nothing
28; Corrupts registers:
29; AX
30;--------------------------------------------------------------------
31.StoreBlockMode:
32 mov BYTE [di+DPT_ATA.bBlockSize], 1
33
34%ifdef MODULE_ADVANCED_ATA
35;--------------------------------------------------------------------
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:
58; AX, BX, CX
59;--------------------------------------------------------------------
60.StorePioMode:
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
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:
78 call AccessDPT_GetIdeBasePortToBX
79 call AdvAtaInit_DetectControllerForIdeBaseInBX
80 mov [di+DPT_ADVANCED_ATA.wControllerID], ax ; Store zero if none detected
81 mov [di+DPT_ADVANCED_ATA.wControllerBasePort], dx
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
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
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:
94 mov BYTE [di+DPT_ADVANCED_ATA.bDevice], DEVICE_32BIT_ATA
95
96.NoAdvancedControllerDetected:
97
98%endif ; MODULE_ADVANCED_ATA
99
100;--------------------------------------------------------------------
101; IdeDPT_StoreReversedAddressLinesFlagIfNecessary
102; Parameters:
103; DS:DI: Ptr to Disk Parameter Table
104; CS:BP: Ptr to IDEVARS for the controller
105; Returns:
106; CF: Always clear
107; Corrupts registers:
108; Nothing
109;--------------------------------------------------------------------
110IdeDPT_StoreReversedAddressLinesFlagIfNecessary:
111 cmp BYTE [cs:bp+IDEVARS.bDevice], DEVICE_XTIDE_REV2
112 je SHORT .SetFlagForSwappedA0andA3
113 cmp BYTE [cs:bp+IDEVARS.bDevice], DEVICE_FAST_XTIDE
114 jne SHORT .EndDPT
115.SetFlagForSwappedA0andA3:
116 or BYTE [di+DPT.bFlagsHigh], FLGH_DPT_REVERSED_A0_AND_A3
117.EndDPT:
118 clc
119 ret
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]
135 mov [di+DPT_ADVANCED_ATA.bDevice], al
136 ret
137
138%endif
Note: See TracBrowser for help on using the repository browser.