本文整理汇总了C++中pci_find_device函数的典型用法代码示例。如果您正苦于以下问题:C++ pci_find_device函数的具体用法?C++ pci_find_device怎么用?C++ pci_find_device使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pci_find_device函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: init_nm256
int __init
init_nm256(void)
{
struct pci_dev *pcidev = NULL;
int count = 0;
if(! pci_present())
return -ENODEV;
while((pcidev = pci_find_device(PCI_VENDOR_ID_NEOMAGIC,
PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO,
pcidev)) != NULL) {
count += nm256_install(pcidev, REV_NM256AV, "256AV");
}
while((pcidev = pci_find_device(PCI_VENDOR_ID_NEOMAGIC,
PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO,
pcidev)) != NULL) {
count += nm256_install(pcidev, REV_NM256ZX, "256ZX");
}
if (count == 0)
return -ENODEV;
printk (KERN_INFO "Done installing NM256 audio driver.\n");
return 0;
}
开发者ID:dmgerman,项目名称:original,代码行数:27,代码来源:nm256_audio.c
示例2: pplus_pib_init
void __init
pplus_pib_init(void)
{
unsigned char reg;
unsigned short short_reg;
struct pci_dev *dev = NULL;
/*
* Perform specific configuration for the Via Tech or
* or Winbond PCI-ISA-Bridge part.
*/
if ((dev = pci_find_device(PCI_VENDOR_ID_VIA,
PCI_DEVICE_ID_VIA_82C586_1, dev))) {
/*
* PPCBUG does not set the enable bits
* for the IDE device. Force them on here.
*/
pci_read_config_byte(dev, 0x40, ®);
reg |= 0x03; /* IDE: Chip Enable Bits */
pci_write_config_byte(dev, 0x40, reg);
}
if ((dev = pci_find_device(PCI_VENDOR_ID_VIA,
PCI_DEVICE_ID_VIA_82C586_2,
dev)) && (dev->devfn = 0x5a)) {
/* Force correct USB interrupt */
dev->irq = 11;
pci_write_config_byte(dev,
PCI_INTERRUPT_LINE,
dev->irq);
}
if ((dev = pci_find_device(PCI_VENDOR_ID_WINBOND,
PCI_DEVICE_ID_WINBOND_83C553, dev))) {
/* Clear PCI Interrupt Routing Control Register. */
short_reg = 0x0000;
pci_write_config_word(dev, 0x44, short_reg);
/* Route IDE interrupts to IRQ 14 */
reg = 0xEE;
pci_write_config_byte(dev, 0x43, reg);
}
if ((dev = pci_find_device(PCI_VENDOR_ID_WINBOND,
PCI_DEVICE_ID_WINBOND_82C105, dev))){
/*
* Disable LEGIRQ mode so PCI INTS are routed
* directly to the 8259 and enable both channels
*/
pci_write_config_dword(dev, 0x40, 0x10ff0033);
/* Force correct IDE interrupt */
dev->irq = 14;
pci_write_config_byte(dev,
PCI_INTERRUPT_LINE,
dev->irq);
}
}
开发者ID:Picture-Elements,项目名称:linux-2.4-peijse,代码行数:57,代码来源:pplus_pci.c
示例3: pcibios_fixup_bus
void __init
pcibios_fixup_bus(struct pci_bus *b)
{
struct list_head *ln;
struct pci_dev *d;
struct resource *res;
int pos, size;
u32 *base;
u8 irq;
printk("PCI: Fixing up bus %d\n", b->number);
/* Fix up SB */
if (b->number == 0) {
for (ln = b->devices.next; ln != &b->devices; ln = ln->next) {
d = pci_dev_b(ln);
/* Fix up interrupt lines */
pci_read_config_byte(d, PCI_INTERRUPT_LINE, &irq);
d->irq = irq + 2;
pci_write_config_byte(d, PCI_INTERRUPT_LINE, d->irq);
}
}
/* Fix up external PCI */
else {
for (ln = b->devices.next; ln != &b->devices; ln = ln->next) {
d = pci_dev_b(ln);
/* Fix up resource bases */
for (pos = 0; pos < 6; pos++) {
res = &d->resource[pos];
base = (res->flags & IORESOURCE_IO) ? &pci_iobase : ((b->number == 2) ? &pcmcia_membase : &pci_membase);
if (res->end) {
size = res->end - res->start + 1;
if (*base & (size - 1))
*base = (*base + size) & ~(size - 1);
res->start = *base;
res->end = res->start + size - 1;
*base += size;
pci_write_config_dword(d,
PCI_BASE_ADDRESS_0 + (pos << 2), res->start);
}
/* Fix up PCI bridge BAR0 only */
if (b->number == 1 && PCI_SLOT(d->devfn) == 0)
break;
}
/* Fix up interrupt lines */
if (pci_find_device(VENDOR_BROADCOM, SB_PCI, NULL))
d->irq = (pci_find_device(VENDOR_BROADCOM, SB_PCI, NULL))->irq;
pci_write_config_byte(d, PCI_INTERRUPT_LINE, d->irq);
}
}
}
开发者ID:anchowee,项目名称:linino,代码行数:52,代码来源:pcibios.c
示例4: bcm947xx_fixup
static void bcm947xx_fixup(struct pci_dev *d)
{
struct pci_bus *b;
struct list_head *ln;
struct resource *res;
int pos, size;
u32 *base;
b = d->bus;
/* Fix up external PCI */
if (b->number != 0) {
for (ln = b->devices.next; ln != &b->devices;
ln = ln->next) {
d = pci_dev_b(ln);
/* Fix up resource bases */
for (pos = 0; pos < 4; pos++) {
res = &d->resource[pos];
base =
(res->
flags & IORESOURCE_IO) ? &pci_iobase :
&pci_membase;
if (res->end) {
size = res->end - res->start + 1;
if (*base & (size - 1))
*base =
(*base +
size) & ~(size - 1);
res->start = *base;
res->end = res->start + size - 1;
*base += size;
pci_write_config_dword(d,
PCI_BASE_ADDRESS_0
+
(pos << 2),
res->start);
}
/* Fix up PCI bridge BAR0 only */
if (b->number == 1
&& PCI_SLOT(d->devfn) == 0)
break;
}
/* Fix up interrupt lines */
if (pci_find_device(VENDOR_BROADCOM, SB_PCI, NULL))
d->irq =
(pci_find_device
(VENDOR_BROADCOM, SB_PCI, NULL))->irq;
pci_write_config_byte(d, PCI_INTERRUPT_LINE,
d->irq);
}
}
}
开发者ID:prime5711,项目名称:blackbox,代码行数:52,代码来源:fixup-bcm94704.c
示例5: prpmc750_pcibios_fixup
static void __init prpmc750_pcibios_fixup(void)
{
struct pci_dev *dev;
unsigned short wtmp;
/*
* Kludge to clean up after PPC6BUG which doesn't
* configure the CL5446 VGA card. Also the
* resource subsystem doesn't fixup the
* PCI mem resources on the CL5446.
*/
if ((dev = pci_find_device(PCI_VENDOR_ID_CIRRUS,
PCI_DEVICE_ID_CIRRUS_5446, 0))) {
dev->resource[0].start += PRPMC750_PCI_PHY_MEM_OFFSET;
dev->resource[0].end += PRPMC750_PCI_PHY_MEM_OFFSET;
pci_read_config_word(dev, PCI_COMMAND, &wtmp);
pci_write_config_word(dev, PCI_COMMAND, wtmp | 3);
/* Enable Color mode in MISC reg */
outb(0x03, 0x3c2);
/* Select DRAM config reg */
outb(0x0f, 0x3c4);
/* Set proper DRAM config */
outb(0xdf, 0x3c5);
}
}
开发者ID:BackupTheBerlios,项目名称:tuxap,代码行数:25,代码来源:prpmc750.c
示例6: get_pci_addr
int get_pci_addr(unsigned int vendor, unsigned int device, unsigned int addr_mat[])
{
struct pci_dev *pdev=NULL;
unsigned int base_pci, base_status, base_adc, base_dio, base_dac;
pdev=pci_find_device(vendor,device,pdev);
if(pdev) {
pci_read_config_dword(pdev,PCI_BASE_ADDRESS_0, &base_pci);
pci_read_config_dword(pdev,PCI_BASE_ADDRESS_1, &base_status);
pci_read_config_dword(pdev,PCI_BASE_ADDRESS_2, &base_adc);
pci_read_config_dword(pdev,PCI_BASE_ADDRESS_3, &base_dio);
pci_read_config_dword(pdev,PCI_BASE_ADDRESS_4, &base_dac);
base_pci &= PCI_BASE_ADDRESS_IO_MASK;
base_status &= PCI_BASE_ADDRESS_IO_MASK;
base_adc &= PCI_BASE_ADDRESS_IO_MASK;
base_dio &= PCI_BASE_ADDRESS_IO_MASK;
base_dac &= PCI_BASE_ADDRESS_IO_MASK;
addr_mat[0]=base_pci;
addr_mat[1]=base_status;
addr_mat[2]=base_adc;
addr_mat[3]=base_dio;
addr_mat[4]=base_dac;
}
return 0;
}
开发者ID:sensysnetworks,项目名称:stromboli-24.1,代码行数:27,代码来源:krt_pci.c
示例7: piix4_apmc_smm_init
// This code is hardcoded for PIIX4 Power Management device.
static void piix4_apmc_smm_init(struct pci_device *pci, void *arg)
{
struct pci_device *i440_pci = pci_find_device(PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_82441);
if (!i440_pci)
return;
/* check if SMM init is already done */
u32 value = pci_config_readl(pci->bdf, PIIX_DEVACTB);
if (value & PIIX_APMC_EN)
return;
/* enable the SMM memory window */
pci_config_writeb(i440_pci->bdf, I440FX_SMRAM, 0x02 | 0x48);
smm_save_and_copy();
/* enable SMI generation when writing to the APMC register */
pci_config_writel(pci->bdf, PIIX_DEVACTB, value | PIIX_APMC_EN);
smm_relocate_and_restore();
/* close the SMM memory window and enable normal SMM */
pci_config_writeb(i440_pci->bdf, I440FX_SMRAM, 0x02 | 0x08);
}
开发者ID:3a9LL,项目名称:panda,代码行数:26,代码来源:smm.c
示例8: ide_preinit
int ide_preinit (void)
{
int status;
pci_dev_t devbusfn;
int l;
status = 1;
for (l = 0; l < CFG_IDE_MAXBUS; l++) {
ide_bus_offset[l] = -ATA_STATUS;
}
devbusfn = pci_find_device (0x1103, 0x0004, 0);
if (devbusfn != -1) {
status = 0;
pci_read_config_dword (devbusfn, PCI_BASE_ADDRESS_0,
(u32 *) & ide_bus_offset[0]);
ide_bus_offset[0] &= 0xfffffffe;
ide_bus_offset[0] += CFG_PCI0_IO_SPACE;
pci_read_config_dword (devbusfn, PCI_BASE_ADDRESS_2,
(u32 *) & ide_bus_offset[1]);
ide_bus_offset[1] &= 0xfffffffe;
ide_bus_offset[1] += CFG_PCI0_IO_SPACE;
}
return (status);
}
开发者ID:A1DEVS,项目名称:lenovo_a1_07_uboot,代码行数:25,代码来源:ide.c
示例9: pci_find_device
/* a helper function to get a PCIDevice for a given mmconfig address */
static inline PCIDevice *pcie_dev_find_by_mmcfg_addr(PCIBus *s,
uint32_t mmcfg_addr)
{
return pci_find_device(s, PCIE_MMCFG_BUS(mmcfg_addr),
PCI_SLOT(PCIE_MMCFG_DEVFN(mmcfg_addr)),
PCI_FUNC(PCIE_MMCFG_DEVFN(mmcfg_addr)));
}
开发者ID:TheLoneRanger14,项目名称:vmxray,代码行数:8,代码来源:pcie_host.c
示例10: ehci_pci_ati_quirk
static void
ehci_pci_ati_quirk(device_t self, uint8_t is_sb700)
{
device_t smbdev;
uint32_t val;
if (is_sb700) {
/* Lookup SMBUS PCI device */
smbdev = pci_find_device(PCI_EHCI_VENDORID_ATI, 0x4385);
if (smbdev == NULL)
return;
val = pci_get_revid(smbdev);
if (val != 0x3a && val != 0x3b)
return;
}
/*
* Note: this bit is described as reserved in SB700
* Register Reference Guide.
*/
val = pci_read_config(self, 0x53, 1);
if (!(val & 0x8)) {
val |= 0x8;
pci_write_config(self, 0x53, val, 1);
device_printf(self, "AMD SB600/700 quirk applied\n");
}
}
开发者ID:JabirTech,项目名称:Source,代码行数:27,代码来源:ehci_pci.c
示例11: scx200_init
int __init scx200_init(void)
{
struct pci_dev *bridge;
int bank;
unsigned base;
printk(KERN_INFO NAME ": NatSemi SCx200 Driver\n");
if ((bridge = pci_find_device(PCI_VENDOR_ID_NS,
PCI_DEVICE_ID_NS_SCx200_BRIDGE,
NULL)) == NULL)
return -ENODEV;
base = pci_resource_start(bridge, 0);
printk(KERN_INFO NAME ": GPIO base 0x%x\n", base);
if (request_region(base, SCx200_GPIO_SIZE, "NatSemi SCx200 GPIO") == 0) {
printk(KERN_ERR NAME ": can't allocate I/O for GPIOs\n");
return -EBUSY;
}
scx200_gpio_base = base;
/* read the current values driven on the GPIO signals */
for (bank = 0; bank < 2; ++bank)
scx200_gpio_shadow[bank] = inl(scx200_gpio_base + 0x10 * bank);
return 0;
}
开发者ID:sarnobat,项目名称:knoppix,代码行数:29,代码来源:scx200.c
示例12: spi_init_address
void spi_init_address( void )
{
pcidev_t lpc_isa_dev;
int status;
/* Find the spi controller base address */
status = pci_find_device(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SB700_LPC, &lpc_isa_dev);
if (!status)
status = pci_find_device(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_ATI_SB900_LPC, &lpc_isa_dev);
if (!status) {
printf("ERROR: Unable to find LPC bridge. Halting!\n");
halt();
}
spi_base = pci_read_config32( lpc_isa_dev, SPI_CNTRL_BASE_ADDR_REG );
spi_base &= 0xFFFFFFE0;
}
开发者ID:byteworks-ch,项目名称:pcengines-apu-bios,代码行数:16,代码来源:spi.c
示例13: pci_drive_hot_add
int pci_drive_hot_add(Monitor *mon, const QDict *qdict,
DriveInfo *dinfo, int type)
{
int dom, pci_bus;
unsigned slot;
PCIDevice *dev;
const char *pci_addr = qdict_get_str(qdict, "pci_addr");
switch (type) {
case IF_SCSI:
if (pci_read_devaddr(mon, pci_addr, &dom, &pci_bus, &slot)) {
goto err;
}
dev = pci_find_device(pci_find_root_bus(dom), pci_bus,
PCI_DEVFN(slot, 0));
if (!dev) {
monitor_printf(mon, "no pci device with address %s\n", pci_addr);
goto err;
}
if (scsi_hot_add(mon, &dev->qdev, dinfo, 1) != 0) {
goto err;
}
break;
default:
monitor_printf(mon, "Can't hot-add drive to type %d\n", type);
goto err;
}
return 0;
err:
return -1;
}
开发者ID:CrazyXen,项目名称:XEN_CODE,代码行数:32,代码来源:pci-hotplug.c
示例14: setup_enternow_pci
/* called by config.c */
int __devinit
setup_enternow_pci(struct IsdnCard *card)
{
int ret;
struct IsdnCardState *cs = card->cs;
char tmp[64];
#ifdef __BIG_ENDIAN
#error "not running on big endian machines now"
#endif
strcpy(tmp, enternow_pci_rev);
printk(KERN_INFO "HiSax: Formula-n Europe AG enter:now ISDN PCI driver Rev. %s\n", HiSax_getrev(tmp));
if (cs->typ != ISDN_CTYPE_ENTERNOW)
return(0);
test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags);
for ( ;; )
{
if ((dev_netjet = pci_find_device(PCI_VENDOR_ID_TIGERJET,
PCI_DEVICE_ID_TIGERJET_300, dev_netjet))) {
ret = en_pci_probe(dev_netjet, cs);
if (!ret)
return(0);
} else {
printk(KERN_WARNING "enter:now PCI: No PCI card found\n");
return(0);
}
en_cs_init(card, cs);
break;
}
return en_cs_init_rest(card, cs);
}
开发者ID:appleorange1,项目名称:asus-rt-n12-lx,代码行数:36,代码来源:enternow_pci.c
示例15: pci_device_hot_remove
static int pci_device_hot_remove(Monitor *mon, const char *pci_addr)
{
PCIBus *root = pci_find_primary_bus();
PCIDevice *d;
int bus;
unsigned slot;
Error *local_err = NULL;
if (!root) {
monitor_printf(mon, "no primary PCI bus (if there are multiple"
" PCI roots, you must use device_del instead)");
return -1;
}
if (pci_read_devaddr(mon, pci_addr, &bus, &slot)) {
return -1;
}
d = pci_find_device(root, bus, PCI_DEVFN(slot, 0));
if (!d) {
monitor_printf(mon, "slot %d empty\n", slot);
return -1;
}
qdev_unplug(&d->qdev, &local_err);
if (error_is_set(&local_err)) {
monitor_printf(mon, "%s\n", error_get_pretty(local_err));
error_free(local_err);
return -1;
}
return 0;
}
开发者ID:joewaj,项目名称:qemu-sam3n,代码行数:33,代码来源:pci-hotplug-old.c
示例16: mga_driver_device_is_agp
/**
* Determine if the device really is AGP or not.
*
* In addition to the usual tests performed by \c drm_device_is_agp, this
* function detects PCI G450 cards that appear to the system exactly like
* AGP G450 cards.
*
* \param dev The device to be tested.
*
* \returns
* If the device is a PCI G450, zero is returned. Otherwise non-zero is
* returned.
*
* \bug
* This function needs to be filled in! The implementation in
* linux-core/mga_drv.c shows what needs to be done.
*/
static int mga_driver_device_is_agp(struct drm_device * dev)
{
/* There are PCI versions of the G450. These cards have the
* same PCI ID as the AGP G450, but have an additional PCI-to-PCI
* bridge chip. We detect these cards, which are not currently
* supported by this driver, by looking at the device ID of the
* bus the "card" is on. If vendor is 0x3388 (Hint Corp) and the
* device is 0x0021 (HB6 Universal PCI-PCI bridge), we reject the
* device.
*/
#if defined(__FreeBSD__)
device_t bus;
#if __FreeBSD_version >= 700010
bus = device_get_parent(device_get_parent(dev->device));
#else
bus = device_get_parent(dev->device);
#endif
if (pci_get_device(dev->device) == 0x0525 &&
pci_get_vendor(bus) == 0x3388 &&
pci_get_device(bus) == 0x0021)
#else
struct pci_attach_args pa;
if (PCI_PRODUCT(dev->pa.pa_id) == PCI_PRODUCT_MATROX_G400_AGP &&
pci_find_device(&pa, mgadev_match))
#endif
return DRM_IS_NOT_AGP;
else
return DRM_MIGHT_BE_AGP;
}
开发者ID:eyberg,项目名称:rumpkernel-netbsd-src,代码行数:48,代码来源:mga_drv.c
示例17: zuma_mbox_init
int zuma_mbox_init(void)
{
unsigned int iobase;
memset(&zuma_mbox_dev, 0, sizeof(struct _zuma_mbox_dev));
zuma_mbox_dev.dev = pci_find_device(VENDOR_ID_ZUMA, DEVICE_ID_ZUMA_PBB, 0);
if(zuma_mbox_dev.dev == -1) {
printf("no zuma pbb\n");
return -1;
}
pci_read_config_dword(zuma_mbox_dev.dev, PCI_BASE_ADDRESS_0, &iobase);
zuma_mbox_dev.sip = (PBB_DMA_REG_MAP *) (iobase & PCI_BASE_ADDRESS_MEM_MASK);
zuma_mbox_dev.sip->int_mask.word=0;
printf("pbb @ %p v%d.%d, timestamp %08x\n", zuma_mbox_dev.sip,
zuma_mbox_dev.sip->version.pci_bits.rev_major,
zuma_mbox_dev.sip->version.pci_bits.rev_minor,
zuma_mbox_dev.sip->timestamp);
if (zuma_mbox_do_all_mailbox() == -1) {
printf("mailbox failed.. no ACC?\n");
return -1;
}
zuma_mbox_dump();
zuma_mbox_setenv();
return 0;
}
开发者ID:AvengerMoJo,项目名称:apc-8750,代码行数:34,代码来源:zuma_pbb_mbox.c
示例18: zuma_init_pbb
void zuma_init_pbb (void)
{
unsigned int iobase;
pci_dev_t dev =
pci_find_device (VENDOR_ID_ZUMA, DEVICE_ID_ZUMA_PBB, 0);
if (dev == -1) {
printf ("no zuma pbb\n");
return;
}
pci_read_config_dword (dev, PCI_BASE_ADDRESS_0, &iobase);
zuma_pbb_reg =
(PBB_DMA_REG_MAP *) (iobase & PCI_BASE_ADDRESS_MEM_MASK);
if (!zuma_pbb_reg) {
printf ("zuma pbb bar none! (hah hah, get it?)\n");
return;
}
zuma_pbb_reg->int_mask.word = 0;
printf ("pbb @ %p v%d.%d, timestamp %08x\n", zuma_pbb_reg,
zuma_pbb_reg->version.pci_bits.rev_major,
zuma_pbb_reg->version.pci_bits.rev_minor,
zuma_pbb_reg->timestamp);
}
开发者ID:Admetric,项目名称:android_u-boot_s5pv210,代码行数:29,代码来源:zuma_pbb.c
示例19: pci_device_hot_remove
static int pci_device_hot_remove(Monitor *mon, const char *pci_addr)
{
PCIDevice *d;
int dom, bus;
unsigned slot;
Error *local_err = NULL;
if (pci_read_devaddr(mon, pci_addr, &dom, &bus, &slot)) {
return -1;
}
d = pci_find_device(pci_find_root_bus(dom), bus, PCI_DEVFN(slot, 0));
if (!d) {
monitor_printf(mon, "slot %d empty\n", slot);
return -1;
}
qdev_unplug(&d->qdev, &local_err);
if (error_is_set(&local_err)) {
monitor_printf(mon, "%s\n", error_get_pretty(local_err));
error_free(local_err);
return -1;
}
return 0;
}
开发者ID:CrazyXen,项目名称:XEN_CODE,代码行数:26,代码来源:pci-hotplug.c
示例20: pci_fixup_irqs
void __init
pci_fixup_irqs(u8 (*swizzle)(struct pci_dev *, u8 *),
int (*map_irq)(struct pci_dev *, u8, u8))
{
struct pci_dev *dev = NULL;
while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
pdev_fixup_irq(dev, swizzle, map_irq);
}
}
开发者ID:FelipeFernandes1988,项目名称:Alice-1121-Modem,代码行数:9,代码来源:setup-irq.c
注:本文中的pci_find_device函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论