AMD SB600 BIOS Developer's Guide
AMD SB600 BIOS Developer's Guide
AMD, the AMD Arrow, ATI, the ATI logo, Radeon, Mobility Radeon, AMD Athlon, Sempron, Turion and
combinations thereof are trademarks of Advanced Micro Devices, Inc.
Disclaimer
The contents of this document are provided in connection with Advanced Micro Devices, Inc. ("AMD") products. AMD makes
no representations or warranties with respect to the accuracy or completeness of the contents of this publication and reserves the
right to make changes to specifications and product descriptions at any time without notice. No license, whether express,
implied, arising by estoppel, or otherwise, to any intellectual property rights are granted by this publication. Except as set forth
in AMD's Standard Terms and Conditions of Sale, AMD assumes no liability whatsoever, and disclaims any express or implied
warranty, relating to its products including, but not limited to, the implied warranty of merchantability, fitness for a particular
purpose, or infringement of any intellectual property right.
AMD's products are not designed, intended, authorized or warranted for use as components in systems intended for surgical
implant into the body, or in other applications intended to support or sustain life, or in any other application in which the failure
of AMD's product could create a situation where personal injury, death, or severe property or environmental damage may occur.
AMD reserves the right to discontinue or make changes to its products at any time without notice.
.
Table of Contents
1 Introduction ................................................................................................................. 7
1.1 About This Manual........................................................................................................................ 7
1.2 Overview ....................................................................................................................................... 7
1.3 PCI Internal Devices ................................................................................................................... 10
6 IDE Controller........................................................................................................... 27
8 Power Management................................................................................................... 31
8.1 SMI Handling – EOS (PM IO Reg10h[Bit0])............................................................................. 31
8.2 Programmable I/Os...................................................................................................................... 31
8.3 Power Management Timers......................................................................................................... 32
8.3.1 PM Timer 1 (Inactivity Timer) ............................................................................................................32
8.3.2 PM Timer 2 (Activity Timer) ..............................................................................................................32
8.4 SMI Events.................................................................................................................................. 32
8.4.1 Power Button .......................................................................................................................................34
8.5 C-State Break Events .................................................................................................................. 34
8.5.1 Break Events for C2 State....................................................................................................................34
8.5.2 Break Events for C3 and C4 States......................................................................................................34
8.6 Save/Restore Sequence for S3 State............................................................................................ 34
8.6.1 Register Save Sequence for S3 State ...................................................................................................34
8.7 Wake on Events........................................................................................................................... 35
8.8 Sleep SMI Events ........................................................................................................................ 35
8.8.1 Sleep SMI Control Register.................................................................................................................35
8.8.2 Sleep SMI Programming Sequence .....................................................................................................35
8.8.2.1 Set Sleep SMI Control Register...................................................................................................35
8.8.2.2 Enter Sleep SMI# Routine ...........................................................................................................35
10 Watchdog Timer........................................................................................................ 39
1.2 Overview
The SB600 is an I/O Communication Processor designed to work with AMD’s ATI Radeon™
and Mobility Radeon™ Integrated Graphics Processors (IGPs). The functions and capabilities of
the SB600 are as follows:
ALINK-EXPRESS II
AB
AC97 Audio
Bus 0 DEV 20
Function 5 AC97
B-LINK A-LINK
Device ID 4382h
PORT 1 PORT 0
4 PORTS SATA Controller 1 AC97 Modem
Bus 0 DEV 18 Function 0 Bus 0 DEV 20
Device ID 4380h Function 6
USB:OHCI x5 Device ID 438Eh
B-LINK
Bus 0 DEV 19 Function 0:4 HD Audio
10 PORTS Device ID 4387h : 4388h :
4389h : 438Ah : 438Bh Bus 0 DEV 20
Function 2
USB:EHCI Device ID 4383h
Bus 0 DEV 20
Function 3
SPI bus
Device ID 438Dh
SMBUS /ACPI
Bus 0 DEV 20 Function 0
Device ID 4385h
AB
B-LINK A-LINK
PORT 1 PORT 0
USB:EHCI
Debug port
ALINK
1
IDE CHANNEL
LPC bus
SMBUS /ACPI
PCI Bridge LPC
ROM
RTC
X1/X2 BUS Controler
XBUS
SIRQ GPIO
SERIRQ#
PICD[0]
RTC_IRQ#,
PIDE_INTRQ,
APIC BM
SIDE_INTRQ,
USB_IRQ#, 8250 TIMER SPEAKER
AC97INTAB,
PIC AC97INTBB
INTERRUPT
controller
ACPI / HW
SMI SMBUS PM
Monitor
INTR
PWRGOOD
IGNNE#, GEVENT[7:0],SLPBUTTON CPURST,
FERRB#, TEMPDEAD, TEMPCAUT, INIT#,
INT# F:A SHUTDOWN,DC_STOP#
RESET#
SCIOUT, SLP#,
CPUSTP#, PCISTP#,
STPCLK#, SOFF#, SMI#,
SMIACT#
• The SMI CMD Block must be defined on the 16-bit boundary, i.e., the least significant nibble
of the address must be zero (for example, B0h, C0h etc.)
• The SMI CMD Block consists of two ports – the SMI Command Port at base address, and the
SMI Status Port at base address+1.
• The writes to SMI Status Port will not generate an SMI. The writes to the SMI Command
Port will generate an SMI.
• The SMI Command and SMI Status ports may be written individually as 8 bit ports, or
together as a 16-bit port.
To use the LPC ROM, the pin straps UseLpcRom, FWHDisable must be set accordingly.
The SB600 allows all or a portion of the LPC ROM addressed by the firmware hub to be read
protected, write protected, or both read and write protected. Four dword registers are provided to
select up to 4 LPC ROM ranges for read or write protection. The ROM protection range is
defined by the base address and the length. The base address is aligned at a 2K boundary. The
address length can be from 1K to 256K in increments of 1K.
Example:
Protect 32K LPC ROM starting with base address FFF80000.
Base address bits 31:11 1111 1111 1111 1000 0000 0 b
Length 32K bit 10:2 = 31h = 000 0111 11 b
Read protect bit 1 = 1
Write protect bit 0 = 1
Register 50h = 1111 1111 1111 1000 0000 0000 0111 1111 b = FFF8007F h
Note:
1. Registers 50h ~ 5Fh can be written once after the hardware reset. Subsequent writes to them
have no effect.
2. Setting sections of the LPC ROM to either read or write protect will not allow the ROM to be
updated by a flash programming utility. Most flash utilities write and verify ROM sectors,
and will terminate programming if verification fails due to read protect.
The SPI ROM interface is a new feature added to the SB600. Refer to the AMD SB600 Register Reference
Guide for more information on this feature.
Note: The LPC ROM Read/Write Protect mentioned in the previous paragraph also applies to SPI. Two
strap pins, PCICLK0 and PCICLK1, determine the SB600 boot up from LPC ROM or SPI ROM. There is
no register status to reflect whether the current ROM interface is LPC or SPI.
The internal RTC is divided into two sections: the clock and alarm function (registers 0 to 0Dh),
and CMOS memory (registers 0Eh to FFh). The clock and alarm functions must be accessed
through I/O ports 70h/71h. The CMOS memory (registers 0Eh to FFh) should be accessed
through I/O ports 72h/73h.
Some CMOS memory locations may be disabled for read/write. Register 6Ah of SMBus (Bus 0,
Device 14h, Function 0) has bits to disable these CMOS memory locations. These bits can be
written only once after each power up reset or PCI reset.
The RTC has a century byte at CMOS location 32h. Century is stored in a single byte and the
BCD format is used for the century (for example, 20h for the year 20xx). This byte is accessed
using I/O ports 70h and 71h. (The BIOS must set PMIO register 7Ch bit 4 to 1 to use this century
byte at CMOS location 32h
The RTC has a date alarm byte. This byte is accessed as follows:
1. Set to 1 the RTC register 0Ah , bit 4, using I/O ports 70h and 71h.
2. Write Date Alarm in BCD to register 0Dh using I/O ports 70h and 71h.
3. Clear to 0 the RTC register 0Ah bit 4 using I/O ports 70h and 71h.
Note: It is important to clear RTC register 0Ah bit 4 to zero; otherwise, the CMOS memory may
not be accessed correctly from this point onward.
Note: The BIOS should enter the continuous mode first when enabling the serial IRQ protocol, so that the
SB600 can generate the start frame.
PMIO Description
Register 74h
bits[1:0]
00b The system restart will depend on the ACPWR_Strap pin pull up/down state.
Pin = 0 : The system will restart without pressing the power button
Pin = 1 : The system will remain off until the power button in pressed.
01b The system will always restart after the power is restored.
10b The system will remain off until the power button is pressed.
11b At power-up the system will either restart or remain off depending on the state of the
system at power failure. If the system was on when the power failed, the system will
restart at power-up. If the system was off when the power failed, the system will
remain off after the power is restored. Pressing the power button is required to restart
the system.
The state of the machine after the power-fail/power-restore cycle is controlled by PMIO register
74h bits[1:0] as described above. This programming can be over-ridden for the special case when
the alarm is set. When both the alarm and the PMIO register 74h bit3 are set, the system will
restart after the power is restored, regardless of how register 74h bits [1:0] are defined.
Interrupt routing for device 14h, function 2 HD Audio is done through PCI SMBUS (device 14h,
function 0) register 63h. Values from INTA# to INTH# can be set in this register.
Note: The SB600 has provisions to modify the interrupt pin register (PCI register 3Dh) for special
conditions. This pin is modified through device 14h, function 2, register 44h. Under normal
circumstances do not modify this register. The default is Pin 1.
The following flow chart illustrates the steps in programming the SMBus host controller.
With the SB600, the BIOS must follow particular sequences to enable or disable the IDE
channels (see section 6.1.1 and 6.1.2 below for further information).
Both of the IDE channels are enabled as power-on default. To enable an IDE channel, the BIOS
must be set as follows:
1. Set the IDE channel programmable logic enable bit in Reg09h.
2. Clear the IDE channel disable bit in Reg48h to enable the IDE channel.
Note: No IDE I/O port access is allowed in between step (1) and step (2). It is recommended that
the BIOS execute step (2) immediately after step (1).
Refer to section 14.3.5 for a programming sample.
The BIOS can simply give the PIO mode number through Reg4Ah on the IDE controller.
Two parameters determine the PIO bus-cycle timing: the command width and the recovery width.
CT (bus-cycle timing) = 30ns * ((command width + 1) + (recovery width + 1))
For each PIO mode, the command width and the recovery width must be set by the BIOS
accordingly:
The SB600 IDE controller will run at the legacy DMA mode only when the Ultra-DMA mode is
disabled.
Two parameters determine the DMA bus-cycle timing: the command width and the recovery
width.
CT (bus-cycle timing) = 30ns * ((command width + 1) + (recovery width + 1))
For each legacy DMA mode, the command width and recovery width must be set by the BIOS
accordingly:
The SATA option ROM initial load size is 64KB, and the run time size is 2KB.
A SATA controller enable/disable sample code is found in section 14.2.5.
A SATA class ID change sample code is found in section 14.2.6.
See section 14.7 for the SATA Hot Plug sample code.
* Notes:
• The SMI CMD Block must be dword aligned, i.e., the least significant two bits of the address
must be zero (address[1:0] must be 00). For example, B0h, B4h, B8h, BCh, etc.
• The SMI CMD Block consists of two ports – the SMI Command Port at base address, and the
SMI Status Port at base address+1.
• The writes to the SMI Status Port will not generate an SMI. The writes to the SMI Command
Port will generate an SMI.
• The SMI Command and SMI Status ports may be written individually as 8 bit ports, or
together as a 16 bit port.
The PM Timer 1 is a 6-bit timer with a granularity of 1 minute. The BIOS can set the initial value
of the PM Timer 1 through PM IO Reg0Bh. PM IO Reg0Ch will return the current value of the
decrementing counter.
The PM Timer 1 is typically used as a stand-by timer under the APM mode.
The PM Timer 2 is an 8-bit timer with a granularity of 500 µs. The BIOS can set the initial value
of the PM Timer 2 through PM IO Reg12h. PM IO Reg13h will return the current value of the
decrementing counter.
Note: The PM Timer 2 cannot be configured to reload on any system activities.
Power button is always a wake-up event and can be programmed as an SCI wake-up event. The
power button status register is AcpiPmEvtBlk, bit[8]. The BIOS must make sure this bit is cleared
prior to the entry into any C or S states.
In addition, when the power button is pressed for 4 seconds, the SB600 will shut down the entire
system (by going to S5). No programming is required for this function.
All of the events listed (above) as break events in C2 state are also break events in C3 and C4
states. In addition, the Bus Master Status is also a break event in C3 and C4 states.
Prior to initiating S3 states, the BIOS must save the registers on the machine. The BIOS reserves
a section of the memory and a section of the CMOS to save the registers. Depending on the BIOS
architecture, these registers may be saved either one time just prior to handing of the control over
to the OS, or every time just before going into the S3 states.
The following registers must be saved:
• Some Northbridge registers in CMOS
• Some Northbridge and Memory Controller registers
• Southbridge PCI registers on the SB600
• Southbridge non-PCI registers
There is a Sleep SMI control register in the SB600. Its base I/O address is defined at PMIO Reg
0x04.
SLP_SMI_EN is a R/W register bit for controlling a Sleep SMI when the system transits to an
ACPI SX state. The register definition is as follows:
• SLP_SMI_EN [Bit7] = 0, Disables Sleep SMI event.
• SLP_SMI_EN [Bit7] = 1, Enables Sleep SMI event.
There is a Sleep SMI Status register in the SB600. Its base I/O address is defined at PMIO Reg
0x07.
SLP_SMI_Status [Bit7] is asserted when the system goes to an ACPI SX state, and when
SLP_SMI_EN is set to enable.
The Sleep SMI Control Register does not necessary have to be enabled before the system goes to
the ACPI SX state. One may enable the control the bit in the ACPI ASL code. Please refer to
section 14.9 “Sleep Trap Through SMI#” for the sample code.
The system does not go into the sleep state (set by ACPI PM1_CNT) when SMI# is asserted. The
To verify that the watchdog timer works correctly, perform the following steps:
• Write 100 (count) to the watchdog count register at address 0FEC000F4h.
• Enable and start the watchdog timer by writing 00000081h to the watchdog control register at
0FEC000F0h.
• The counter will start decrementing and will reset the system once it reaches 0. This means
that the watchdog timer is working as designed.
31:0
Data[31:0]
AB_DATA[31:0]
RegSpace[1:0]
00b AXINDC Index/Data Registers. (AX_INDXC)
01b AXINPD Index/Data Registers (AX_INDXP)
10b A-Link Express Configuration (AXCFG)
11b A-Link Bridge Configuration (ABCFG)
Definition of RegSpace[1:0]
In order to read or write a particular register, the software will write the register address and the
register space identifier to AB_INDX and then do a read or write to AB_DATA. This is
analogous to how PCI configuration reads and writes work through I/O addresses CF8h/CFCh.
The location of AB_INDX in the I/O space is defined by the abRegBaseAddr register located at
Device 14h, function 0, register 0F0h. The AB_DATA register address is offset 4h from the
AB_INDX address. The address of the AB_INDX must be 8 byte aligned.
31:3 2:0
BaseAddr[31:3] Rsv
abRegBAR[31:0] at Bus 0, Device 14h, Function 0, Register 0F0h
AXCFG and ABCFG registers are accessed indirectly through AB_INDX/AB_DATA. To read or
write a particular register through AB_INDX/AB_DATA, the register address and the register
space identifier is first written to AB_INDX. The specified register is then accessed by doing a
read or write to AB_DATA (see the example below).
Access to AXINDC and AXINDP registers requires a second level of indirection. Registers in
these spaces are addressed through the following indirection registers:
AX_INDEXC/AX_DATAC and AX_INDEXP/AX_DATAP.
Example: To write to register 21h in the INDXC space with a data of 00, the following steps are
required:
1. Out 30h to AB_INDX. This will prepare to write register from INDXC
2. Out 21h to AB_DATA. This will set register 21h of INDXC
3. Out 34h to AB_INDX. This will prepare to write data to register defined in steps 1
and 2 above
4. Out 00 to AB_DATA. This will write the data to the register defined n steps 1 and 2
above.
12.1 Initialization
For SB600 is HPET usage is required, then during the early POST, the timer base address must be
programmed in Device 14h, Function 0, register 14h. This base address is also reported to the operating
system through the ACPI table as specified in the specification. In addition, the HPET interrupts may also
be enabled through Device 14h, Function 0, register 64h, bit 10.
; Enable the HPET interrupts, if needed. Set Device 14h, Function 0, Register 64h, bit 10
© 2008 Advanced Micro Devices Inc. High Precision Event Timer (HPET)
AMD SB600 BIOS Developer’s Guide (Public Version) Proprietary Page 44
12.2 ACPI HPET Description Table
As described in the specification, an ACPI HPET table is required to report the base address to the
operating system. The table includes a ACPI table header, and HPET table-specific fields. The sample
values for the HPET specific fields are as follows:
© 2008 Advanced Micro Devices Inc. High Precision Event Timer (HPET)
AMD SB600 BIOS Developer’s Guide (Public Version) Proprietary Page 45
13 Common Interface Module – CIM-SB600
HWM_FAN STRUC
CTRL DB 1 ; 0:Disabled 1:En w/o Temp
; 2:En w/ Temp0 3:En w/ AMDSI
Auto DB 0 ; 0:Disabled 1:Enabled
Linear DB 0 ; 0:Disabled 1:Enabled
DutyValue DB 0 ; 0:Output Low 1:Output High
Misc DB 0
FreqDiv DB 0 ;
LowDuty DB 0 ;
MedDuty DB 0 ;
Multiplier DB 0 ;
LowTemplo DB 0 ;
LowTempHi DB 0 ;
MedTemplo DB 0 ;
MedTempHi DB 0 ;
HighTemplo DB 0 ;
HighTempHi DB 0 ;
LinearRange DB 0 ;
LinearAdjust DB 0 ;
LinearHoldCount DB 0 ;
HWM_FAN ends
ATISBPowerOnResetInitJSP – This routine initializes all the Southbridge device registers (including
ACPI Base Address registers, PMIO registers) and applies LPC-DMA deadlock workaround. This
routine should be called before the BIOS decides whether it is normal POST or S3 resume.
The entire POST initialization module is needed only during POST and it can be discarded at end of
POST.
13.5.1 Requirements
The following requirements should be met before calling any interface in the SB POST initialization
module.
1. Module required stack to be present to operate.
2. Input Data Structure (ATI_SB_CFG_SETUP_SETTING) should be initialized before doing any
interface to this module.
3. System should be in 4GB flat mode (also called as Big Real Mode).
4. PCIE BAR should be initialized before calling any interface in this module.
AtiSbBeforePciInit – This interface should be called during early POST after memory detection and
BIOS shadowing but before PCI bus enumeration. The segment where the SBCIM Runtime sub module is
included should be made writable before calling this routine, since this interfaces updates some of the
variables which are present in the SBCIM runtime module. This routine:
1. Reads the PCIE base address from the Northbridge and saves it for further use to do PCI
configuration using MMIO access.
2. Enables or Disables Southbridge devices depending on input data structure values.
3. Calls runtime sub module interface to route SATA controllers to different AB-ports
depending on input parameters
4. Calls runtime sub module interface to program prefetch for IDE, USB and PCIB.
5. Calls runtime sub module interface to program SATA class code.
6. Resets USB controllers.
7. Enables or disables thermal trip function.
AtiSbAfterPciInit – This interface should be called after PCI enumeration is done in the BIOS so that the
resources for all the devices are assigned. This interface:
1. Calls runtime sub module interface to initialize SATA PHY and reset SATA channels.
2. Configures High definition Audio (Azalia).
3. Detects and configures AC-97 modem.
4. Detects and configures MC-97 modem.
5. Initializes USB PHY settings and most of the other settings which are recommended in
Register Programming requirements ( RPR).
6. Calls runtime sub module interface to program Subsystem IDs for all the SB devices.
7. Enables IDE dynamic power saving.
AtiSbLatePost - This interface should be called very late in the POST after hard disk detection and BIOS
setup is done. This module:
1. Initializes some of the PCI bridge registers which are recommended in RPR.
2. Initializes the SBCIM SMI data structure.
3. Programs some of the RPR settings for SATA controller.
1) Normal boot.
2) S3 resume
All the PCI configuration accesses are done using the memory mapped PCI configuration space.
The entire runtime initialization module is needed during POST and S3 resume and so it should not be
discarded at end of BIOS POST. The input data structure ATI_SB_CFG_STRUCT is defined in this
module.
13.6.1 Requirements
The following requirements should be met before calling any interface in the SB POST initialization
module:
During normal boot, most of the SBCIM runtime interfaces are called by SBCIM POST interface. There
is no interface between the BIOS code base and SBCIM runtime sub module during the normal POST.
There are following interfaces between the BIOS code base and SBCIM runtime sub module during the
S3 resume.
AtiSbBfPciRestore - This interface should be called during S3 resume after memory is restored and
before PCI devices are restored. This interface:
AtiSBAfRestore – This interface should be called during S3 resume after PCI devices are
restored. This interface:
1. Initializes SATA PHY and reset SATA channels.
13.7.1 Requirements
The following requirements should be met before calling any interface in the SB SMI module:
The PCI IRQs are programmed using index/data format through registers C00h/C01h. Index 0
through 3, and 9 through 0Ch, are for PCI IRQ lines. Index 4 is for SCI interrupt generated for
ACPI, and Index 5 is for SMBus interrupt.
Sample Program
The following routine initializes all PCI interrupts to zeroes.
If 64 bytes DMA is selected for P2P bridge, set PCI to PCI bridge device 14h, function 4, register
4Bh, bit 4 to 1.
To disable over-current detection for both OHCI and EHCI USB devices, set USB device 13h,
function 0 register 51h, bit 0,
Sample Program
UsbOverCurrentDetectionDisable proc near
push eax ; Save registers used by this device
push dx
mov dx,0CF8h ; PCI configuration space index register
mov eax,8000A850h ; Device 13h, function 0, register 50h-53h
out dx,eax
The C3 support depends on the processor PBE support and HyperThreading. The ACPI FACP
table also needs to be modified for C3 support. The description below applies only to the SB600
registers affected by C3 support.
PM I/O register 51h is set to C3 latency as follows:
C3 Latency = (bits[5:0] of PM I/O register 51h) * 8us
Hence for recommended C3 Latency = 40us, set (bits[5:0] of PM I/O register 51h) = 5
For deep C3 support, in addition to setting register 51h above, PM I/O register 50h bit0 must also
be set to 1.
To enable the subtractive decoding, set device 14h, function 4, P2P bridge register 40h bit 5 to 1.
Sample Program:
EnableSubtractiveDecoding proc near
push eax ; Save registers used in this routine
push dx
mov dx,0CF8h
mov eax,8000A440h ; Bus 0, device 14h, function 4, register 40h, P2P
out dx,eax
mov dx,0CFCh ; To access register 40h
in al,dx
or al,20h ; Set bit 5 for subtractive decoding
out dx,al
; Set bit 7 of register 4Bh to show subtractive decoding in class code reg. 09h bit 0
mov dx,0CF8h
mov eax,8000A448h ; Bus 0, device 14h, function 4, register 48h-4Bh
out dx,eax
mov dx,0CFFh ; To access register 4Bh
in al,dx
or al,80h ; Control bit for PI register
out dx,al
SATA may be disabled/enabled by Miscellaneous SATA register located at bus 0, device 14h,
function 0, register ADh. Bit 0 of this register, when set to 1, enables SATA.
Sample Program:
This sample program will enable SATA
EnableDisableSataSampleProgram proc near
push eax ; Save registers used by this routine
push dx
mov dx,0CF8h ; To access PCI configuration space
mov eax,8000A0ACh ; Register ACh to AFh of device 14h, function 0
out dx,eax
mov dx,0CFDh ; To access register 0ADh
in al,dx ; Read current value
or al,01h ; Set bit 0 to enable SATA
out dx,al ; Write the byte back
pop dx
pop eax
ret
EnableDisableSataSampleProgram endp
The SATA device may have multiple PCI class codes. Some of the class codes are as follows::
Class Base Class Code SubClass Code Programming Interface
Register 0Bh Register 0Ah Register 09h
IDE Class 01h 01h 8Fh
AHCI Class 01h 06h 01h
Raid Class 01h 04h 00h
; Write class code. Register 08 is read only and will not be modified
mov dx,0CF8h ; To access PCI configuration space
mov eax,80009008h ; Bus 0, Device 12h, Function 0 , register 08h
out dx,eax
mov dx,0CFCh ; To access dword at starting at register 08h
mov eax,01018F00h ; Reg 08 is read only. Reg 9-0b will be written
out dx,eax
For, the AC97 PCI device 14h, functions 5 or 6 may be disabled by setting bits in PM I/O register
59h. The setting of bit 0 will mask out AC97 device 14h, function 5. the setting of bit 1 will mask
out MC97 device 14h, function 6.
Any memory resources assigned to audio and modem PCI devices should also be cleared prior to
disabling these devices.
Sample Program:
The following sample program shows how to disable AC97 audio device 14h, function 5. To
disable MC97 modem device 14h, function 6, set PM I/O register bit 1.
DisableAc97Sample proc near
push eax ; Save registers used by this routine
push dx
; If AC97 audio was previously enabled, clear the memory resources assigned.
mov dx,0CD6h ; PM I/O index register
mov al, 59h ; AC97 Mask register
out dx,al
mov dx,0CD7h ; PM I/O data register
in al,dx ; Read current value
test al,01h ; Is the AC97 audio previously disabled
jnz DisableDone ; Already disabled , so exit the routine
; Clear the address at reg. 10h of AC97 device 14h, function 5 to release the resources
mov dx,0CF8h ; To access PCI configuration register
mov eax,8000A510h ; Device 14h, function 5, register 10h
out dx,eax
mov dx,0CFCh ; To access dword starting at 10h
mov eax,0 ;
out dx,eax
The memory must be in big real mode to access the USB operational registers through the 32-bit
base address register.
push eax
push dx
push ebp
push es
mov eax,00200010h
mov es:[ebp+0A4h],eax
pop es
pop ebp
pop dx
pop eax
ret
OHCI Device 13h, function 1 and 5, may be enabled/disabled by bits 1 and 5 in SMBus device
14h, function 0, register 068h.
If disable is done after BAR resources are allocated, set BAR to zero.
USB SMI enabled, when appropriate, at SMBus device 14h, function 0, register 65h, bit 7.
Sample Program:
Enable 5 OHCIs .
EnableOhciSample proc near
push eax ; Save registers used in this program
push dx
mov dx,0CF8h ; To access PCI configuration space
mov eax,8000A068h ; SMBus device 14h, function 0, register 68h
out dx,eax
mov dx,0CFCh ; To read register 068h
in al,dx ;
or al,03Eh ; Set bit [5:1] to enable OHCI
out dx,al
pop dx
pop eax
ret
EnableOhciSample endp
IDE PIO mode and timing is set through the registers 40h-43h, 4Ah-4Bh, the PIO timing is
programmed in registers 40h-43h, and PIO mode is programmed in registers 4Ah–4Bh.
The PCI IDE device is 14h, function 1.
Reg 40h Primary slave timing
Reg 41h Primary master timing
Reg 42h Secondary slave timing
Command 2 2 3 4 5
Width (cycles)
Recovery 0 2 4 7 Dh
Width
IDE multiword DMA setting is done through registers 44h to 47h. The timing for the multiword
DMA modes has two components – the command width, and the recovery width.
Sample Program:
The following Assembly language code sample programs the secondary master to multiword
DMA Mode 2 (i.e., it programs register 47h to 20h).
mov dx,0CF8h ; To access PCI configuration space, index register
mov eax,8000A144h ; Device 14h, function 1, registers 44h-47h
out dx,eax ;
mov dx,0CFFh ; To access PCI register 47h
mov al,20h ; Timing for MW DMA Mode 2
out dx,al
IDE UDMA enable/disable is set through register 54h, and the UDMA mode is set through the
registers 56h-57h. The register assignments are as follows:
Register 54h, bit[0] Primary master. 1 = Enable, 0 = Disable
Register 54h, bit[1] Primary slave. 1 = Enable, 0 = Disable
Register 54h, bit[2] Secondary master. 1 = Enable, 0 = Disable
Register 54h, bit[3] Secondary slave. 1 = Enable, 0 = Disable
Register 56h, bits[2:0] Primary master UDMA mode, 000b-110b
Register 56h, bits[6:4] Primary slave UDMA mode, 000b-110b
Register 57h, bits[2:0] Secondary master UDMA mode, 000b-110b
Register 57h, bits[6:4] Secondary slave UDMA mode, 000b-110b
pop dx
pop bx
pop eax
The primary IDE channel is enabled as power-on default. To enable an IDE channel after they
have been disabled, the BIOS must:
1. Set the IDE channel programmable logic enable bit in Reg09h.
2. Clear the IDE channel disable bit in Reg48h to enable the IDE channel.
Note: No IDE I/O port access is allowed between step (1) and step (2). It is recommended that the
BIOS execute step (2) immediately after step (1). There should be no ‘in’ instruction between two
‘out’ instructions to register 09h and 48h.
push eax
push bx
push dx
pop dx
pop bx
pop eax
CLKVALUE register
Bit 4 Bits[3:1] Duty Cycle
0 xxx 100%
1 000 Invalid
1 001 12.5%
1 010 25%
1 011 37.5%
1 100 50%
1 101 62.5%
1 110 75%
1 111 87.5%
Sample program: Clock throttling
ClockThrottleExample proc near
push ax ; Save registers used by this routine
push dx
; Enable throttling (set bit 4=1) and set duty cycle to 50%,(Set bits [3:1]=100b
in al,dx ; Read current CLKVALue
and al,0E1h ; Keep the unused bits
or al,18h ; Set bit 4 to enable and bits [3:1]=100b for 50%
out dx,al ; Write new throttling value
pop dx ; Restore registers used by this routine
pop ax
ret
ClockThrottleExample endp
This sample program assumes that the SB600 ExtEvent0 pin is connected to the lid switch.
The registers must be initialized during the boot up process. The order of initialization is not
critical. The initialization may be done in the BIOS at any stage of the boot up process after
GPE0 block is set in PMIO registers 28h,29h).
; Select EvtEvent0 as ACPI pin by setting device 14h, function 0, register 66h, bit 6 = 1
mov eax,8000A064h ; To access registers 64h-67h
mov dx,0CF8h ; PCI index register
out dx,eax
mov dx,0CFEh ; PCI data register for 66h
in al,dx ; Read current value
or al,40h ; Set bit 6
out dx,al
; Program ExtEvent0 trigger polarity to 0 (falling edge trigger ) to indicate lid open .
; Clear PMIO register 37h, bit 0 = 0
Device(PRID) {
Name(_ADR, 0) // IDE Primary Channel
Method(_STA,0){
if (\_SB_.PCI0.SATA.CST0) { //If SATA detected
return(0x0f)
}
else {
return (0x00)
}
} End of Method (_STA )
} // End of P_D0
} // End of PRID
Device(SECD) {
Name(_ADR, 1) // IDE Secondary Channel
Device(S_D0) {
Name(_ADR, 0) // Drive 0 - Master
Method(_STA,0){
if (\_SB_.PCI0.SATA.CST1) { // If SATA detected
return(0x0f)
}
else {
return (0x00)
} /
} // End of Method (_STA)
} // End of S_D0
} // End of SECD
} // End of Scope(_SB.PCI0.SATA)
Scope(\_SB_.PCI0.SAT2)
{
OperationRegion(BAR5, SystemMemory, 0xFFF80000, 0x1000) // Replace
//address in BIOS
Field(BAR5, AnyAcc, NoLock, Preserve)
{
Offset(0x104), //Channel 0
CSTX, 1, // Device detected but no communication with Phy
CST0, 1, // Communication with PHY established
Offset(0x10A), // Channel 0
STA0, 1, // Change in PHY status
Offset(0x184), // Channel 1
CSTY, 1, // Device detected but no communication
// with PHY
CST1, 1, // Communication with PHY established
Offset(0x18A), //Channel 1
STA1, 1, // Change in PHY status
} // End of Field
Device(PRID) {
Device(P_D0) {
Name(_ADR, 0) // Drive 0 - Master
Method(_STA,0){
if (\_SB_.PCI0.SAT2.CST0) { // If SATA detected
return(0x0f)
}
else {
return (0x00)
}
} // End of Method(_STA)
} // End of P_D0
} // End of PRID
Device(SECD) {
Name(_ADR, 1) // IDE Secondary Channel
Device(S_D0) {
Name(_ADR, 0) // Drive 0 - Master
Method(_STA,0){
if (\_SB_.PCI0.SAT2.CST1) { // If SATA detected
return(0x0f)
}
else {
return (0x00)
}
} //End of Method(_STA)
} // End of S_D0
} // End of SECD
} // End of Scope(\_SB_.PCI0.SAT2)
The discussion below assumes that an ITE-8712 Super I/O is present in the system and is
connected to the thermal diode to measure temperature-1 and temperature-2, and a thermistor to
measure temperature-3. This code example shows thermal programming in the Super I/O, and
SMI programming related to thermal shutdown.
Please refer to ITE-8712 Super I/O device manual for register details.
This code example assumes that the GP47 from Super I/O is connected to the ExtEvent1 pin on
the SB600.
ITE 8712 Super I/O registers are set during the boot up process through the BIOS program.
; Define equates for index/data, shutdown temperature, and Super I/O access port.
; Enable the access to device 04 registers, i.e. set Super I/O address register to 04
; Device 04 is the Environment controller
mov dx,2Eh
mov dx,60h
out dx,al
mov dx,2Eh
mov dx,61h
out dx,al
mov dx,Sensor_Port+1
mov al,7fh ; Lower limit of 7Fh to enable the comparator mode
out dx,al
mov al,07h
mov dx,SuperIo_Config_Port
out dx,al
mov al,07h
inc dx
out dx,al
mov al,0f4h
mov dx,SuperIo_Config_Port
out dx,al
inc dx
mov al,27h
out dx,al
mov al,0f5h
mov dx,SuperIo_Config_Port
out dx,al
inc dx
mov al,27h
out dx,al
mov al,0f0h
mov dx,SuperIo_Config_Port
out dx,al
inc dx
in al,dx
or al,10h
out dx,al
mov dx,0cd6h
mov al,32h
out dx,al
mov dx,0cd7h
in al,dx
and al,0f3h ; Clear bits 3:2
or al,04h ; Set [3:2] = 01 for SMI
out dx,al
; Set ExtEvent1 for SMI, negative edge through PMIO register 37h, bit 1 = 0
mov dx,0cd6h
mov al,37h
out dx,al
mov dx,0cd7h
in al,dx
and al,0fdh ; Clear bit 1 for Negative edge
out dx,al
mov dx,0cd6h
mov al,04h
out dx,al
mov dx,0cd7h
in al,dx
or al,02h
out dx,al
The SMI programming should shut down the system when the line connected to Super I/O for
temperature over run is set.
; Check ExtEvent1 status. The ExtEvent1 status is on the PMIO register 07h, bit 1
mov dx,0cd6h
mov al,07h
out dx,al
mov dx,0cd7h
in al,dx
test al,02h ; Bit 1 for ExtEvent1
jnz ShutDownFromTalert ; ExtEvent1 is set, shut down
mov dx,0cd6h
mov dl,3ah
out dx,al
mov dx,0cd7h
in al,dx
test al,02h
jz NoShutDown
ShutDownFromTalert:
mov dx,PM1a_CNT_BLK+1
mov al,34h ; Set S5 status
out dx,al
jmp $
NoShutDown:
The following example implements Sleep SMI Control Register enable by the ASL code _PTS
method.
Method(_PTS, 1) {
Store(One, \_SB.PCI0.SMBS.SLPS)
PTS(Arg0)
Store(0, Index(WAKP,0)) // Clear Wake up package.
Store(0, Index(WAKP,1)) // Clear Wake up package.
}
OperationRegion (PMIO, SystemIO, 0xCD6, 0x2)
Field (PMIO, ByteAcc, NoLock, Preserve)
{
INPM,8,
DAPM,8
}
;************************************************************************
; ATI_SB_Cfg_Azalia *
; *
; Configure HD Audios *
; *
; Input: EBP = 0 *
; ES = 0 *
; *
;************************************************************************
; OEMs may have a CMOS setup option for HD Audio clock source.
; The options may be USB 48 MHz or HD Audio 48 MHz
; Device 14h, function 2, register 43h, bit 0 = 1 for HD Audio clock.
; OEM may have CMOS setup for HD Audio snoop (0= Disable, 1=Enable)
; Device 14h, function 2, register 42, bits 1 and 0 control snoop option
; First declare all the lines as GPIO lines by setting index 00 to all 1's.
; Then read the input status of these line at index 02
; If the line is 1, it is guaranteed not to be HD Audio
; This step is necessary because after S4 resume from ring, the AC-97 gives same status as HD Audio
; Interrupt routing table for HD Audio is at SMBUS ( Dev 14h, func 0) register 63h
; Attempt to exit the reset state. This is done by command to exit the reset state and waiting
; for status of ready to begin operation.
mov ecx, 10 ; Make up to 10 attempt to exit reset state
re_do_reset:
and bx, BIT15+BIT14 ; Clear bit0-13
or Byte PTR ES:[ebx+08h], BIT0 ; Exit the reset state
call ATI_fixed_delay_1ms_far ; Wait 1ms
test Byte PTR ES:[ebx+08h], BIT0 ; Read of 1 = Ready to begin operation
jnz @f ; Go if reset bit is set
loop re_do_reset ; Wait until ready to begin operation
jmp ATI_SB_Cfg_Azalia_exit ; Exit because reset bit can not be set
@@:
call ATI_fixed_delay_1ms_far ; Wait 1ms
DisableAzaliaController:
At_least_one_azalia:
mov dl, al
; After resume from S4 through ring, the AC97 lines give same status as HD Audio
; It is necessary to remove HD Audio status from those bits. The AC-97 ring resume status is in register
; DI[3:0]
mov cl, 0
test_SDI:
test dl, BIT0 ; Test for specific codec present
jnz configure_Azalia_channel ; Jump, codec is present
test_next_SDI:
shr dl, 1 ; Get next codec present
inc cl ; Update the codec Channel number
cmp cl, 4 ; Completed all channels
je re_do_clear_reset ; Yes, jump. Reset the controller and exit
jmp test_SDI ; Do the next codec
re_do_clear_reset:
and Byte PTR ES:[ebx+08h], NOT (BIT0) ; Controller transition to reset state
test Byte PTR ES:[ebx+08h], (BIT0) ; Test the reset status. 0 = Controller in reset state
jnz re_do_clear_reset ; If 1, wait to enter reset state
ATI_SB_Cfg_Azalia_exit:
popad
ret
ATI_SB_Cfg_Azalia ENDP
;*******************************************************************************
; ATI_SB_Cfg_Azalia_Pin_CMD *
; *
; Configure each codec pin *
; *
; Input: cl, = channel number *
; ebx = Memory mapped configuration register address *
; *
;********************************************************************************
pushad
; OEM may have CMOS setup option for Pin Configuration (0= Disable, 1=Enable)
shl ecx, 28
mov eax, 0F0000h ; Read IDs command
or eax, ecx
mov Dword PTR ES:[ebx+60h], eax ; Immediate command output register
; OEM may have a CMOS setup selection for Front panel audio (0=Auto, 1=Disable)
; Front panel option is Auto. GPIO9 detects the front panel audio in the SB600, and GPIO8 detects the
front panel audio in SB460.
;Check whether SB460?Call DetectSB460
Jz SB460_Chip ;jmp if SB460
jmp DetectFrontPanelAudio
SB460_Chip:
;Control comes here if SB460
; Set GPIO8 as input through SMBus (Dev 14h, func 0) register A9h, bit 4
; Read GPIO8 through SMBus (Dev 14h, func 9) register AAh, bit 4
or Byte PTR es:[ebp+ATI_PCIE_BAR3+ATI_SMBUS_BUS_DEV_FUN shl 12 + 0A9h], BIT4
; Set GPIO8 Input
test Byte PTR es:[ebp+ATI_PCIE_BAR3+ATI_SMBUS_BUS_DEV_FUN shl 12 + 0AAh], BIT4
; GPIO8 0:connected 1:not
DetectFrontPanelAudio:
jnz loop_Immediat_Command_Output_Interface ; Jump, Front Panel audio is not present
; Front panel audio is present. Extend the end pointer to include front panel commands
mov di, offset Azalia_Codec_Table_FP_Enable_end
loop_Immediat_Command_Output_Interface:
cmp si, di ; End of table?
je ATI_SB_Cfg_Azalia_Pin_CMD_exit ; Jump at the end of the command
test_again:
test Byte PTR ES:[ebx+68h], BIT0 ; Immediate command status register
ATI_SB_Cfg_Azalia_Pin_CMD_exit:
popad
ret
ATI_SB_Cfg_Azalia_Pin_CMD ENDP
;************************************************************************
: ATI_SB_Cfg_Azalia_Delay *
; *
; Wait about 30 uSec *
; *
: Input : None *
;************************************************************************
;***********************************************************************
; ATI_Fixed_delay_1ms_FAR *
; *
; Delay for approx 1 mSec *
; *
; Input: None *
;************************************************************************
PUBLIC ATI_fixed_delay_1ms_FAR
ATI_fixed_delay_1ms_FAR PROC FAR
push cx
mov cx, 1000/15
call ATI_fixed_delay
pop cx
ret
ATI_fixed_delay_1ms_FAR ENDP
;************************************************************************
; ATI_fixed_delay_far *
push ax
fixed_delay_1:
in al, 61h ; refresh_port
test al, 00010000b
jz fixed_delay_1
dec cx
jz fixed_delay_2
fixed_delay_3:
in al, 61h ; refresh_port
test al, 00010000b
jnz fixed_delay_3
dec cx
jnz fixed_delay_1
fixed_delay_2:
pop ax
ret
ATI_fixed_delay ENDP
Azalia_Codec_Table_Start:
dd 01471C10h
dd 01471D40h
dd 01471E01h
dd 01471F01h
dd 01571C11h
dd 01571D10h
dd 01571E01h
dd 01571F01h
dd 01671C12h
dd 01671D60h
dd 01671E01h
dd 01671F01h
dd 01771C13h
dd 01771D20h
dd 01771E01h
dd 01771F01h
dd 01871C30h
dd 01871D91h
dd 01871Ea1h
dd 01871F01h
dd 01971C00h
dd 01971D00h
dd 01971E00h
dd 01971F40h
dd 01a71C31h
dd 01a71D31h