SpdRead.c
/*
* SpdRead.c
*
* Created on: 2017年11月17日
* Author:
*/
#include <Uefi.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/IoLib.h>
#include <Library/UefiLIb.h>
#include "UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.h"
#define SMBUS_IO_PORT 0x5040
#define SLAVE_ADDR 0xA8
#define PCI_CONFIG_ADDRESS 0x8000FB20//bus 0 dev 31 fun 3 reg 20h
#define PCI_INDEX_IO_PORT 0xCF8
#define PCI_DATA_IO_PORT 0xCFC
UINT32 FindSmBusDev()
{
UINT8 Bus;
UINT8 Dev;
UINT8 Fun;
UINT32 Addr;
Addr = 0x80000000;
for(Bus = 0x00; Bus < 0xFF; Bus++) {
for(Dev = 0x00; Dev <= 0x1F; Dev++) {
for(Fun = 0x00; Fun <= 0x07; Fun++) {
Addr &= 0xFF000000;//clean the address
Addr |= ((Bus << 16) | (Dev << 11) | (Fun << 8));//set the pci bus dev and fun