?? pci_init.c
字號:
/*
pci_init.c
pci_init()
*/
#include <stdtypes.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <amcclib.h>
#include <lib.h>
extern CHAR errstring[];
UINT8 pci_init( struct _chip *chip, UINT16 index, UINT16 dev_id, UINT16 ven_id )
/* Locate a chip and set up a chip structure, including base addresses
BUT NOT region sizes (must be done by call to "parse()" ).
This is because pci_init may be called by code that is testing
nvRAM, and parse() needs to read nvRAM to get region sizes
from the nvRAM.
Only matches device ID and vendor ID. If you want to also match
the subsystem vendor ID and subsystem ID, use "findchip()".
Return: 0 if OK and chip structure updated...
base address registers
index
1 = PCI BIOS not found
2 = device not found
Caller should probably also set up chip.type as AMCC_5920/5933
Fatal exit if PCI BIOS call fails.
*/
{
UINT8 ch;
int i, status;
if (pciBiosPresent(&ch,NULL,NULL))
{
if (pciFindDevice(dev_id, ven_id, index, &chip->bus, &chip->device) == PCI_SUCCESSFUL)
{
chip->index = index;
// stuff base addresses...
for( i = 0; i < NUM_BASE_REGIONS; i++ )
{
status = pci_config_read32( chip, \
PCI_CS_BASE_ADDRESS_0 + (i*4), \
&chip->reg[i].base );
if ( status != PCI_SUCCESSFUL )
{
pci_bios_fail( status );
printf( errstring );
exit(1);
}
}
return 0;
}
return 2; // device not found
}
return 1; // no PCI BIOS
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -