1 | ; Project name : XTIDE Universal BIOS
|
---|
2 | ; Description : Int 13h function AH=48h, Get Extended Drive Parameters.
|
---|
3 |
|
---|
4 | ; Section containing code
|
---|
5 | SECTION .text
|
---|
6 |
|
---|
7 | ;--------------------------------------------------------------------
|
---|
8 | ; Int 13h function AH=48h, Get Extended Drive Parameters.
|
---|
9 | ;
|
---|
10 | ; AH48h_GetExtendedDriveParameters
|
---|
11 | ; Parameters:
|
---|
12 | ; SI: Same as in INTPACK
|
---|
13 | ; DL: Translated Drive number
|
---|
14 | ; DS:DI: Ptr to DPT (in RAMVARS segment)
|
---|
15 | ; SS:BP: Ptr to IDEPACK
|
---|
16 | ; Parameters on INTPACK:
|
---|
17 | ; DS:SI: Ptr to Extended Drive Information Table to fill
|
---|
18 | ; Returns with INTPACK:
|
---|
19 | ; AH: Int 13h return status
|
---|
20 | ; DS:SI: Ptr to Extended Drive Information Table
|
---|
21 | ; CF: 0 if succesfull, 1 if error
|
---|
22 | ;--------------------------------------------------------------------
|
---|
23 | ALIGN JUMP_ALIGN
|
---|
24 | AH48h_HandlerForGetExtendedDriveParameters:
|
---|
25 | ; Get our buffer to ES:SI
|
---|
26 | push di
|
---|
27 | call FindDPT_ForNewDriveToDSDI
|
---|
28 | lea si, [di+LARGEST_DPT_SIZE] ; IdeCommand.asm required fake DPT
|
---|
29 | pop di
|
---|
30 | push ds
|
---|
31 | pop es
|
---|
32 |
|
---|
33 | ; Get Drive ID and total sector count from it
|
---|
34 | call AH25h_GetDriveInformationToBufferInESSI
|
---|
35 | jc SHORT .ReturnWithError
|
---|
36 |
|
---|
37 | ; Point DS:DI to Destination buffer
|
---|
38 | mov di, [bp+IDEPACK.intpack+INTPACK.si]
|
---|
39 | mov ds, [bp+IDEPACK.intpack+INTPACK.ds]
|
---|
40 | mov ax, MINIMUM_EDRIVEINFO_SIZE
|
---|
41 | cmp [di+EDRIVE_INFO.wSize], ax
|
---|
42 | jb SHORT AH42h_ReturnWithInvalidFunctionError
|
---|
43 | je SHORT .SkipEddConfigurationParameters
|
---|
44 |
|
---|
45 | ; We do not support EDD Configuration Parameters so set to FFFF:FFFFh
|
---|
46 | mov ax, -1 ; AX = FFFFh
|
---|
47 | mov [di+EDRIVE_INFO.fpEDDparams], ax
|
---|
48 | mov [di+EDRIVE_INFO.fpEDDparams+2], ax
|
---|
49 | mov ax, EDRIVE_INFO_size
|
---|
50 |
|
---|
51 | ; Fill Extended Drive Information Table in DS:DI
|
---|
52 | .SkipEddConfigurationParameters:
|
---|
53 | mov [di+EDRIVE_INFO.wSize], ax
|
---|
54 | mov WORD [di+EDRIVE_INFO.wFlags], FLG_DMA_BOUNDARY_ERRORS_HANDLED_BY_BIOS | FLG_CHS_INFORMATION_IS_VALID
|
---|
55 |
|
---|
56 | call AtaID_GetPCHStoAXBLBHfromAtaInfoInESSI
|
---|
57 | xor cx, cx
|
---|
58 | mov [di+EDRIVE_INFO.dwCylinders], ax
|
---|
59 | mov [di+EDRIVE_INFO.dwCylinders+2], cx
|
---|
60 | eMOVZX ax, bl
|
---|
61 | mov [di+EDRIVE_INFO.dwHeads], ax
|
---|
62 | mov [di+EDRIVE_INFO.dwHeads+2], cx
|
---|
63 | mov al, bh
|
---|
64 | mov [di+EDRIVE_INFO.dwSectorsPerTrack], ax
|
---|
65 | mov [di+EDRIVE_INFO.dwSectorsPerTrack+2], cx
|
---|
66 |
|
---|
67 | call AtaID_GetTotalSectorCountToBXDXAXfromAtaInfoInESSI
|
---|
68 | mov [di+EDRIVE_INFO.qwTotalSectors], ax
|
---|
69 | mov [di+EDRIVE_INFO.qwTotalSectors+2], dx
|
---|
70 | mov [di+EDRIVE_INFO.qwTotalSectors+4], bx
|
---|
71 | mov [di+EDRIVE_INFO.qwTotalSectors+6], cx
|
---|
72 |
|
---|
73 | mov WORD [di+EDRIVE_INFO.wSectorSize], 512
|
---|
74 |
|
---|
75 | ; Return with success
|
---|
76 | xor ah, ah
|
---|
77 | .ReturnWithError:
|
---|
78 | jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
|
---|