AMIBIOS Super IO Module Help Con

AMIBIOS Super IO Module Help Context

Copyright

Super I/O Module Development Guide

FQA

© American Megatrends, Inc.


Copyright

American Megatrends, Inc.
5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093(USA)

Copyright (c) 1999-2008 American Megatrends, Inc. All Rights Reserved.

This publication contains proprietary information, which is protected by copyright. No part of this publication may be reproduced, transcribed, stored in a retrieval system, translated into any language or computer language, or transmitted in any form whatsoever without the prior written consent of the publisher, American Megatrends, Inc.

American Megatrends, Inc. retains the right to update, change, modify this publication at any time, without notice.

For Additional Information

Call American Megatrends BIOS Sales Department at 1-800-828-9264 for additional information.

Limitations of Liability

In no event shall American Megatrends be held liable for any loss, expenses, or damages of any kind whatsoever, whether direct, indirect, incidental, or consequential, arising from the design or use of this product or the support materials provided with the product.

Limited Warranty

No warranties are made, either expressed or implied, with regard to the contents of this work, its merchantability, or fitness for a particular use. American Megatrends assumes no responsibility for errors and omissions or for the uses made of the material contained herein or reader decisions based on such use.

Trademark and Copyright Acknowledgments

All product names used in this publication are for identification purposes only and are trademarks of their respective Companies.


KernelMode

Kernel-Mode Super I/O Module Foundation

1. Introduce the basic flow chart of APTIO BIOS

Base on Aptio BIOS, the post flow chart as below figure. In this figure, list the parent eLinks related to SIO (SIO short for Super I/O) modules.

Figure 1-1

Main POST flow

The eLinks related to Super I/O Module in each phase

The codes, in SIO Module, will be executed in PEI phase, DXE phase and BDS phase.

In each phase, SIO Module will link initialization code into the BIOS POST procedure. For example,

l PEI code will be linked into PeiCoreInitalize eLink.

l DXE codes will be linked into DxeSioList table.

l …

2. What’s the SIO module?

2.1 Super I/O Module organization

For a full function SIO chip, includes below three modulparts.

l IO module – This category is IO and is main module. All moduleparts of SIO module is dependent on the main module.

l ‘xxx Device ASL files’ modulepart – This part includes all logical devices’ ASL code. And it’s for linking some special device’s ASL code. Usually, we link the logical device ASL code to ACPI module.

l ‘xxx Board’ modulepart – This part includes some table or function which need some customization base on customer board.

2.2 Base on file organization, section summary as below.

l SIO configuration section -> SDL file include BIOS parameter of SIO.

l SIO ACPI-aware section -> All ASL files. The ASL file of IO module defines the global SIO ACPI namespace. The ASL file of SIO ACPI modulepart define ACPI devices for each logical device.

l SIO make section -> Makefile links SIO module into system BIOS.

l SIO Setup section -> SIO setup form, SIO setup strings update and hardware monitor callback function.

l PEI Initialization section -> Includes Pei functions and registers initial table

l DXE Initialization section -> Includes Dxe functions and registers initial table

l Debug initialization section -> includes Debug port initialization, if AMI Debugger debug with SIO com port.

3. The details program base on figure1-1 flow chart, how is the SIO module linked into the project.

l PEI phase:

In this phase, there’s two eLinks. One is linked to PeiCoreInitialize, another is linked to PeiDebuggerInitialize.

All code linked into PeiCoreInitialize eLinks will be called directly before PEI dispatcher dispatchs PEIMs. These codes will do the necessary initialization for power on system, debug and recovery function.

All code linked into PeiDebuggerInitialize will be dispatched as a PEIMs by PEI dispatcher. And these codes are only for AMI debugger. When disable AMI debugger, all function will be disablesd.

For details, you can refer to any one SIO module.

l DXE Phase:

In this phase, has two parts. One is for full SIO initialization and installing SIO drivers. Another is for SIO setup interface.

Full initialization and driver install are completed by AmiSioEntryPoint eLink which is executed before core dispatcher dispatchs DXE drivers. The details code of AmiSioEntryPoint is kernel code outside SIO Modules and inside GenericSio.C file. In GenericSio.C, will call SPIO_DEV_LST table named DxeSioList. This table includes all information of SIO.

SIO setup interface is submitted by setup drivers. The SIO HII resources will be submitted into HII database. The SIO resource includes setup form (.UNI and .SD files), Setup String Initialization (SetupStringInit) and Setup Item Callbacks (SetupItemCallbacks).

For details, you can refer to any one SIO module.

l BDS Phase:

In this phase, System BIOS utilize the drivers, which are installed before BDS phase, to connect console IN/OUT and boot devices, TSE or GSE will load the SIO HII resource to show SIO setup interface and update hardware monitor status.

© American Megatrends, Inc.


LogicalDevicesPorting

Logical Device Development Guide

What are the common logical devices supported in SIO modules?

