📄 ri61ffd.asm
字号:
page ,132
title. IT8661F Floppy Controller Runtime Functions
;*****************************************************************;
;*****************************************************************;
;** **;
;** (C)Copyright 1985-1998, American Megatrends, Inc. **;
;** **;
;** All Rights Reserved. **;
;** **;
;** 6145-F Northbelt Pkwy, Norcross, GA 30071 **;
;** **;
;** Phone (770)-246-8600 **;
;** **;
;*****************************************************************;
;*****************************************************************;
;*****************************************************************;
; $Header: /BIOS/PORTING/IO.112/IT8661F/RI61FFD.ASM 1 98/06/04 12:00a $
;
; $Revision: 1 $
;
; $Date: 98/06/04 12:00a $
;*****************************************************************;
;*****************************************************************;
; Revision History
; ----------------
; $Log: /BIOS/PORTING/IO.112/IT8661F/RI61FFD.ASM $
;
; 1 98/06/04 12:00a Chung
; Initial release.
;
;*****************************************************************;
;---------------------------------------;
include devnode.equ
include io.equ
;---------------------------------------;
public IT8661FFloppyController
;---------------------------------------;
extrn IT8661FCommonRegisterInit:near
extrn IT8661FReadIO :near
extrn IT8661FWriteIO :near
extrn get_cmos_item :near
extrn set_cmos_item_checksum :near
extrn Q_IT8661F_FLOPPY_CONTROLLER:abs
; extrn Q_IT8661F_FLOPPY_SWAP :abs
; extrn Q_IT8661F_FLOPPY_ACCESS :abs
;---------------------------------------;
;---------------------------------------;
; C O D E S E G M E N T ;
;---------------------------------------;
.386
cgroup group _text
_text segment word public USE16 'CODE'
assume cs:CGROUP
;---------------------------------------;
; Peripheral Table Structure ;
;---------------------------------------;-------------------------------------;
; This table should be the only public label defined in this file. It ;
; contains pointers to the peripheral module's data and functions. ;
;-----------------------------------------------------------------------------;
IT8661FFloppyController label word
dw 0 ;Flags
dw DevNodeData ;Pointer to device node data
dw GetNodeStatic ;Pointer to GetNodeStatic routine
dw GetNodeDynamic ;Pointer to GetNodeDynamic routine
dw SetNodeStatic ;Pointer to SetNodeStatic routine
dw SetNodeDynamic ;Pointer to SetNodeDynamic routine
dw RegisterInit ;Pointer to RegisterInit routine
dw GetAutoStatus ;Pointer to GetAutoStatus routine
dw IdeSetMode ;Pointer to IdeSetMode routine
dw AdjustSetup ;Pointer to AdjustSetup routine
dw IsrInstall ;Pointer to IsrInstall routine
dw InitHotKey ;Pointer to InitHotKey routine
dw InitBufferPrfOptimal ;Pointer to InitBufferPrfOptimal routine
dw InitBufferPrfFailSafe ;Pointer to InitBufferPrfFailSafe routine
dw FloppySetDensity ;Pointer to FloppySetDensity routine
;---------------------------------------;
; Device Node Data ;
;---------------------------------------;-------------------------------------;
; This block of data forms the device node that describes the configuration ;
; options available to this peripheral device. ;
;-----------------------------------------------------------------------------;
DevNodeData label byte
; Size Node Number Device ID Base Type Sub Type IF Type Attributes
; ----- ----------- -------------- -------------- -------------- -------------- ----------------------------------------------
sd_node < NODELEN, 0, ID_FLOPPY_CONT, BT_MASS_STORAGE,ST_FLOPPY, IF_STD_FLOPPY, SDN_ATTR_DYNAMIC_CFG >
; port_descriptor < PORT_DESC_TAG, PD_FLAG_DECODE_16, 3F0h, 3F0h, 1, 6 > ;Port 3F0 - 3F5
port_descriptor < PORT_DESC_TAG, PD_FLAG_DECODE_16, 03f0h, 03f0h, 04h, 06h >
irq_descriptor < IRQ_DESC_TAG, 0000000001000000b > ;IRQ 6
dma_descriptor < DMA_DESC_TAG, 0000000000000100b, DD_FLAG_WIDTH_8 + DD_FLAG_MASTER + DD_FLAG_COUNT_BYTE + DD_FLAG_SPEED_COMP >;Ch 2, 08h
END_OF_ALLOCATED_RESOURCES
DEPENDENT_FUNCTION_START
; port_descriptor < PORT_DESC_TAG, PD_FLAG_DECODE_16, 3F0h, 3F0h, 1, 6 > ;Port 3F0 - 3F5
port_descriptor < PORT_DESC_TAG, PD_FLAG_DECODE_16, 03f0h, 03f0h, 04h, 06h >
irq_descriptor < IRQ_DESC_TAG, 0000000001000000b > ;IRQ 6
dma_descriptor < DMA_DESC_TAG, 00000100b, DD_FLAG_WIDTH_8 + DD_FLAG_MASTER + DD_FLAG_COUNT_BYTE + DD_FLAG_SPEED_COMP > ;DMA 2
END_OF_ALTERNATE_RESOURCES
END_OF_COMPATIBLE_DEV_IDS
NODELEN = DevNodeDataEnd - DevNodeData
DevNodeDataEnd label byte
; Format of Device Node Data
;-------------------------------------------------
DevNodeDataBlock struc
NodeData sd_node <>
FloppyPort port_descriptor <>
FloppyIrq irq_descriptor <>
FloppyDma dma_descriptor <>
DevNodeDataBlock ends
; Format of ConfigTableEntry
;-------------------------------------------------
ConfigTableEntry struc
PortAddress dw ?
PortSize db ?
IrqMask dw ?
DmaMask db ?
ConfigTableEntry ends
;---------------------------------------;
; DeviceConfigTable ;
;---------------------------------------;-------------------------------------;
; This table contains one entry for each possible device configuration ;
; setting. This table is only used by routines in this file. This table is ;
; used in two ways: ;
; ;
; 1. During GetNode calls the device's configuration is read from CMOS or ;
; hardware and the device node data must be updated with proper values. ;
; Because of this each entry should contain enough information to fill in ;
; any fields in the device node that depend on the hardware's current ;
; settings. ;
; ;
; 2. During SetNode calls the caller passes in a device node structure and ;
; requests that the device's configuration be updated in CMOS or directly ;
; in hardware. In this case the variable fields in the device node data ;
; will be compared with each entry in the table. If a match is found ;
; the value to write to CMOS (or hardware register) should be able to be ;
; derived from the entry number in the table. For this reason, it is ;
; advantageous to put the table in the same order as CMOS setup values. ;
;-----------------------------------------------------------------------------;
DeviceConfigTable:
; PortAddress PortSize IrqMask DmaMask
; ----------- -------- ------- -------
ConfigTableEntry < 0000h, 00h, 0000h, 00h > ;Disabled
ConfigTableEntry < 03F0h, 06h, 0040h, 04h > ;Enabled
DeviceConfigTableEnd:
;---------------------------------------;
; GetNodeStatic ;
;---------------------------------------;-------------------------------------;
; This function gets a device's configuration from CMOS. The caller has ;
; already copied the device node data into the caller's buffer (at DS:SI). ;
; This function should read the node's configuration from CMOS and update ;
; the variable fields in the node's current configuration section. This ;
; function is called during POST and runtime. ;
; ;
; Input: AL = Node number ;
; DS:SI = Pointer to the node ;
; Stack available ;
; ;
; Output: CF = Set if error getting node, clear if no error ;
; ;
; Destroys: Nothing ;
;-----------------------------------------------------------------------------;
GetNodeStatic proc near private
pusha
mov al, Q_IT8661F_FLOPPY_CONTROLLER
call get_cmos_item ;AL = 0/1/2 for AUTO/Disabled/Enabled
dec al
jns GetNodeNotAuto ;Br if not set to AUTO
call GetHardwareConfig ;Read config directly from hardware
GetNodeNotAuto: ;AL = Entry # in DeviceConfigTable
call ConfigNumberToNodeData ;Move proper values into node data
popa
clc
ret
GetNodeStatic endp
;---------------------------------------;
; GetNodeDynamic ;
;---------------------------------------;-------------------------------------;
; This function gets a device's configuration directly from hardware. The ;
; caller has already copied the device node data into the caller's buffer ;
; (at DS:SI). This function should read hardware registers and update ;
; the variable fields in the node's current configuration section. This ;
; function is called during POST and runtime. ;
; ;
; Input: AL = Node number ;
; DS:SI = Pointer to the node ;
; Stack available ;
; ;
; Output: CF = Set if error getting node, clear if no error ;
; ;
; Destroys: Nothing ;
;-----------------------------------------------------------------------------;
GetNodeDynamic proc near private
pusha
call GetHardwareConfig ;AL = Entry # in DeviceConfigTable
call ConfigNumberToNodeData ;Move proper values into node data
popa
clc
ret
GetNodeDynamic endp
;---------------------------------------;
; SetNodeStatic ;
;---------------------------------------;-------------------------------------;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -