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

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

Changes to XTIDE Universal BIOS:

  • If Advanced controller needs to limit PIO mode (Vision QD6500), cycle time is now limited as well => QD6500 now works with fast drives.
File size: 5.0 KB
RevLine 
[150]1; Project name  :   XTIDE Universal BIOS
2; Description   :   Sets IDE Device specific parameters to DPT.
3
[376]4;
[399]5; XTIDE Universal BIOS and Associated Tools
[526]6; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team.
[376]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.
[399]12;
[376]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.
[399]17; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
18;
[376]19
[150]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
[160]28;       CS:BP:  Ptr to IDEVARS for the controller
[150]29;   Returns:
[258]30;       CF:     Clear, IDE interface only supports hard disks
[150]31;   Corrupts registers:
[363]32;       AX, BX, CX, DX
[150]33;--------------------------------------------------------------------
34IdeDPT_Finalize:
35
[399]36%ifdef MODULE_FEATURE_SETS
[150]37;--------------------------------------------------------------------
[399]38; .DetectPowerManagementSupport
[150]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:
[399]45;       Nothing
[150]46;--------------------------------------------------------------------
[399]47.DetectPowerManagementSupport:
48    test    BYTE [es:si+ATA6.wSetSup82], A6_wSetSup82_POWERMAN
[410]49    jz      SHORT .NoPowerManagementSupport
[399]50    or      BYTE [di+DPT.bFlagsHigh], FLGH_DPT_POWER_MANAGEMENT_SUPPORTED
51.NoPowerManagementSupport:
52%endif ; MODULE_FEATURE_SETS
53
[410]54
[399]55;--------------------------------------------------------------------
[410]56; .StoreDeviceType
57;   Parameters:
58;       DS:DI:  Ptr to Disk Parameter Table
59;       CS:BP:  Ptr to IDEVARS for the controller
60;   Returns:
61;       Nothing
62;   Corrupts registers:
63;       AL
64;--------------------------------------------------------------------
65.StoreDeviceType:
[473]66    call    IdeDPT_StoreDeviceTypeToDPTinDSDIfromIdevarsInCSBP
[410]67
68
69;--------------------------------------------------------------------
[399]70; .StoreBlockMode
71;   Parameters:
72;       DS:DI:  Ptr to Disk Parameter Table
73;   Returns:
74;       Nothing
75;   Corrupts registers:
76;       Nothing
77;--------------------------------------------------------------------
[150]78.StoreBlockMode:
[365]79    mov     BYTE [di+DPT_ATA.bBlockSize], 1
[150]80
[410]81
[363]82%ifdef MODULE_ADVANCED_ATA
[160]83;--------------------------------------------------------------------
[363]84; .StorePioModeAndTimings
85;   Parameters:
86;       DS:DI:  Ptr to Disk Parameter Table
87;       ES:SI:  Ptr to 512-byte ATA information read from the drive
88;       CS:BP:  Ptr to IDEVARS for the controller
89;   Returns:
90;       Nothing
91;   Corrupts registers:
[364]92;       AX, BX, CX
[363]93;--------------------------------------------------------------------
94.StorePioMode:
[364]95    call    AtaID_GetMaxPioModeToAXandMinCycleTimeToCX
96    mov     [di+DPT_ADVANCED_ATA.wMinPioCycleTime], cx
97    mov     [di+DPT_ADVANCED_ATA.bPioMode], al
[399]98    or      [di+DPT.bFlagsHigh], ah
[363]99
[410]100
[363]101;--------------------------------------------------------------------
102; .DetectAdvancedIdeController
103;   Parameters:
104;       DS:DI:  Ptr to Disk Parameter Table
105;       ES:SI:  Ptr to 512-byte ATA information read from the drive
106;       CS:BP:  Ptr to IDEVARS for the controller
107;   Returns:
108;       Nothing
109;   Corrupts registers:
110;       AX, BX, CX, DX
111;--------------------------------------------------------------------
112.DetectAdvancedIdeController:
[473]113    mov     bx, [di+DPT.wBasePort]
[364]114    call    AdvAtaInit_DetectControllerForIdeBaseInBX
[363]115    mov     [di+DPT_ADVANCED_ATA.wControllerID], ax ; Store zero if none detected
[364]116    mov     [di+DPT_ADVANCED_ATA.wControllerBasePort], dx
[363]117    jnc     SHORT .NoAdvancedControllerDetected
118
119    ; Use highest common PIO mode from controller and drive.
120    ; Many VLB controllers support PIO modes up to 2.
[564]121    call    AdvAtaInit_GetControllerMaxPioModeToALandMinPioCycleTimeToBX
[363]122    jnc     SHORT .ChangeTo32bitDevice
[564]123
[364]124    and     BYTE [di+DPT.bFlagsHigh], ~FLGH_DPT_IORDY   ; No IORDY supported if need to limit
125    MIN_U   [di+DPT_ADVANCED_ATA.bPioMode], al
[564]126    mov     [di+DPT_ADVANCED_ATA.wMinPioCycleTime], bx
[363]127
128    ; We have detected 32-bit controller so change Device Type since
129    ; it might have been set to 16-bit on IDEVARS
130.ChangeTo32bitDevice:
[400]131    mov     BYTE [di+DPT_ATA.bDevice], DEVICE_32BIT_ATA
[363]132.NoAdvancedControllerDetected:
[400]133%endif  ; MODULE_ADVANCED_ATA
[363]134
135
[410]136; End DPT
137    clc
138    ret
139
140
[363]141;--------------------------------------------------------------------
[473]142; IdeDPT_StoreDeviceTypeToDPTinDSDIfromIdevarsInCSBP
[363]143;   Parameters:
144;       DS:DI:  Ptr to Disk Parameter Table
145;       CS:BP:  Ptr to IDEVARS for the controller
146;   Returns:
147;       Nothing
148;   Corrupts registers:
149;       AL
150;--------------------------------------------------------------------
[473]151IdeDPT_StoreDeviceTypeToDPTinDSDIfromIdevarsInCSBP:
[363]152    mov     al, [cs:bp+IDEVARS.bDevice]
[400]153    mov     [di+DPT_ATA.bDevice], al
[363]154    ret
Note: See TracBrowser for help on using the repository browser.