In different phase, the purposes of programming the logical devices are different.

a) In PEI phase, only do some necessary initialization

l If not support DEBUG MODE and Recovery, only initialize global register in SIO configure space and decode hardware monitor (HWM short for hardware monitor), PME, GPIO … devices’ IO base.

l If support DEBUG MODE, should do COM port initialization.

l If support Recovery, should do KBC and FDC initialization.

b) In DXE phase, will do full initialization for supported logical devices

l Fill SPIO_DEV_LST table for all devices, make sure its type, share flag, resource correct

1) If it HasSetu = TRUE, it show on setup menu and need update configure value, you should add elink to SetupStrTableList.

2) If logical device doesn’t use any resource, you should set SIO_NO_RES in Flag item, else fill its resource in following fields (aslname or IObase/irq/dma).

3) If A logical share resource with B logical device, make sure A logical is not the first device and fill the A logical device table information follow B logical device.

For details, you can refer to SPIO_DEV_LST definition.

l Each logical device should has initial routine. This routine will be called many times when initialize logical devices.

You can refer to SIO_INIT_STEP type definition in Genericsio.h.

In initial routine, any initialization of OEM customization should be extended to Board modulepart. For example, define a GPIO register initial table (PeiIoTable.h) for GPIO initial routine.

c) In BDS phase, will support hardware monitor function and logical devices support information.

1) Setup menu will show device resource assign approach, which device linked to SetupStrTableList

2) Hardware monitor function which linked to HwmExtFunList

d) When boot OS, ACPI-aware OS will load the SIO ACPI code. You can check the SIO device status in Windows ‘Device Manager’.

1) In YourSioName.asl, you’d check below objects. The red objects must be ported correctly, or it will cause device doesn’t work.

SIOX - Device node (_HID=0c02, UID=SPIO), SIO index/DAta IO access & SIO GPIO address space if available

DCAT - Table correspondence the LDNs to Device order in Routing Table.

ENFG & EXFG - Control methods to Enter and Exit configuration mode. ENFG & EXFG correspondingly

LPTM - current parralel port mode

UHID - PnP ID for given Serial port

SIOS - SIO Chipset specific code called from _PTS

SIOW - SIO Chipset specific code called from _WAK

SIOH - SIO event handler, to be called from correspondent _Lxx method

DSTA - Get device status according to ACTR register in LD IO space

DCNT - Enable/Disable Decoding of Device resources, Route/Release resources to LPC bus

DCRS - Returns Byte stream of device's Current resources

DSRS - Configures new Resources to be decoded by a Device

2) Most of logical devices node are supported in ACPI module. If no any special setting, you can refer to ACPI module. If the logical device is special, you’d define the logical device node in SIO module.

© American Megatrends, Inc.


CustomerGuide

Customization Development Guide

1. What are needed in customer porting?

1) check which device present on your board(Some device need GPIO pin config)

2) adjust configport=0x2e or 0x4e or other value according to your board strap pin

3) Confirm your super io enter key

4) Choose decode method with IODECODETYPE token

5) Adjust some hardware monitor or gpio register's value,

2. For each part, how to customize the support.

1) If device present, and you want to enable it,then set YourSioName_xxx_PRESENT=1, elseif you want disable it, set YourSioName_xxx_PRESENT=0

2) According to your board strap pin, set configport=0x2e or 0x4e or other value

3) Check whether enterkey is equal to default value or other value, check super io spec. Usually, the configure key is done before getting SIO modules.

4) Set IODECODETYPE=0, because our SIO module only provide a sample code base on INTEL chipset. If SBGeneric.c provides the IO resource decode function, we recommend, you’d set to call chipset decode method.

5) According to your board, adjust some gpio or hwm register value in DxeIoTable.h. If the setting will cause power on failure, initialize the register in PeiSioTable.h.

3. When implement SIO modules, how to debug SIO issue?

1) If the SIO module doesn't work, please check the configport and enterkey

2) If some device doesn't work, please check it's active register, IO/DMA/IRQ assign registers, IO/DMA decode in LPC bridge and IRQ mask setting.

3) If system BIOS hangs at checkpoint 0x99, please mask device in SPIO_DEV_LST one by one. Then, you can find which logical device causes system hang at checkpoint 0x99.

4) If some logical device resource is assigned correctly, but still doesn’t work, you may need to check global gpio multiply pin.

5) If your SIO resources are conflicted or not correct, please make sure IO Base have decoded and adjust resource in _PRS method in device asl file named xxx.asl.

Above all you have done and the issue still exist, please contact with us, you’d better to prepare one board for us to debug it ^0^

© American Megatrends, Inc.


AMIBIOS Super IO Component FQA

Question：

1. How to start a new Super I/O module?

l Delete the original Super I/O module, add the new component from Alaska database.

l Usually, below points should be customized when add new Super I/O module.

l Adjust the parameter base on platform. For example.

n IODECODETYPE, BOARD_LABEL_BELOW_25

