Changeset 567 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Initialization/AtaID.asm
- Timestamp:
- May 26, 2014, 1:25:15 PM (11 years ago)
- google:author:
- krille_n_@hotmail.com
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Initialization/AtaID.asm
r550 r567 27 27 ; ES:SI: Ptr to 512-byte ATA information read from the drive 28 28 ; Returns: 29 ; CF: Set if failed to verify ATA-ID30 ; Cleared if ATA-ID verified successfully29 ; ZF: Set if ATA-ID verified successfully 30 ; Cleared if failed to verify ATA-ID 31 31 ; Corrupts registers: 32 32 ; AX, BX, CX … … 41 41 ; Verify P-CHS cylinders 42 42 mov bx, ATA1.wCylCnt 43 mov cx, MAX_VALID_PCHS_CYLINDERS44 call .CompareCHorSfromOffsetBXtoMaxValueIn CX43 mov ax, MAX_VALID_PCHS_CYLINDERS 44 call .CompareCHorSfromOffsetBXtoMaxValueInAX 45 45 46 46 mov bl, ATA1.wHeadCnt & 0FFh 47 mov cx, MAX_VALID_PCHS_HEADS48 call .CompareCHorSfromOffsetBXtoMaxValueIn CX47 mov ax, MAX_VALID_PCHS_HEADS 48 call .CompareCHorSfromOffsetBXtoMaxValueInAX 49 49 50 50 mov bl, ATA1.wSPT & 0FFh 51 mov cl, MAX_VALID_PCHS_SECTORS_PER_TRACK52 call .CompareCHorSfromOffsetBXtoMaxValueIn CX51 mov al, MAX_VALID_PCHS_SECTORS_PER_TRACK 52 call .CompareCHorSfromOffsetBXtoMaxValueInAX 53 53 54 54 ; Check signature byte. It is only found on ATA-5 and later. It should be zero on … … 62 62 ; Check checksum byte since signature was present 63 63 mov cx, ATA6_size 64 call Memory_SumCXbytesFromESSItoAL ; Returns with ZF set according to result 65 jnz SHORT .FailedToVerifyAtaID 66 67 ; ATA-ID is now verified to be valid 68 .AtaIDverifiedSuccessfully: 69 clc 70 ret 71 72 ;-------------------------------------------------------------------- 73 ; .CompareCHorSfromOffsetBXtoMaxValueInCX 74 ; Parameters: 64 jmp Memory_SumCXbytesFromESSItoAL ; Returns with ZF set according to result 65 66 ;-------------------------------------------------------------------- 67 ; .CompareCHorSfromOffsetBXtoMaxValueInAX 68 ; Parameters: 69 ; AX: Maximum valid C, H or S value 75 70 ; BX: C, H or S offset to ATA-ID 76 ; CX: Maximum valid C, H or S value 77 ; ES:SI: Ptr to 512-byte ATA information read from the drive 78 ; Returns: 79 ; Exits from AtaID_VerifyFromESSI with CF set if invalid value 80 ; Corrupts registers: 81 ; AX 82 ;-------------------------------------------------------------------- 83 .CompareCHorSfromOffsetBXtoMaxValueInCX: 84 mov ax, [es:bx+si] 85 test ax, ax 86 jz SHORT .InvalidPCHorSinOffsetBX 87 cmp ax, cx ; Compare to max valid value 71 ; ES:SI: Ptr to 512-byte ATA information read from the drive 72 ; Returns: 73 ; Exits from AtaID_VerifyFromESSI with ZF cleared if invalid value 74 ; Corrupts registers: 75 ; CX 76 ;-------------------------------------------------------------------- 77 .CompareCHorSfromOffsetBXtoMaxValueInAX: 78 mov cx, [es:bx+si] 79 jcxz .InvalidPCHorSinOffsetBX 80 cmp cx, ax ; Compare to max valid value 88 81 jbe SHORT .ValidPCHorSinOffsetBX 89 82 .InvalidPCHorSinOffsetBX: 90 add sp, BYTE 2 ; Clear return address for this function 83 pop cx ; Clear return address for this function 84 inc cx ; Clear ZF to indicate invalid ATA-ID (safe to do since return address in CX will never be FFFFh) 85 .AtaIDverifiedSuccessfully: 91 86 .FailedToVerifyAtaID: 92 stc ; Set carry to indicate invalid ATA-ID93 87 .ValidPCHorSinOffsetBX: 94 88 ret … … 97 91 ;-------------------------------------------------------------------- 98 92 ; Writes user defined limits from ROMVARS to ATA ID read from the drive. 99 ; Modifying the ATA ID reduces code and possibilit es for bugs since100 ; only little fur her checks are needed elsewhere.93 ; Modifying the ATA ID reduces code and possibilities for bugs since 94 ; only little further checks are needed elsewhere. 101 95 ; 102 96 ; AtaID_ModifyESSIforUserDefinedLimitsAndReturnTranslateModeInDX
Note:
See TracChangeset
for help on using the changeset viewer.