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

Last change on this file since 387 was 376, checked in by gregli@…, 13 years ago

WIDE checkin... Added copyright and license information to sorce files, as per the GPL instructions for usage.

File size: 5.2 KB
Line 
1; Project name : XTIDE Universal BIOS
2; Description : Sets IDE Device specific parameters to DPT.
3
4;
5; XTIDE Universal BIOS and Associated Tools
6; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
7;
8; This program is free software; you can redistribute it and/or modify
9; it under the terms of the GNU General Public License as published by
10; the Free Software Foundation; either version 2 of the License, or
11; (at your option) any later version.
12;
13; This program is distributed in the hope that it will be useful,
14; but WITHOUT ANY WARRANTY; without even the implied warranty of
15; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16; GNU General Public License for more details.
17; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
18;
19
20; Section containing code
21SECTION .text
22
23;--------------------------------------------------------------------
24; IdeDPT_Finalize
25; Parameters:
26; DS:DI: Ptr to Disk Parameter Table
27; ES:SI: Ptr to 512-byte ATA information read from the drive
28; CS:BP: Ptr to IDEVARS for the controller
29; Returns:
30; CF: Clear, IDE interface only supports hard disks
31; Corrupts registers:
32; AX, BX, CX, DX
33;--------------------------------------------------------------------
34IdeDPT_Finalize:
35
36;--------------------------------------------------------------------
37; .StoreBlockMode
38; Parameters:
39; DS:DI: Ptr to Disk Parameter Table
40; ES:SI: Ptr to 512-byte ATA information read from the drive
41; CS:BP: Ptr to IDEVARS for the controller
42; Returns:
43; Nothing
44; Corrupts registers:
45; AX
46;--------------------------------------------------------------------
47.StoreBlockMode:
48 mov BYTE [di+DPT_ATA.bBlockSize], 1
49
50%ifdef MODULE_ADVANCED_ATA
51;--------------------------------------------------------------------
52; .StoreDeviceType
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; Nothing
61;--------------------------------------------------------------------
62.StoreDeviceType:
63 call IdeDPT_StoreDeviceTypeFromIdevarsInCSBPtoDPTinDSDI
64
65;--------------------------------------------------------------------
66; .StorePioModeAndTimings
67; Parameters:
68; DS:DI: Ptr to Disk Parameter Table
69; ES:SI: Ptr to 512-byte ATA information read from the drive
70; CS:BP: Ptr to IDEVARS for the controller
71; Returns:
72; Nothing
73; Corrupts registers:
74; AX, BX, CX
75;--------------------------------------------------------------------
76.StorePioMode:
77 call AtaID_GetMaxPioModeToAXandMinCycleTimeToCX
78 mov [di+DPT_ADVANCED_ATA.wMinPioCycleTime], cx
79 mov [di+DPT_ADVANCED_ATA.bPioMode], al
80 or [di+DPT.bFlagsHigh], ah
81
82;--------------------------------------------------------------------
83; .DetectAdvancedIdeController
84; Parameters:
85; DS:DI: Ptr to Disk Parameter Table
86; ES:SI: Ptr to 512-byte ATA information read from the drive
87; CS:BP: Ptr to IDEVARS for the controller
88; Returns:
89; Nothing
90; Corrupts registers:
91; AX, BX, CX, DX
92;--------------------------------------------------------------------
93.DetectAdvancedIdeController:
94 call AccessDPT_GetIdeBasePortToBX
95 call AdvAtaInit_DetectControllerForIdeBaseInBX
96 mov [di+DPT_ADVANCED_ATA.wControllerID], ax ; Store zero if none detected
97 mov [di+DPT_ADVANCED_ATA.wControllerBasePort], dx
98 jnc SHORT .NoAdvancedControllerDetected
99
100 ; Use highest common PIO mode from controller and drive.
101 ; Many VLB controllers support PIO modes up to 2.
102 call AdvAtaInit_GetControllerMaxPioModeToAL
103 jnc SHORT .ChangeTo32bitDevice
104 and BYTE [di+DPT.bFlagsHigh], ~FLGH_DPT_IORDY ; No IORDY supported if need to limit
105 MIN_U [di+DPT_ADVANCED_ATA.bPioMode], al
106
107 ; We have detected 32-bit controller so change Device Type since
108 ; it might have been set to 16-bit on IDEVARS
109.ChangeTo32bitDevice:
110 mov BYTE [di+DPT_ADVANCED_ATA.bDevice], DEVICE_32BIT_ATA
111
112.NoAdvancedControllerDetected:
113
114%endif ; MODULE_ADVANCED_ATA
115
116;--------------------------------------------------------------------
117; IdeDPT_StoreReversedAddressLinesFlagIfNecessary
118; Parameters:
119; DS:DI: Ptr to Disk Parameter Table
120; CS:BP: Ptr to IDEVARS for the controller
121; Returns:
122; CF: Always clear
123; Corrupts registers:
124; Nothing
125;--------------------------------------------------------------------
126IdeDPT_StoreReversedAddressLinesFlagIfNecessary:
127 cmp BYTE [cs:bp+IDEVARS.bDevice], DEVICE_XTIDE_REV2
128 je SHORT .SetFlagForSwappedA0andA3
129 cmp BYTE [cs:bp+IDEVARS.bDevice], DEVICE_FAST_XTIDE
130 jne SHORT .EndDPT
131.SetFlagForSwappedA0andA3:
132 or BYTE [di+DPT.bFlagsHigh], FLGH_DPT_REVERSED_A0_AND_A3
133.EndDPT:
134 clc
135 ret
136
137
138%ifdef MODULE_ADVANCED_ATA
139;--------------------------------------------------------------------
140; IdeDPT_StoreDeviceTypeFromIdevarsInCSBPtoDPTinDSDI
141; Parameters:
142; DS:DI: Ptr to Disk Parameter Table
143; CS:BP: Ptr to IDEVARS for the controller
144; Returns:
145; Nothing
146; Corrupts registers:
147; AL
148;--------------------------------------------------------------------
149IdeDPT_StoreDeviceTypeFromIdevarsInCSBPtoDPTinDSDI:
150 mov al, [cs:bp+IDEVARS.bDevice]
151 mov [di+DPT_ADVANCED_ATA.bDevice], al
152 ret
153
154%endif
Note: See TracBrowser for help on using the repository browser.