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

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

Changes to XTIDE Universal BIOS:

  • Advanced ATA Module variables are now kept in DPTs.
  • Forced full mode when using Advanced ATA Module.
File size: 4.6 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 al, 1 ; Block mode will be enabled on AH=9h
33 mov ah, [es:si+ATA1.bBlckSize] ; Max block size in sectors
34 mov [di+DPT_ATA.wSetAndMaxBlock], ax
35
36%ifdef MODULE_ADVANCED_ATA
37;--------------------------------------------------------------------
38; .StoreDeviceType
39; Parameters:
40; DS:DI: Ptr to Disk Parameter Table
41; ES:SI: Ptr to 512-byte ATA information read from the drive
42; CS:BP: Ptr to IDEVARS for the controller
43; Returns:
44; Nothing
45; Corrupts registers:
46; Nothing
47;--------------------------------------------------------------------
48.StoreDeviceType:
49 call IdeDPT_StoreDeviceTypeFromIdevarsInCSBPtoDPTinDSDI
50
51;--------------------------------------------------------------------
52; .StorePioModeAndTimings
53; Parameters:
54; DS:DI: Ptr to Disk Parameter Table
55; ES:SI: Ptr to 512-byte ATA information read from the drive
56; CS:BP: Ptr to IDEVARS for the controller
57; Returns:
58; Nothing
59; Corrupts registers:
60; AX, BX, CX
61;--------------------------------------------------------------------
62.StorePioMode:
63 call AtaID_GetMaxPioModeToAXandMinCycleTimeToCX
64 mov [di+DPT_ADVANCED_ATA.wMinPioCycleTime], cx
65 mov [di+DPT_ADVANCED_ATA.bPioMode], al
66 or [di+DPT.bFlagsHigh], ah
67
68;--------------------------------------------------------------------
69; .DetectAdvancedIdeController
70; Parameters:
71; DS:DI: Ptr to Disk Parameter Table
72; ES:SI: Ptr to 512-byte ATA information read from the drive
73; CS:BP: Ptr to IDEVARS for the controller
74; Returns:
75; Nothing
76; Corrupts registers:
77; AX, BX, CX, DX
78;--------------------------------------------------------------------
79.DetectAdvancedIdeController:
80 call AccessDPT_GetIdeBasePortToBX
81 call AdvAtaInit_DetectControllerForIdeBaseInBX
82 mov [di+DPT_ADVANCED_ATA.wControllerID], ax ; Store zero if none detected
83 mov [di+DPT_ADVANCED_ATA.wControllerBasePort], dx
84 jnc SHORT .NoAdvancedControllerDetected
85
86 ; Use highest common PIO mode from controller and drive.
87 ; Many VLB controllers support PIO modes up to 2.
88 call AdvAtaInit_GetControllerMaxPioModeToAL
89 jnc SHORT .ChangeTo32bitDevice
90 and BYTE [di+DPT.bFlagsHigh], ~FLGH_DPT_IORDY ; No IORDY supported if need to limit
91 MIN_U [di+DPT_ADVANCED_ATA.bPioMode], al
92
93 ; We have detected 32-bit controller so change Device Type since
94 ; it might have been set to 16-bit on IDEVARS
95.ChangeTo32bitDevice:
96 mov BYTE [di+DPT_ADVANCED_ATA.bDevice], DEVICE_32BIT_ATA
97
98.NoAdvancedControllerDetected:
99
100%endif ; MODULE_ADVANCED_ATA
101
102;--------------------------------------------------------------------
103; IdeDPT_StoreReversedAddressLinesFlagIfNecessary
104; Parameters:
105; DS:DI: Ptr to Disk Parameter Table
106; CS:BP: Ptr to IDEVARS for the controller
107; Returns:
108; CF: Always clear
109; Corrupts registers:
110; Nothing
111;--------------------------------------------------------------------
112IdeDPT_StoreReversedAddressLinesFlagIfNecessary:
113 cmp BYTE [cs:bp+IDEVARS.bDevice], DEVICE_XTIDE_REV2
114 je SHORT .SetFlagForSwappedA0andA3
115 cmp BYTE [cs:bp+IDEVARS.bDevice], DEVICE_FAST_XTIDE
116 jne SHORT .EndDPT
117.SetFlagForSwappedA0andA3:
118 or BYTE [di+DPT.bFlagsHigh], FLGH_DPT_REVERSED_A0_AND_A3
119.EndDPT:
120 clc
121 ret
122
123
124%ifdef MODULE_ADVANCED_ATA
125;--------------------------------------------------------------------
126; IdeDPT_StoreDeviceTypeFromIdevarsInCSBPtoDPTinDSDI
127; Parameters:
128; DS:DI: Ptr to Disk Parameter Table
129; CS:BP: Ptr to IDEVARS for the controller
130; Returns:
131; Nothing
132; Corrupts registers:
133; AL
134;--------------------------------------------------------------------
135IdeDPT_StoreDeviceTypeFromIdevarsInCSBPtoDPTinDSDI:
136 mov al, [cs:bp+IDEVARS.bDevice]
137 mov [di+DPT_ADVANCED_ATA.bDevice], al
138 ret
139
140%endif
Note: See TracBrowser for help on using the repository browser.