#include "sis966.h"
-uint8_t SiS_SiS191_init[6][3]={
+u8 SiS_SiS191_init[6][3]={
{0x04, 0xFF, 0x07},
{0x2C, 0xFF, 0x39},
{0x2D, 0xFF, 0x10},
#define TRUE 1
#define FALSE 0
-uint16_t MacAddr[3];
+u16 MacAddr[3];
-void writeApcByte(int addr, uint8_t value)
+static void writeApcByte(int addr, u8 value)
{
outb(addr,0x78);
outb(value,0x79);
}
-uint8_t readApcByte(int addr)
+
+static u8 readApcByte(int addr)
{
- uint8_t value;
+ u8 value;
outb(addr,0x78);
value=inb(0x79);
return(value);
static void readApcMacAddr(void)
{
- uint8_t i;
+ u8 i;
// enable APC in south bridge sis966 D2F0
outl(0x80001048,0xcf8);
outl((inl(0xcfc) & 0xfffffffd),0xcfc ); // enable IO78/79h for APC Index/Data
- printk_debug("MAC addr in APC = ");
+ printk(BIOS_DEBUG, "MAC addr in APC = ");
for(i = 0x9 ; i <=0xe ; i++)
{
- printk_debug("%2.2x",readApcByte(i));
+ printk(BIOS_DEBUG, "%2.2x",readApcByte(i));
}
- printk_debug("\n");
+ printk(BIOS_DEBUG, "\n");
/* Set APC Reload */
writeApcByte(0x7,readApcByte(0x7)&0xf7);
static void set_apc(struct device *dev)
{
- uint16_t addr;
- uint16_t i;
- uint8_t bTmp;
+ u16 addr;
+ u16 i;
+ u8 bTmp;
/* enable APC in south bridge sis966 D2F0 */
outl(0x80001048,0xcf8);
for(i = 0 ; i <3; i++)
{
addr=0x9+2*i;
- writeApcByte(addr,(uint8_t)(MacAddr[i]&0xFF));
- writeApcByte(addr+1L,(uint8_t)((MacAddr[i]>>8)&0xFF));
+ writeApcByte(addr,(u8)(MacAddr[i]&0xFF));
+ writeApcByte(addr+1L,(u8)((MacAddr[i]>>8)&0xFF));
// printf("%x - ",readMacAddrByte(0x59+i));
}
pci_write_config8(dev, 0x73, bTmp);
}
-//-----------------------------------------------------------------------------
-// Procedure: ReadEEprom
-//
-// Description: This routine serially reads one word out of the EEPROM.
-//
-// Arguments:
-// Reg - EEPROM word to read.
-//
-// Returns:
-// Contents of EEPROM word (Reg).
-//-----------------------------------------------------------------------------
+/**
+ * Read one word out of the serial EEPROM.
+ *
+ * @param dev TODO
+ * @param base TODO
+ * @param Reg EEPROM word to read.
+ * @return Contents of EEPROM word (Reg).
+ */
#define LoopNum 200
-static unsigned long ReadEEprom( struct device *dev, uint32_t base, uint32_t Reg)
+static unsigned long ReadEEprom( struct device *dev, u32 base, u32 Reg)
{
- uint32_t data;
- uint32_t i;
- uint32_t ulValue;
+ u32 data;
+ u32 i;
+ u32 ulValue;
ulValue = (0x80 | (0x2 << 8) | (Reg << 10)); //BIT_7
return data;
}
-static int phy_read(uint32_t base, unsigned phy_addr, unsigned phy_reg)
+static int phy_read(u32 base, unsigned phy_addr, unsigned phy_reg)
{
- uint32_t ulValue;
- uint32_t Read_Cmd;
- uint16_t usData;
+ u32 ulValue;
+ u32 Read_Cmd;
+ u16 usData;
mdelay(20);
ulValue = read32(base+0x44);
} while((ulValue & SMI_REQUEST) != 0);
- //printk_debug("base %x cmd %lx ret val %lx\n", tmp,Read_Cmd,ulValue);
+ //printk(BIOS_DEBUG, "base %x cmd %lx ret val %lx\n", tmp,Read_Cmd,ulValue);
usData=(ulValue>>16);
// Detect a valid PHY
// If there exist a valid PHY then return TRUE, else return FALSE
-static int phy_detect(uint32_t base,uint16_t *PhyAddr) //BOOL PHY_Detect()
+static int phy_detect(u32 base,u16 *PhyAddr) //BOOL PHY_Detect()
{
int bFoundPhy = FALSE;
- uint16_t usData;
+ u16 usData;
int PhyAddress = 0;
if(!bFoundPhy)
{
- printk_debug("PHY not found !!!! \n");
+ printk(BIOS_DEBUG, "PHY not found !!!! \n");
}
*PhyAddr=PhyAddress;
static void nic_init(struct device *dev)
{
int val;
- uint16_t PhyAddr;
- uint32_t base;
+ u16 PhyAddr;
+ u32 base;
struct resource *res;
-
print_debug("NIC_INIT:---------->\n");
-
//-------------- enable NIC (SiS19x) -------------------------
{
- uint8_t temp8;
+ u8 temp8;
int i=0;
while(SiS_SiS191_init[i][0] != 0)
{
if(!res)
{
- printk_debug("NIC Cannot find resource..\r\n");
+ printk(BIOS_DEBUG, "NIC Cannot find resource..\n");
return;
}
base = res->base;
- printk_debug("NIC base address %lx\n",base);
+ printk(BIOS_DEBUG, "NIC base address %x\n",base);
if(!(val=phy_detect(base,&PhyAddr)))
{
- printk_debug("PHY detect fail !!!!\r\n");
+ printk(BIOS_DEBUG, "PHY detect fail !!!!\n");
return;
}
// if that is valid we will use that
- printk_debug("EEPROM contents %x \n",ReadEEprom( dev, base, 0LL));
+ printk(BIOS_DEBUG, "EEPROM contents %lx \n",ReadEEprom( dev, base, 0LL));
for(i=0;i<3;i++) {
//status = smbus_read_byte(dev_eeprom, i);
ulValue=ReadEEprom( dev, base, i+3L);
}
}else{
// read MAC address from firmware
- printk_debug("EEPROM invalid!!\nReg 0x38h=%.8lx \n",ulValue);
+ printk(BIOS_DEBUG, "EEPROM invalid!!\nReg 0x38h=%.8lx \n",ulValue);
MacAddr[0]=read16(0xffffffc0); // mac address store at here
MacAddr[1]=read16(0xffffffc2);
MacAddr[2]=read16(0xffffffc4);
for(i=0;i<0xff;i+=4){
if((i%16)==0){
- print_debug("\r\n");
+ print_debug("\n");
print_debug_hex8(i);
print_debug(": ");
}
print_debug_hex32(pci_read_config32(dev,i));
print_debug(" ");
}
- print_debug("\r\n");
+ print_debug("\n");
}