示例#1
0
文件: pci.c 项目: 12019/hg556a_source
int sn_read_config(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val)
{
	unsigned long res = 0;
	vertex_hdl_t device_vertex;

	device_vertex = devfn_to_vertex(bus->number, devfn);

	if (!device_vertex)
		return PCIBIOS_DEVICE_NOT_FOUND;

	res = pciio_config_get(device_vertex, (unsigned)where, size);
	*val = (u32)res;
	return PCIBIOS_SUCCESSFUL;
}
示例#2
0
文件: pci.c 项目: TitaniumBoy/lin
/*
 * snia64_read_config_word - Read 2 bytes from the config area of the device.
 */
static int snia64_read_config_word (struct pci_dev *dev,
                                   int where, unsigned short *val)
{
	unsigned long res = 0;
	unsigned size = 2; /* 2 bytes */
	devfs_handle_t device_vertex;

	if ( (dev == (struct pci_dev *)0) || (val == (unsigned short *)0) ) {
		return PCIBIOS_DEVICE_NOT_FOUND;
	}
	device_vertex = devfn_to_vertex(dev->bus->number, dev->devfn);
	if (!device_vertex) {
		DBG("%s : nonexistent device: bus= 0x%x  slot= 0x%x  func= 0x%x\n", 
		__FUNCTION__, dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
		return(-1);
	}
	res = pciio_config_get(device_vertex, (unsigned) where, size);
	*val = (unsigned short) res;
	return PCIBIOS_SUCCESSFUL;
}