Esempio n. 1
0
File: pci.c Progetto: 3a9LL/panda
void
pci_setup(void)
{
  uint32_t io_base = 0xc000;
  uint32_t mem_base = 256 * 1024 * 1024;
  int bdf, max;

  foreachpci (bdf, max)
    pci_setup_device(bdf, &io_base, &mem_base);
}
Esempio n. 2
0
void __init pcibios_fixup(void)
{
    struct pci_dev *dev;
    pci_for_each_dev(dev) {
		/* <TDT> Our enable_device sets up bios data for the bootrom does not */
		brcm_pcibios_fixup_device(dev);

		/* <TDT> force a rescan in case we still need bios data */
		pci_setup_device(dev);
}
	}
void e1000_dev_init(struct pci_func *pcif) {
	memset(&e1000_dev, 0, sizeof(struct pci_dev));


	e1000_dev.vendor = PCI_VENDOR(pcif->dev_id);
    e1000_dev.device = PCI_PRODUCT(pcif->dev_id);

    e1000_dev.devfn = (pcif->dev << 3) + pcif->func;
    e1000_dev.dev.init_name = e1000_dev_name;
	
    pci_setup_device(&e1000_dev);

}
Esempio n. 4
0
/* Builds the basic pci_dev for SiS645 SMBus
 */
static int __devinit sis645_build_dev(struct pci_dev **smbus_dev,
			    struct pci_dev *bridge_dev)
{
	struct pci_dev temp_dev;
	u16 vid = 0, did = 0;
	int ret;

	/* fill in the device structure for search */
	memset(&temp_dev, 0, sizeof(temp_dev));
	temp_dev.bus = bridge_dev->bus;
	temp_dev.sysdata = bridge_dev->bus->sysdata;
	temp_dev.hdr_type = PCI_HEADER_TYPE_NORMAL;

	/* the SMBus device is function 1 on the same unit as the ISA bridge */
	temp_dev.devfn = bridge_dev->devfn + 1;

	/* query to make sure */
	ret = pci_read_config_word(&temp_dev, PCI_VENDOR_ID, &vid);
	if (ret || PCI_VENDOR_ID_SI != vid) {
		printk(KERN_ERR DRV_NAME ": Couldn't find SMBus device!\n");
		return ret;
	}
	temp_dev.vendor = vid;

	ret = pci_read_config_word(&temp_dev, PCI_DEVICE_ID, &did);
	if (ret || PCI_DEVICE_ID_SI_SMBUS != did) {
		printk(KERN_ERR DRV_NAME ": Couldn't find SMBus device!\n");
		return ret;
	}
	temp_dev.device = did;

	/* ok, we've got it... request some memory and finish it off */
	*smbus_dev = kmalloc(sizeof(**smbus_dev), GFP_ATOMIC);
	if (NULL == *smbus_dev) {
		printk(KERN_ERR DRV_NAME ": Out of memory!\n");
		return -ENOMEM;
	}

	**smbus_dev = temp_dev;
	
	ret = pci_setup_device(*smbus_dev);
	if (ret) {
		printk(KERN_ERR DRV_NAME ": pci_setup_device failed (0x%08x)\n",ret);
	}
	return ret;
}
Esempio n. 5
0
void	*FindPCI1750Card(void)
{
	int		iFound = 0;
	struct pci_dev	*pDevice = NULL;

	if (pcibios_present())
	{
		while((pDevice = pci_find_device(0x13fe, 1750, pDevice)))
		{
			pci_setup_device(pDevice);

			if (pci_request_region(pDevice, 2, "plc_labcard") == 0)
				iFound = 1;

			break;
		}
	}


	if (iFound)
		return ((void *)pDevice);
	
	return NULL;
}