n Super I/O index/data port

n Global register settings

n Super I/O logical device present settings

n Etc…

l Check if SbGeneric.c support LPC IO decode and generic IO decode function. If not support, please customize the functions in OemIoDecode.C.

l Check the tables in PeiIoTable.h and DxeIoTable.h, and fill the correct register value base on hardware design.

l If support hardware monitor function, please check the functions in YourSioNameHwmOemHooks.c.

2. The Super I/O has yellow mark in ACPI OS device manager.

l Please check ASL method(RRIO/rDMA). The two method will decode the IO/DMA resource in OS.

3. What's the basic functions supported in SIO module?

l In PEI phase, Decode the IO resource used by Super I/O module and basic initialization for Super I/O. Like, multi-pin program, etc.

l Support initialize recovery and debug function in PEI phase. Recovery may use serial port, floppy disk and keyboard. Debug may use serial port.

l Super I/O logical devices’ full initialization in DXE phase.

l Super I/O setup interface

l Super I/O hardware monitor dynamic information.

4. What's the difference between the first IO and secondary IO module.

l The first I/O module will support full function defined in the Super I/O datasheet. But the secondary I/O, supposed, only support serial ports.

l The secondary I/O module will link the generic function in first I/O module.

n PeiLoopCspIoDecodeListInit, LoopCspIoDecodeListInit, SetupStrTableList and HwmExtFunList.

5. If use the same index/data port, what should be noted?

Usually, hardware design shouldn’t use the same index/data port for two Super I/O chips.

If use the same port for the first and secondary I/O, may the secondary I/O can’t work.

Please add the patch code for assigning the index/data port resource of secondary I/O in GenericSio.c.

6. If use com port as debug message function, what should to do?

l Set token DEBUG_MODE=1

l Check the serial port initialization. Serial port I/O base and active status.

7. If use recovery function, what should to do?

l Set Recovery_SUPPORT =1, SERIAL_RECOVERY_SUPPORT =1

l Check the Super I/O keyboard controller Initialization for enter recovery mode by hot key.

l Check the Super I/O serial port Initialization for serial recovery function.

l Check the Super I/O floppy controller Initialization for FDD recovery function.

8. What does the PS/2 devices effect on USB keyboard and mouse?

l When initialize USB KBC, USB code may check 60/64.

l If use USB keyboard emulation function, PS/2 60/64 port will effect emulation function.

9. What's relationship with serial redirection function?

No relationship. But you’d check the token TOTAL_SIO_SERIAL_PORTS in serial redirection module.

10. If system hangs at checkpoint 0x99, please try to debug by this way and find the problem.

l Switch off debug mode

l Switch off all Super I/O logical device present settings or switch off the settings one by one

QA test ：

Attached QA test report

© American Megatrends, Inc.


Function by File Name

AMIBIOS Function Reference

By File Name

The following is a list of the .asm files.
For a list in alphabetical order, see In Alphabetical Order.

  • DxeIoTable.h
  • F81216SEC.ASL
  • F81216SEC.MAK
  • F81216SEC.SD
  • F81216SECDXE.C
  • F81216SECPEI.C
  • F81216SECSetup.H
  • IO_F81216SEC.SDL
  • PeiIoTable.h
  • Uart1.ASL
  • Uart2.ASL
Built on 10:39:01 05/20/11


DxeIoTable.h

Description:
SIO init table in DXE phase. Any customers have to review below tables
for themselves platform and make sure each initialization is necessary.
Notes:
In all tables, only fill with necessary setting. Don't fill with default

The following tables are used in the file: DxeIoTable.h.

Table | Description
DXE_XXX_Init_Table | Table filled with SIO GPIO,PME,HWM, etc. logical devices' setting For example: 1. GPIO will define the GPIO pin useage 2. PME will power management control 3. HWM will set temperature, fan, voltage and start control.


DXE_XXX_Init_Table in the DxeIoTable.h

Table : DXE_XXX_Init_Table

File: DxeIoTable.h
Description:
Table filled with SIO GPIO,PME,HWM, etc. logical devices' setting
For example:
1. GPIO will define the GPIO pin useage
2. PME will power management control
3. HWM will set temperature, fan, voltage and start control.
Notes:


F81216SEC.ASL

Description:
Define SIO Device for ACPI OS.

The following functions are used in the file: F81216SEC.ASL.

