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

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

Changes to XTIDE Universal BIOS:

  • Moved 8-bit device support to MODULE_8BIT_IDE.
  • JR-IDE/ISA support requires a lot less bytes.
  • AT builds now always use full operating mode.
File size: 4.6 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%ifdef MODULE_FEATURE_SETS
37;--------------------------------------------------------------------
38; .DetectPowerManagementSupport
39; Parameters:
40; DS:DI: Ptr to Disk Parameter Table
41; ES:SI: Ptr to 512-byte ATA information read from the drive
42; Returns:
43; Nothing
44; Corrupts registers:
45; Nothing
46;--------------------------------------------------------------------
47.DetectPowerManagementSupport:
48 test BYTE [es:si+ATA6.wSetSup82], A6_wSetSup82_POWERMAN
49 jz .NoPowerManagementSupport
50 or BYTE [di+DPT.bFlagsHigh], FLGH_DPT_POWER_MANAGEMENT_SUPPORTED
51.NoPowerManagementSupport:
52%endif ; MODULE_FEATURE_SETS
53
54;--------------------------------------------------------------------
55; .StoreBlockMode
56; Parameters:
57; DS:DI: Ptr to Disk Parameter Table
58; Returns:
59; Nothing
60; Corrupts registers:
61; Nothing
62;--------------------------------------------------------------------
63.StoreBlockMode:
64 mov BYTE [di+DPT_ATA.bBlockSize], 1
65
66%ifdef MODULE_ADVANCED_ATA
67;--------------------------------------------------------------------
68; .StorePioModeAndTimings
69; Parameters:
70; DS:DI: Ptr to Disk Parameter Table
71; ES:SI: Ptr to 512-byte ATA information read from the drive
72; CS:BP: Ptr to IDEVARS for the controller
73; Returns:
74; Nothing
75; Corrupts registers:
76; AX, BX, CX
77;--------------------------------------------------------------------
78.StorePioMode:
79 call AtaID_GetMaxPioModeToAXandMinCycleTimeToCX
80 mov [di+DPT_ADVANCED_ATA.wMinPioCycleTime], cx
81 mov [di+DPT_ADVANCED_ATA.bPioMode], al
82 or [di+DPT.bFlagsHigh], ah
83
84;--------------------------------------------------------------------
85; .DetectAdvancedIdeController
86; Parameters:
87; DS:DI: Ptr to Disk Parameter Table
88; ES:SI: Ptr to 512-byte ATA information read from the drive
89; CS:BP: Ptr to IDEVARS for the controller
90; Returns:
91; Nothing
92; Corrupts registers:
93; AX, BX, CX, DX
94;--------------------------------------------------------------------
95.DetectAdvancedIdeController:
96 call AccessDPT_GetIdeBasePortToBX
97 call AdvAtaInit_DetectControllerForIdeBaseInBX
98 mov [di+DPT_ADVANCED_ATA.wControllerID], ax ; Store zero if none detected
99 mov [di+DPT_ADVANCED_ATA.wControllerBasePort], dx
100 jnc SHORT .NoAdvancedControllerDetected
101
102 ; Use highest common PIO mode from controller and drive.
103 ; Many VLB controllers support PIO modes up to 2.
104 call AdvAtaInit_GetControllerMaxPioModeToAL
105 jnc SHORT .ChangeTo32bitDevice
106 and BYTE [di+DPT.bFlagsHigh], ~FLGH_DPT_IORDY ; No IORDY supported if need to limit
107 MIN_U [di+DPT_ADVANCED_ATA.bPioMode], al
108
109 ; We have detected 32-bit controller so change Device Type since
110 ; it might have been set to 16-bit on IDEVARS
111.ChangeTo32bitDevice:
112 mov BYTE [di+DPT_ATA.bDevice], DEVICE_32BIT_ATA
113
114.NoAdvancedControllerDetected:
115 ; Fall to IdeDPT_StoreDeviceTypeFromIdevarsInCSBPtoDPTinDSDI
116
117%endif ; MODULE_ADVANCED_ATA
118
119
120;--------------------------------------------------------------------
121; IdeDPT_StoreDeviceTypeFromIdevarsInCSBPtoDPTinDSDI
122; Parameters:
123; DS:DI: Ptr to Disk Parameter Table
124; CS:BP: Ptr to IDEVARS for the controller
125; Returns:
126; Nothing
127; Corrupts registers:
128; AL
129;--------------------------------------------------------------------
130IdeDPT_StoreDeviceTypeFromIdevarsInCSBPtoDPTinDSDI:
131 mov al, [cs:bp+IDEVARS.bDevice]
132 mov [di+DPT_ATA.bDevice], al
133; End DPT
134 clc
135 ret
Note: See TracBrowser for help on using the repository browser.