Function | Description
CGLD | Convert Device Category to Device's LDN
DCNT | Enable/Disable Decoding of Device resources, Route/Release I/O & DMA Resources From, To EIO/LPC Bus
DCR2 | Get FDC, LPT, ECP, UART, IRDA resources (_CRS) Returns Byte stream of Current resources. May contain Resources such: 1 IRQ resource 1 DMA resource 2 IO Port
DCR3 | Get FDC, LPT, ECP, UART, IRDA resources (_CRS) Returns Byte stream of Current resources. May contain Resources such: 1 IRQ resource 1 IO Port
DCRS | Get FDC, LPT, ECP, UART, IRDA resources (_CRS) Returns Byte stream of Current resources. May contain Resources such: 1 IRQ resource 1 DMA resource 1 IO Port
DSR2 | Set FDC, LPT, ECP, UART, IRDA resources (_SRS) Control method can be used for configuring devices with following resource order: 1 IRQ resource 1 DMA resource 2 IO Port
DSR3 | Set FDC, LPT, ECP, UART, IRDA resources (_SRS) Control method can be used for configuring devices with following resource order: 1 IRQ resource 1 IO Port
DSRS | Set FDC, LPT, ECP, UART, IRDA resources (_SRS) Control method can be used for configuring devices with following resource order: 1 IRQ resource 1 DMA resource 1 IO Port
DSTA | GET SIO DEVICE STATUS according to ACTR/IOST(category0x00~0x0F) return values GET SIO DEVICE STATUS according to ACTR/IOAH+IOAL/IOH2+IOL2(category>0x0F)

The following tables are used in the file: F81216SEC.ASL.

Table | Description
CRS1 | Current Resources Buffer for Generic SIO devices
IOID | Operation Region to point to SuperIO configuration space


CGLD in the F81216SEC.ASL

Function : CGLD

File: F81216SEC.ASL
Description:
Convert Device Category to Device's LDN
Input:
Arg0 : Device category #
Output:
LDN


CRS1 in the F81216SEC.ASL

Table : CRS1

File: F81216SEC.ASL
Description:
Current Resources Buffer for Generic SIO devices
Notes:
Note. DMA channel 0 is currently decoded as reserved,
although, it can be used on some of SIO chipsets.
Add DMA0 to _PRS if it is used
Generic Resourse template for FDC, COMx, LPT and ECP Current Resource Settings
(to be initialized and returned by _CRS)


DCNT in the F81216SEC.ASL

Function : DCNT

File: F81216SEC.ASL
Description:
Enable/Disable Decoding of Device resources, Route/Release
I/O & DMA Resources From, To EIO/LPC Bus
Input:
Arg0 : Device catagory #
Arg1 : 0/1 Disable/Enable resource decoding
Output:
Nothing


DCR2 in the F81216SEC.ASL

Function : DCR2

File: F81216SEC.ASL
Description:
Get FDC, LPT, ECP, UART, IRDA resources (_CRS)
Returns Byte stream of Current resources. May contain Resources such:
1 IRQ resource
1 DMA resource
2 IO Port
Input:
Arg0 : Device catagory #
Arg1 : Use/No-Use DMA
Output:
_CRS Resource Buffer


DCR3 in the F81216SEC.ASL

Function : DCR3

File: F81216SEC.ASL
Description:
Get FDC, LPT, ECP, UART, IRDA resources (_CRS)
Returns Byte stream of Current resources. May contain Resources such:
1 IRQ resource
1 IO Port
Input:
Arg0 : Device catagory #
Output:
_CRS Resource Buffer


DCRS in the F81216SEC.ASL

Function : DCRS

File: F81216SEC.ASL
Description:
Get FDC, LPT, ECP, UART, IRDA resources (_CRS)
Returns Byte stream of Current resources. May contain Resources such:
1 IRQ resource
1 DMA resource
1 IO Port
Input:
Arg0 : Device catagory #
Arg1 : Use/No-Use DMA
Output:
_CRS Resource Buffer


DSR2 in the F81216SEC.ASL

Function : DSR2

File: F81216SEC.ASL
Description:
Set FDC, LPT, ECP, UART, IRDA resources (_SRS)
Control method can be used for configuring devices with following resource order:
1 IRQ resource
1 DMA resource
2 IO Port
Input:
Arg0 : PnP Resource String to set
Arg1 : Device catagory #
Output:
Nothing


DSR3 in the F81216SEC.ASL

Function : DSR3

File: F81216SEC.ASL
Description:
Set FDC, LPT, ECP, UART, IRDA resources (_SRS)
Control method can be used for configuring devices with following resource order:
1 IRQ resource
1 IO Port
Input:
Arg0 : PnP Resource String to set
Arg1 : Device catagory #
Output:
Nothing


DSRS in the F81216SEC.ASL

Function : DSRS

File: F81216SEC.ASL
Description:
Set FDC, LPT, ECP, UART, IRDA resources (_SRS)
Control method can be used for configuring devices with following resource order:
1 IRQ resource
1 DMA resource
1 IO Port
Input:
Arg0 : PnP Resource String to set
Arg1 : Device catagory #
Output:
Nothing


DSTA in the F81216SEC.ASL

Function : DSTA

File: F81216SEC.ASL
Description:
GET SIO DEVICE STATUS according to ACTR/IOST(category0x00~0x0F) return values
GET SIO DEVICE STATUS according to ACTR/IOAH+IOAL/IOH2+IOL2(category>0x0F)
Input:
Arg0 : Device category #
Output:
Device Status


IOID in the F81216SEC.ASL

Table : IOID

File: F81216SEC.ASL
Description:
Operation Region to point to SuperIO configuration space
Notes:
OpeRegion address is defined by 'SP2O' global name.
'SPIO' is a field isnside AML_Exchange data area defined in SDL file.
Referrals:
BIOS, AMLDATA


F81216SEC.MAK

Description:
SIO module component make file


F81216SEC.SD

Description:
SIO Form Template, Setup screen definition file


F81216SECDXE.C

Description:
1. Port SIO DXE initial table and routine for genericsio.c
2. Define enter/exit config mode scrip table
3. Define SIO bootscriptable table

The following functions are used in the file: F81216SECDXE.C.

Function | Description
ClearDevResource | This function will Clear SIO resource
COM_Init | This function provide each initial routine in genericsio.c
XXXX_Init | Each of INIT functions will be called twice by GenericSIO after standart initialization(Assigning and Programming IO/IRQ/DMA resources), First time it will be called before Activating the device, If device requires some additional initialization like - programming SIO device registers except IO1, IO2, IRQ1, IRQ2, DMA1 DMA2 Second time After Installing AmiSioProtocol, and DevicePath Protocol of SIO Device. If device requires some additional initialization like - if programming of some runtime registers like SIO_GPIO, SIO_PM SIO_HHM is needed - implementation of some additional setup questions do it here NOTE#1 Once SIO_INIT function invoced SIO Logical device allready selected NOTE#2 If Device Does not require any additional initialization just set InitRoutine field to NULL in SioDevLst[] Table.

The following tables are used in the file: F81216SECDXE.C.

Table | Description
F81216SEC_DevLst | Table filled with SIO porting information ------------+-------+-------+--------+---------+---------+-------------+------------+------------+-----------+------------+------------+-------------| SIO_DEV_TYP | UINT8 | UINT8 | UINT16 | BOOLEAN | BOOLEAN | UINT8 | UINT8 | UINT16 | UINT16 | UINT16 | UINT8 | SIO_INIT | Type | LDN | UID | PnpId | Impleme | HasSetu | Flags | AslName[5] | ResBase[2] | ResLen[2] | IrqMask[2] | DmaMask[2] | InitRoutine | ------------+-------+-------+--------+---------+---------+-------------+------------+------------+-----------+------------+------------+-------------| Field "Falgs" is needed to indicate that SIO Logical Device represented by this table entry shares all or some resources with previous entry. Such situation is sutable for FDC - and PS2 controller This field must be filled properely in order to have driver working right. Here possible Flags Settings #define SIO_SHR_NONE 0x00 #define SIO_SHR_IO1 0x01 //device shares resources programmed in SIO_1_BASE_REG #define SIO_SHR_IO2 0x02 //device shares resources programmed in SIO_2_BASE_REG #define SIO_SHR_IO 0x03 //device shares resources programmed in all SIO_BASE_REG #define SIO_SHR_IRQ1 0x04 #define SIO_SHR_IRQ2 0x08 #define SIO_SHR_IRQ 0x0C #define SIO_SHR_DMA1 0x10 #define SIO_SHR_DMA2 0x20 #define SIO_SHR_DMA 0x30 #define SIO_SHR_ALL 0x3F #define SIO_NO_RES 0x80 //this bit will be set if GCD call to allocate resource succeed //at least one call must return SUCCESS if this flag


ClearDevResource in the F81216SECDXE.C

Function : ClearDevResource

File: F81216SECDXE.C
Description:
This function will Clear SIO resource
Input:
SPIO_DEV* dev
Output:
NONE


COM_Init in the F81216SECDXE.C

Function : COM_Init

File: F81216SECDXE.C
Description:
This function provide each initial routine in genericsio.c
Input:
IN  AMI_SIO_PROTOCOL    *AmiSio - Logical Device's information
IN  EFI_PCI_IO_PROTOCOL *PciIo - Read/Write PCI config space
IN  SIO_INIT_STEP       InitStep - Initial routine step
Output:
EFI_SUCCESS - Initial step sucessfully
EFI_INVALID_PARAMETER - not find the initial step
Modified:
Nothing
Notes:

Referrals:

None


F81216SEC_DevLst in the F81216SECDXE.C

Table : F81216SEC_DevLst

File: F81216SECDXE.C
Description:
Table filled with SIO porting information

------------+-------+-------+--------+---------+---------+-------------+------------+------------+-----------+------------+------------+-------------|
SIO_DEV_TYP | UINT8 | UINT8 | UINT16 | BOOLEAN | BOOLEAN | UINT8       | UINT8      | UINT16     | UINT16    | UINT16     | UINT8      | SIO_INIT    |
Type        | LDN   | UID   | PnpId  | Impleme | HasSetu |   Flags     | AslName[5] | ResBase[2] | ResLen[2] | IrqMask[2] | DmaMask[2] | InitRoutine |
------------+-------+-------+--------+---------+---------+-------------+------------+------------+-----------+------------+------------+-------------|
Field "Falgs" is needed to indicate that SIO Logical Device represented
by this table entry shares all or some resources with previous entry.
Such situation is sutable for FDC - and PS2 controller
This field must be filled properely in order to have driver working right.
Here possible Flags Settings
#define SIO_SHR_NONE    0x00
#define SIO_SHR_IO1     0x01 //device shares resources programmed in SIO_1_BASE_REG
#define SIO_SHR_IO2     0x02 //device shares resources programmed in SIO_2_BASE_REG
#define SIO_SHR_IO      0x03 //device shares resources programmed in all SIO_BASE_REG
#define SIO_SHR_IRQ1    0x04
#define SIO_SHR_IRQ2    0x08
#define SIO_SHR_IRQ     0x0C
#define SIO_SHR_DMA1    0x10
#define SIO_SHR_DMA2    0x20
#define SIO_SHR_DMA     0x30
#define SIO_SHR_ALL     0x3F
#define SIO_NO_RES      0x80 //this bit will be set if GCD call to allocate resource succeed
                //at least one call must return SUCCESS if this flag


XXXX_Init in the F81216SECDXE.C

Function : XXXX_Init

File: F81216SECDXE.C
Description:
Each of INIT functions will be called twice by GenericSIO after standart
initialization(Assigning and Programming IO/IRQ/DMA resources),
First time it will be called before Activating the device,
If device requires some additional initialization like
- programming SIO device registers except IO1, IO2, IRQ1, IRQ2, DMA1 DMA2
Second time After Installing AmiSioProtocol, and DevicePath Protocol of SIO Device.
If device requires some additional initialization like
- if programming of some runtime registers like SIO_GPIO, SIO_PM SIO_HHM is needed
- implementation of some additional setup questions
do it here
NOTE#1 Once SIO_INIT function invoced SIO Logical device allready selected
NOTE#2 If Device Does not require any additional initialization just set
InitRoutine field to NULL in SioDevLst[] Table.
Input:
IN  AMI_SIO_PROTOCOL    *AmiSio - Logical Device's information
IN  EFI_PCI_IO_PROTOCOL *PciIo - Read/Write PCI config space
IN  SIO_INIT_STEP       InitStep - Initial routine step
Output:
None
EFI_STATUS
EFI_SUCCESS - Initial step sucessfully
EFI_INVALID_PARAMETER - not find the initial step
Modified:
Nothing
Referrals:
None

Note:
It is recommended to have a separate Initialization Routine for each SIO Device.
it will save you some code needed to detect which device is currently selected.
case isGetSetupData:
SIO implementation uses separate set of NVRAM variables
associated with each LogicalDevice who has
SPIO_DEV.DeviceInfo->HasSetup property set to true.
Current Setup Settings are stored in SPIO_DEV.NvData.
If due to different look and fill we need to overwrite standard
Setup settings, we can do it here.....
=====================================================
if(SetupData==NULL){
 Status=GetSetupData();
 if(EFI_ERROR(Status)) return Status;
 }
dev->NvData.DevEnable = SetupData->FdcEnable;
dev->NvData.DevPrsId  = 0;//SetupData->FdcPrsId;
dev->NvData.DevMode   = 0;//SetupData->FdcMode;
break;

case isPrsSelect:
If LDN uses non-standard way to determine possible resources(_PRS),
or _PRS may wary based  on LD mode. Then here we can get LD mode using
SPIO_DEV.NvData.Mode field and get corresponded to the mode _PRS Buffer
using GetPrsFromAml() function if ACPISUPPORT is ON. Or set of functions
EFI_STATUS SetUartPrs(SPIO_DEV *Dev);
EFI_STATUS SetLptPrs(SPIO_DEV *Dev, BOOLEAN UseDma);
EFI_STATUS SetFdcPrs(SPIO_DEV *Dev);
EFI_STATUS SetPs2kPrs(SPIO_DEV *Dev);
EFI_STATUS SetPs2mPrs(SPIO_DEV *Dev);
EFI_STATUS SetGamePrs(SPIO_DEV *Dev);
EFI_STATUS SetMpu401Prs(SPIO_DEV *Dev);
Defined in GenericSio.h

case isBeforeActivate:
//If any register needs to be initialized, whle enumerating all SIO devices.
//Use NEW SbLib_SetLpcDeviceDecoding() function to set Device Decoding Range for
//Legacy devices. Implementation in SbGeneric.c, definition in SbCspLib.h
//=====================================================

case isAfterActivate:
//Ttis Initialization step is used to programm any runtime registers rsiding in
//Decvice's decoded io space like SIO_GPIOs, SIO_PM, HHM registers.
//This Programming is needed if device doesnot have or don't need driver to do so.
//If there are a spetial driver like could be for HHM which could get THIS device handle
//and programm like Terminal Driver for COM ports and Floppy Driver for FDC
//nothing needs to be done here

case isAfterBootScript:
//This initialization step is needed to
//Use NEW SbLib_SetLpcDeviceDecoding() function to set Device Decoding Range for Legacy devices


F81216SECPEI.C

Description:
Porting for PEI phase.Just for necessary devices porting.

The following functions are used in the file: F81216SECPEI.C.

Function | Description
F81216SEC_INIT | This function Step through table and initialize the Logic Device
PeiF81216SECInit | This function provide PEI phase SIO initialization
PeiSetLpcDeviceDecoding | This function is used to open IoDecode for logic devices initialized in PEI


F81216SEC_INIT in the F81216SECPEI.C

Function : F81216SEC_INIT

File: F81216SECPEI.C
Description:

This function Step through table and initialize the Logic Device
Input:
None
Output:
EFI_STATUS
Modified:
Nothing
Referrals:
None

Note:


PeiF81216SECInit in the F81216SECPEI.C

Function : PeiF81216SECInit

File: F81216SECPEI.C
Description:
This function provide PEI phase SIO initialization
Input:
IN  EFI_FFS_FILE_HEADER    *FfsHeader - Logical Device's information
IN  EFI_PEI_SERVICES       **PeiServices  - Read/Write PCI config space
Output:
None
Modified:
Nothing
Referrals:
None

Note:


PeiSetLpcDeviceDecoding in the F81216SECPEI.C

Function : PeiSetLpcDeviceDecoding

File: F81216SECPEI.C
Description:
This function is used to open IoDecode for logic devices initialized in PEI
Input:
Output:
EFI_STATUS
Notes:
PORTING REQUIRED


F81216SECSetup.H

Description:
GUID or structure Of Setup related Routines.


IO_F81216SEC.SDL

Description:
SDL file to define SIO functions


PeiIoTable.h

Description:
SIO init table in PEI phase. Any customers have to review below tables
for themselves platform and make sure each initialization is necessary.
Notes:

The following tables are used in the file: PeiIoTable.h.

Table | Description
F81216SEC_Decode_Table | Table filled with SIO IO resource to decode. It is used for PEI IO Decode function. For example: 1. Decode Index/data port 2. Decode KBC,FDC IO for recovery 3. Decode COM port for debug 4. Decode total IO base for runtime, pme, acpi, etc... 5. Decode more com ports wirh "generic IO range decode"
F81216SEC_PEI_Init_Table | Table filled with SIO logical devices' register value. Only do the necessary initialization. For example: 1. Program clock and multi-pin setting in global registers 2. Program KBC,FDC IO for recovery 3. Program COM port for debug


F81216SEC_Decode_Table in the PeiIoTable.h

Table : F81216SEC_Decode_Table

File: PeiIoTable.h
Description:
Table filled with SIO IO resource to decode. It is used
for PEI IO Decode function. For example:
1. Decode Index/data port
2. Decode KBC,FDC IO for recovery
3. Decode COM port for debug
4. Decode total IO base for runtime, pme, acpi, etc...
5. Decode more com ports wirh "generic IO range decode"
Notes:
Attention! Cann't open 3F6(it was used by IDE controller.)


F81216SEC_PEI_Init_Table in the PeiIoTable.h

Table : F81216SEC_PEI_Init_Table

File: PeiIoTable.h
Description:
Table filled with SIO logical devices' register value.
Only do the necessary initialization. For example:
1. Program clock and multi-pin setting in global registers
2. Program KBC,FDC IO for recovery
3. Program COM port for debug
Notes:


Uart1.ASL

Description:
Define ACPI method or namespce For Super IO


Uart2.ASL

Description:
Define ACPI method or namespce For Super IO


Functions in Alphabetical Order

In Alphabetical Order

The following topics provide a list in alphabetical order.
For a list by file name, see By File Name.

  • C
  • D
  • F
  • I
  • P
  • X


Functions in Alphabetical Order

C

Function | Description
CGLD | Convert Device Category to Device's LDN
ClearDevResource | This function will Clear SIO resource
COM_Init | This function provide each initial routine in genericsio.c

Table | Description
CRS1 | Current Resources Buffer for Generic SIO devices


Functions in Alphabetical Order

D

Function | Description
DCNT | Enable/Disable Decoding of Device resources, Route/Release I/O & DMA Resources From, To EIO/LPC Bus
DCR2 | Get FDC, LPT, ECP, UART, IRDA resources (_CRS) Returns Byte stream of Current resources. May contain Resources such: 1 IRQ resource 1 DMA resource 2 IO Port
DCR3 | Get FDC, LPT, ECP, UART, IRDA resources (_CRS) Returns Byte stream of Current resources. May contain Resources such: 1 IRQ resource 1 IO Port
DCRS | Get FDC, LPT, ECP, UART, IRDA resources (_CRS) Returns Byte stream of Current resources. May contain Resources such: 1 IRQ resource 1 DMA resource 1 IO Port
DSR2 | Set FDC, LPT, ECP, UART, IRDA resources (_SRS) Control method can be used for configuring devices with following resource order: 1 IRQ resource 1 DMA resource 2 IO Port
DSR3 | Set FDC, LPT, ECP, UART, IRDA resources (_SRS) Control method can be used for configuring devices with following resource order: 1 IRQ resource 1 IO Port
DSRS | Set FDC, LPT, ECP, UART, IRDA resources (_SRS) Control method can be used for configuring devices with following resource order: 1 IRQ resource 1 DMA resource 1 IO Port
DSTA | GET SIO DEVICE STATUS according to ACTR/IOST(category0x00~0x0F) return values GET SIO DEVICE STATUS according to ACTR/IOAH+IOAL/IOH2+IOL2(category>0x0F)

Table | Description
DXE_XXX_Init_Table | Table filled with SIO GPIO,PME,HWM, etc. logical devices' setting For example: 1. GPIO will define the GPIO pin useage 2. PME will power management control 3. HWM will set temperature, fan, voltage and start control.


Functions in Alphabetical Order

F

Function | Description
F81216SEC_INIT | This function Step through table and initialize the Logic Device

Table | Description
F81216SEC_Decode_Table | Table filled with SIO IO resource to decode. It is used for PEI IO Decode function. For example: 1. Decode Index/data port 2. Decode KBC,FDC IO for recovery 3. Decode COM port for debug 4. Decode total IO base for runtime, pme, acpi, etc... 5. Decode more com ports wirh "generic IO range decode"
F81216SEC_DevLst | Table filled with SIO porting information ------------+-------+-------+--------+---------+---------+-------------+------------+------------+-----------+------------+------------+-------------| SIO_DEV_TYP | UINT8 | UINT8 | UINT16 | BOOLEAN | BOOLEAN | UINT8 | UINT8 | UINT16 | UINT16 | UINT16 | UINT8 | SIO_INIT | Type | LDN | UID | PnpId | Impleme | HasSetu | Flags | AslName[5] | ResBase[2] | ResLen[2] | IrqMask[2] | DmaMask[2] | InitRoutine | ------------+-------+-------+--------+---------+---------+-------------+------------+------------+-----------+------------+------------+-------------| Field "Falgs" is needed to indicate that SIO Logical Device represented by this table entry shares all or some resources with previous entry. Such situation is sutable for FDC - and PS2 controller This field must be filled properely in order to have driver working right. Here possible Flags Settings #define SIO_SHR_NONE 0x00 #define SIO_SHR_IO1 0x01 //device shares resources programmed in SIO_1_BASE_REG #define SIO_SHR_IO2 0x02 //device shares resources programmed in SIO_2_BASE_REG #define SIO_SHR_IO 0x03 //device shares resources programmed in all SIO_BASE_REG #define SIO_SHR_IRQ1 0x04 #define SIO_SHR_IRQ2 0x08 #define SIO_SHR_IRQ 0x0C #define SIO_SHR_DMA1 0x10 #define SIO_SHR_DMA2 0x20 #define SIO_SHR_DMA 0x30 #define SIO_SHR_ALL 0x3F #define SIO_NO_RES 0x80 //this bit will be set if GCD call to allocate resource succeed //at least one call must return SUCCESS if this flag
F81216SEC_PEI_Init_Table | Table filled with SIO logical devices' register value. Only do the necessary initialization. For example: 1. Program clock and multi-pin setting in global registers 2. Program KBC,FDC IO for recovery 3. Program COM port for debug


Functions in Alphabetical Order

I

Table | Description
IOID | Operation Region to point to SuperIO configuration space


Functions in Alphabetical Order

P

Function | Description
PeiF81216SECInit | This function provide PEI phase SIO initialization
PeiSetLpcDeviceDecoding | This function is used to open IoDecode for logic devices initialized in PEI


Functions in Alphabetical Order

X

Function | Description
XXXX_Init | Each of INIT functions will be called twice by GenericSIO after standart initialization(Assigning and Programming IO/IRQ/DMA resources), First time it will be called before Activating the device, If device requires some additional initialization like - programming SIO device registers except IO1, IO2, IRQ1, IRQ2, DMA1 DMA2 Second time After Installing AmiSioProtocol, and DevicePath Protocol of SIO Device. If device requires some additional initialization like - if programming of some runtime registers like SIO_GPIO, SIO_PM SIO_HHM is needed - implementation of some additional setup questions do it here NOTE#1 Once SIO_INIT function invoced SIO Logical device allready selected NOTE#2 If Device Does not require any additional initialization just set InitRoutine field to NULL in SioDevLst[] Table.


General Information


Super IO Module Development Guid

Super IO Module Development Guide

Kernel-Mode Super I/O Module Foundation

Logical Device Development Guide

Customermization Development Guide

© American Megatrends, Inc.