本文整理汇总了C++中pci_iomap函数的典型用法代码示例。如果您正苦于以下问题:C++ pci_iomap函数的具体用法?C++ pci_iomap怎么用?C++ pci_iomap使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pci_iomap函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ilo_map_device
static int __devinit ilo_map_device(struct pci_dev *pdev, struct ilo_hwinfo *hw)
{
int error = -ENOMEM;
/* map the memory mapped i/o registers */
hw->mmio_vaddr = pci_iomap(pdev, 1, 0);
if (hw->mmio_vaddr == NULL) {
dev_err(&pdev->dev, "Error mapping mmio\n");
goto out;
}
/* map the adapter shared memory region */
hw->ram_vaddr = pci_iomap(pdev, 2, MAX_CCB * ILOHW_CCB_SZ);
if (hw->ram_vaddr == NULL) {
dev_err(&pdev->dev, "Error mapping shared mem\n");
goto mmio_free;
}
/* map the doorbell aperture */
hw->db_vaddr = pci_iomap(pdev, 3, MAX_CCB * ONE_DB_SIZE);
if (hw->db_vaddr == NULL) {
dev_err(&pdev->dev, "Error mapping doorbell\n");
goto ram_free;
}
return 0;
ram_free:
pci_iounmap(pdev, hw->ram_vaddr);
mmio_free:
pci_iounmap(pdev, hw->mmio_vaddr);
out:
return error;
}
开发者ID:Dashiee023,项目名称:android_kernel_wiko_rainbow,代码行数:33,代码来源:hpilo.c
示例2: virtio_pci_legacy_probe
/* the PCI probing function */
int virtio_pci_legacy_probe(struct virtio_pci_device *vp_dev)
{
struct pci_dev *pci_dev = vp_dev->pci_dev;
int rc;
/* We only own devices >= 0x1000 and <= 0x103f: leave the rest. */
if (pci_dev->device < 0x1000 || pci_dev->device > 0x103f)
return -ENODEV;
if (pci_dev->revision != VIRTIO_PCI_ABI_VERSION) {
printk(KERN_ERR "virtio_pci: expected ABI version %d, got %d\n",
VIRTIO_PCI_ABI_VERSION, pci_dev->revision);
return -ENODEV;
}
rc = dma_set_mask(&pci_dev->dev, DMA_BIT_MASK(64));
if (rc) {
rc = dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(32));
} else {
/*
* The virtio ring base address is expressed as a 32-bit PFN,
* with a page size of 1 << VIRTIO_PCI_QUEUE_ADDR_SHIFT.
*/
dma_set_coherent_mask(&pci_dev->dev,
DMA_BIT_MASK(32 + VIRTIO_PCI_QUEUE_ADDR_SHIFT));
}
if (rc)
dev_warn(&pci_dev->dev, "Failed to enable 64-bit or 32-bit DMA. Trying to continue, but this might not work.\n");
rc = pci_request_region(pci_dev, 0, "virtio-pci-legacy");
if (rc)
return rc;
rc = -ENOMEM;
vp_dev->ioaddr = pci_iomap(pci_dev, 0, 0);
if (!vp_dev->ioaddr)
goto err_iomap;
vp_dev->isr = vp_dev->ioaddr + VIRTIO_PCI_ISR;
/* we use the subsystem vendor/device id as the virtio vendor/device
* id. this allows us to use the same PCI vendor/device id for all
* virtio devices and to identify the particular virtio driver by
* the subsystem ids */
vp_dev->vdev.id.vendor = pci_dev->subsystem_vendor;
vp_dev->vdev.id.device = pci_dev->subsystem_device;
vp_dev->vdev.config = &virtio_pci_config_ops;
vp_dev->config_vector = vp_config_vector;
vp_dev->setup_vq = setup_vq;
vp_dev->del_vq = del_vq;
return 0;
err_iomap:
pci_release_region(pci_dev, 0);
return rc;
}
开发者ID:ReneNyffenegger,项目名称:linux,代码行数:61,代码来源:virtio_pci_legacy.c
示例3: map_bars
/**
* map_bars - Resource allocation for device I/O Memory and I/O Port.
* Maps physical address of PCI buffer to virtual kernel space.
*
* @param l_head: List that will hold mapped BARs
* @param pdev: Pci device description
* @param bars: Bitmask of BARs to be requested
* @param name: Desired memory region name suffix(or NULL if none)
*
* @note Linked list should be freed afterwards by unmap_bars!
*
* @return how many BARs were mapped - in case of success.
* @return -EBUSY - in case of failure.
*/
int map_bars(struct list_head *l_head, struct pci_dev *pdev, int bars, char *name)
{
char res_name[32] = "BAR";
bar_map_t *mem = NULL;
bar_map_t *memP, *tmpP;
int i, bcntr = 0;
void __iomem *ioaddr;
INIT_LIST_HEAD(l_head);
for (i = 0; i < 6; i++)
if ( (bars & (1 << i)) && (pci_resource_len(pdev, i)) ) {
memset(&res_name[3], 0, sizeof(res_name)-3);
snprintf(&res_name[3], sizeof(res_name)-3, "%d_%s", i, (name)?:'\0');
if (pci_request_region(pdev, i, res_name))
goto err_out;
/* we will treat I/O ports as if they were I/O memory */
if ( !(ioaddr = pci_iomap(pdev, i, 0)) )
goto err_out_iomap;
if ( !(mem = kzalloc((sizeof *mem), GFP_KERNEL)) )
goto err_out_alloc;
mem->mem_bar = i;
mem->mem_pdev = pdev;
mem->mem_remap = ioaddr;
mem->mem_len = pci_resource_len(pdev, i);
list_add_tail(&mem->mem_list/*new*/, l_head/*head*/);
++bcntr;
}
开发者ID:GSI-CS-CO,项目名称:kernel_modules,代码行数:42,代码来源:drvr_utils.c
示例4: mga_vram_init
/* Map the framebuffer from the card and configure the core */
static int mga_vram_init(struct mga_device *mdev)
{
void __iomem *mem;
struct apertures_struct *aper = alloc_apertures(1);
if (!aper)
return -ENOMEM;
/* BAR 0 is VRAM */
mdev->mc.vram_base = pci_resource_start(mdev->dev->pdev, 0);
mdev->mc.vram_window = pci_resource_len(mdev->dev->pdev, 0);
aper->ranges[0].base = mdev->mc.vram_base;
aper->ranges[0].size = mdev->mc.vram_window;
remove_conflicting_framebuffers(aper, "mgafb", true);
kfree(aper);
if (!devm_request_mem_region(mdev->dev->dev, mdev->mc.vram_base, mdev->mc.vram_window,
"mgadrmfb_vram")) {
DRM_ERROR("can't reserve VRAM\n");
return -ENXIO;
}
mem = pci_iomap(mdev->dev->pdev, 0, 0);
mdev->mc.vram_size = mga_probe_vram(mdev, mem);
pci_iounmap(mdev->dev->pdev, mem);
return 0;
}
开发者ID:AD5GB,项目名称:kernel_n5_3.10-experimental,代码行数:32,代码来源:mgag200_main.c
示例5: usnic_vnic_discover_resources
static int usnic_vnic_discover_resources(struct pci_dev *pdev,
struct usnic_vnic *vnic)
{
enum usnic_vnic_res_type res_type;
int i;
int err = 0;
for (i = 0; i < ARRAY_SIZE(vnic->bar); i++) {
if (!(pci_resource_flags(pdev, i) & IORESOURCE_MEM))
continue;
vnic->bar[i].len = pci_resource_len(pdev, i);
vnic->bar[i].vaddr = pci_iomap(pdev, i, vnic->bar[i].len);
if (!vnic->bar[i].vaddr) {
usnic_err("Cannot memory-map BAR %d, aborting\n",
i);
err = -ENODEV;
goto out_clean_bar;
}
vnic->bar[i].bus_addr = pci_resource_start(pdev, i);
}
vnic->vdev = vnic_dev_register(NULL, pdev, pdev, vnic->bar,
ARRAY_SIZE(vnic->bar));
if (!vnic->vdev) {
usnic_err("Failed to register device %s\n",
pci_name(pdev));
err = -EINVAL;
goto out_clean_bar;
}
for (res_type = USNIC_VNIC_RES_TYPE_EOL + 1;
res_type < USNIC_VNIC_RES_TYPE_MAX; res_type++) {
err = usnic_vnic_alloc_res_chunk(vnic, res_type,
&vnic->chunks[res_type]);
if (err) {
usnic_err("Failed to alloc res %s with err %d\n",
usnic_vnic_res_type_to_str(res_type),
err);
goto out_clean_chunks;
}
}
return 0;
out_clean_chunks:
for (res_type--; res_type > USNIC_VNIC_RES_TYPE_EOL; res_type--)
usnic_vnic_free_res_chunk(&vnic->chunks[res_type]);
vnic_dev_unregister(vnic->vdev);
out_clean_bar:
for (i = 0; i < ARRAY_SIZE(vnic->bar); i++) {
if (!(pci_resource_flags(pdev, i) & IORESOURCE_MEM))
continue;
if (!vnic->bar[i].vaddr)
break;
iounmap(vnic->bar[i].vaddr);
}
return err;
}
开发者ID:168519,项目名称:linux,代码行数:60,代码来源:usnic_vnic.c
示例6: probe
//return 0 means success
static int probe(struct pci_dev *dev, const struct pci_device_id *id)
{
/* Do probing type stuff here. Like calling request_region(); */
//lin: unsigned char revision_id;
unsigned long len;
void __iomem *addressio;
int bar ;
if(skel_get_revision(dev) != MEM_PCI_REVISION_ID)
return 1;
if (pci_enable_device(dev) < 0) {
return 1;
}
bar = 1;
//lin: resource_size_t start = pci_resource_start(dev, bar);
len = pci_resource_len(dev, bar);
//lin: unsigned long flags = pci_resource_flags(dev, bar);
addressio = pci_iomap(dev,bar,len);
if (addressio == NULL) {
return 1;
}
//*(byte *)addressio = 0x57;
//iowrite8(0x89,addressio + 8);
//printk("%x\n",ioread8(addressio + 8));
//printk("%x\n",*(byte *)addressio);
iowrite8(0x89,addressio + 0);
printk("%x\n",ioread8(addressio + 0));
iowrite16(0x50,addressio + 8);
printk("%x\n",ioread16(addressio + 8));
printk("len=%ld\n",len);
return 0;
}
开发者ID:huolinliang,项目名称:vmem_pci,代码行数:34,代码来源:mem_pci_drv.c
示例7: marvell_pata_active
static int marvell_pata_active(struct pci_dev *pdev)
{
int i;
u32 devices;
void __iomem *barp;
/* We don't yet know how to do this for other devices */
if (pdev->device != 0x6145)
return 1;
barp = pci_iomap(pdev, 5, 0x10);
if (barp == NULL)
return -ENOMEM;
printk("BAR5:");
for(i = 0; i <= 0x0F; i++)
printk("%02X:%02X ", i, ioread8(barp + i));
printk("\n");
devices = ioread32(barp + 0x0C);
pci_iounmap(pdev, barp);
if (devices & 0x10)
return 1;
return 0;
}
开发者ID:CSCLOG,项目名称:beaglebone,代码行数:26,代码来源:pata_marvell.c
示例8: piix_disable_ahci
static int piix_disable_ahci(struct pci_dev *pdev)
{
void __iomem *mmio;
u32 tmp;
int rc = 0;
/* BUG: pci_enable_device has not yet been called. This
* works because this device is usually set up by BIOS.
*/
if (!pci_resource_start(pdev, AHCI_PCI_BAR) ||
!pci_resource_len(pdev, AHCI_PCI_BAR))
return 0;
mmio = pci_iomap(pdev, AHCI_PCI_BAR, 64);
if (!mmio)
return -ENOMEM;
tmp = readl(mmio + AHCI_GLOBAL_CTL);
if (tmp & AHCI_ENABLE) {
tmp &= ~AHCI_ENABLE;
writel(tmp, mmio + AHCI_GLOBAL_CTL);
tmp = readl(mmio + AHCI_GLOBAL_CTL);
if (tmp & AHCI_ENABLE)
rc = -EIO;
}
pci_iounmap(pdev, mmio);
return rc;
}
开发者ID:robacklin,项目名称:uclinux-linux,代码行数:31,代码来源:ata_piix.c
示例9: plx_pci_reset_marathon_pcie
/* Special reset function for Marathon CAN-bus-PCIe card */
static void plx_pci_reset_marathon_pcie(struct pci_dev *pdev)
{
void __iomem *addr;
void __iomem *reset_addr;
int i;
plx9056_pci_reset_common(pdev);
for (i = 0; i < 2; i++) {
struct plx_pci_channel_map *chan_map =
&plx_pci_card_info_marathon_pcie.chan_map_tbl[i];
addr = pci_iomap(pdev, chan_map->bar, chan_map->size);
if (!addr) {
dev_err(&pdev->dev, "Failed to remap reset "
"space %d (BAR%d)\n", i, chan_map->bar);
} else {
/* reset the SJA1000 chip */
#define MARATHON_PCIE_RESET_OFFSET 32
reset_addr = addr + chan_map->offset +
MARATHON_PCIE_RESET_OFFSET;
iowrite8(0x1, reset_addr);
udelay(100);
pci_iounmap(pdev, addr);
}
}
}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:27,代码来源:plx_pci.c
示例10: marvell_pre_reset
static int marvell_pre_reset(struct ata_link *link, unsigned long deadline)
{
struct ata_port *ap = link->ap;
struct pci_dev *pdev = to_pci_dev(ap->host->dev);
u32 devices;
void __iomem *barp;
int i;
/* Check if our port is enabled */
barp = pci_iomap(pdev, 5, 0x10);
if (barp == NULL)
return -ENOMEM;
printk("BAR5:");
for(i = 0; i <= 0x0F; i++)
printk("%02X:%02X ", i, ioread8(barp + i));
printk("\n");
devices = ioread32(barp + 0x0C);
pci_iounmap(pdev, barp);
if ((pdev->device == 0x6145) && (ap->port_no == 0) &&
(!(devices & 0x10))) /* PATA enable ? */
return -ENOENT;
return ata_std_prereset(link, deadline);
}
开发者ID:PennPanda,项目名称:linux-repo,代码行数:27,代码来源:pata_marvell.c
示例11: ci13xxx_pci_probe
/**
* ci13xxx_pci_probe: PCI probe
* @pdev: USB device controller being probed
* @id: PCI hotplug ID connecting controller to UDC framework
*
* This function returns an error code
* Allocates basic PCI resources for this USB device controller, and then
* invokes the udc_probe() method to start the UDC associated with it
*/
static int __devinit ci13xxx_pci_probe(struct pci_dev *pdev,
const struct pci_device_id *id)
{
void __iomem *regs = NULL;
int retval = 0;
if (id == NULL)
return -EINVAL;
retval = pci_enable_device(pdev);
if (retval)
goto done;
if (!pdev->irq) {
dev_err(&pdev->dev, "No IRQ, check BIOS/PCI setup!");
retval = -ENODEV;
goto disable_device;
}
retval = pci_request_regions(pdev, UDC_DRIVER_NAME);
if (retval)
goto disable_device;
/* BAR 0 holds all the registers */
regs = pci_iomap(pdev, 0, 0);
if (!regs) {
dev_err(&pdev->dev, "Error mapping memory!");
retval = -EFAULT;
goto release_regions;
}
pci_set_drvdata(pdev, (__force void *)regs);
pci_set_master(pdev);
pci_try_set_mwi(pdev);
retval = udc_probe(&ci13xxx_pci_udc_driver, &pdev->dev, regs);
if (retval)
goto iounmap;
/* our device does not have MSI capability */
retval = request_irq(pdev->irq, ci13xxx_pci_irq, IRQF_SHARED,
UDC_DRIVER_NAME, pdev);
if (retval)
goto gadget_remove;
return 0;
gadget_remove:
udc_remove();
iounmap:
pci_iounmap(pdev, regs);
release_regions:
pci_release_regions(pdev);
disable_device:
pci_disable_device(pdev);
done:
return retval;
}
开发者ID:CSCLOG,项目名称:beaglebone,代码行数:68,代码来源:ci13xxx_pci.c
示例12: imx_pcie_ep_probe
/**
* imx_pcie_ep_probe - Device Initialization Routine
* @pdev: PCI device information struct
* @id: entry in id_tbl
*
* Returns 0 on success, negative on failure
**/
static int imx_pcie_ep_probe(struct pci_dev *pdev,
const struct pci_device_id *id)
{
int ret = 0;
struct device *dev = &pdev->dev;
struct imx_pcie_ep_priv *priv;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv) {
dev_err(dev, "can't alloc imx pcie priv\n");
return -ENOMEM;
}
priv->pci_dev = pdev;
if (pci_enable_device(pdev)) {
ret = -ENODEV;
goto out;
}
pci_set_master(pdev);
pci_set_drvdata(pdev, priv);
priv->hw_base = pci_iomap(pdev, 0, 0);
if (!priv->hw_base) {
ret = -ENODEV;
goto out;
}
pr_info("pci_resource_len = 0x%08llx\n",
(unsigned long long) pci_resource_len(pdev, 0));
pr_info("pci_resource_base = %p\n", priv->hw_base);
ret = pci_enable_msi(priv->pci_dev);
if (ret < 0) {
dev_err(dev, "can't enable msi\n");
return ret;
}
/*
* Force to use 0x01FF8000 as the MSI address,
* to do the MSI demo
*/
pci_bus_write_config_dword(pdev->bus, 0, 0x54, 0x01FF8000);
pci_bus_write_config_dword(pdev->bus->parent, 0, 0x820, 0x01FF8000);
/* configure rc's msi cap */
pci_bus_read_config_dword(pdev->bus->parent, 0, 0x50, &ret);
ret |= (PCI_MSI_FLAGS_ENABLE << 16);
pci_bus_write_config_dword(pdev->bus->parent, 0, 0x50, ret);
pci_bus_write_config_dword(pdev->bus->parent, 0, 0x828, 0x1);
pci_bus_write_config_dword(pdev->bus->parent, 0, 0x82C, 0xFFFFFFFE);
return 0;
out:
return ret;
}
开发者ID:benjorsun,项目名称:imx6q,代码行数:65,代码来源:pci-imx6-ep-driver.c
示例13: geode_aes_probe
static int __devinit
geode_aes_probe(struct pci_dev *dev, const struct pci_device_id *id)
{
int ret;
ret = pci_enable_device(dev);
if (ret)
return ret;
ret = pci_request_regions(dev, "geode-aes");
if (ret)
goto eenable;
_iobase = pci_iomap(dev, 0, 0);
if (_iobase == NULL) {
ret = -ENOMEM;
goto erequest;
}
spin_lock_init(&lock);
/* Clear any pending activity */
iowrite32(AES_INTR_PENDING | AES_INTR_MASK, _iobase + AES_INTR_REG);
ret = crypto_register_alg(&geode_alg);
if (ret)
goto eiomap;
ret = crypto_register_alg(&geode_ecb_alg);
if (ret)
goto ealg;
ret = crypto_register_alg(&geode_cbc_alg);
if (ret)
goto eecb;
printk(KERN_NOTICE "geode-aes: GEODE AES engine enabled.\n");
return 0;
eecb:
crypto_unregister_alg(&geode_ecb_alg);
ealg:
crypto_unregister_alg(&geode_alg);
eiomap:
pci_iounmap(dev, _iobase);
erequest:
pci_release_regions(dev);
eenable:
pci_disable_device(dev);
printk(KERN_ERR "geode-aes: GEODE AES initialization failed.\n");
return ret;
}
开发者ID:12rafael,项目名称:jellytimekernel,代码行数:57,代码来源:geode-aes.c
示例14: probe
static int __devinit probe(struct pci_dev *pdev, const struct pci_device_id *id)
{
struct uio_info *info;
int ret;
info = kzalloc(sizeof(struct uio_info), GFP_KERNEL);
if (!info)
return -ENOMEM;
if (pci_enable_device(pdev))
goto out_free;
if (pci_request_regions(pdev, "aectc"))
goto out_disable;
info->name = "aectc";
info->port[0].start = pci_resource_start(pdev, 0);
if (!info->port[0].start)
goto out_release;
info->priv = pci_iomap(pdev, 0, 0);
if (!info->priv)
goto out_release;
info->port[0].size = pci_resource_len(pdev, 0);
info->port[0].porttype = UIO_PORT_GPIO;
info->version = "0.0.1";
info->irq = pdev->irq;
info->irq_flags = IRQF_SHARED;
info->handler = aectc_irq;
print_board_data(pdev, info);
ret = uio_register_device(&pdev->dev, info);
if (ret)
goto out_unmap;
iowrite32(INT_ENABLE, info->priv + INT_ENABLE_ADDR);
iowrite8(INT_MASK_ALL, info->priv + INT_MASK_ADDR);
if (!(ioread8(info->priv + INTA_DRVR_ADDR)
& INTA_ENABLED_FLAG))
dev_err(&pdev->dev, "aectc: interrupts not enabled\n");
pci_set_drvdata(pdev, info);
return 0;
out_unmap:
pci_iounmap(pdev, info->priv);
out_release:
pci_release_regions(pdev);
out_disable:
pci_disable_device(pdev);
out_free:
kfree(info);
return -ENODEV;
}
开发者ID:DirtyDroidX,项目名称:android_kernel_htc_m8ul,代码行数:55,代码来源:uio_aec.c
示例15: ilo_map_device
static int ilo_map_device(struct pci_dev *pdev, struct ilo_hwinfo *hw)
{
int bar;
unsigned long off;
/* map the memory mapped i/o registers */
hw->mmio_vaddr = pci_iomap(pdev, 1, 0);
if (hw->mmio_vaddr == NULL) {
dev_err(&pdev->dev, "Error mapping mmio\n");
goto out;
}
/* map the adapter shared memory region */
if (pdev->subsystem_device == 0x00E4) {
bar = 5;
/* Last 8k is reserved for CCBs */
off = pci_resource_len(pdev, bar) - 0x2000;
} else {
bar = 2;
off = 0;
}
hw->ram_vaddr = pci_iomap_range(pdev, bar, off, max_ccb * ILOHW_CCB_SZ);
if (hw->ram_vaddr == NULL) {
dev_err(&pdev->dev, "Error mapping shared mem\n");
goto mmio_free;
}
/* map the doorbell aperture */
hw->db_vaddr = pci_iomap(pdev, 3, max_ccb * ONE_DB_SIZE);
if (hw->db_vaddr == NULL) {
dev_err(&pdev->dev, "Error mapping doorbell\n");
goto ram_free;
}
return 0;
ram_free:
pci_iounmap(pdev, hw->ram_vaddr);
mmio_free:
pci_iounmap(pdev, hw->mmio_vaddr);
out:
return -ENOMEM;
}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:42,代码来源:hpilo.c
示例16: xhci_pci_probe
static int xhci_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{
struct xhci_data data = {};
pci_enable_device(pdev);
pci_set_master(pdev);
data.regs = pci_iomap(pdev, 0);
return xhci_register(&pdev->dev, &data);
}
开发者ID:masahir0y,项目名称:barebox-yamada,代码行数:11,代码来源:xhci-pci.c
示例17: genwqe_bus_reset
/**
* genwqe_bus_reset() - Card recovery
*
* pci_reset_function() will recover the device and ensure that the
* registers are accessible again when it completes with success. If
* not, the card will stay dead and registers will be unaccessible
* still.
*/
static int genwqe_bus_reset(struct genwqe_dev *cd)
{
int bars, rc = 0;
struct pci_dev *pci_dev = cd->pci_dev;
void __iomem *mmio;
if (cd->err_inject & GENWQE_INJECT_BUS_RESET_FAILURE)
return -EIO;
mmio = cd->mmio;
cd->mmio = NULL;
pci_iounmap(pci_dev, mmio);
bars = pci_select_bars(pci_dev, IORESOURCE_MEM);
pci_release_selected_regions(pci_dev, bars);
/*
* Firmware/BIOS might change memory mapping during bus reset.
* Settings like enable bus-mastering, ... are backuped and
* restored by the pci_reset_function().
*/
dev_dbg(&pci_dev->dev, "[%s] pci_reset function ...\n", __func__);
rc = pci_reset_function(pci_dev);
if (rc) {
dev_err(&pci_dev->dev,
"[%s] err: failed reset func (rc %d)\n", __func__, rc);
return rc;
}
dev_dbg(&pci_dev->dev, "[%s] done with rc=%d\n", __func__, rc);
/*
* Here is the right spot to clear the register read
* failure. pci_bus_reset() does this job in real systems.
*/
cd->err_inject &= ~(GENWQE_INJECT_HARDWARE_FAILURE |
GENWQE_INJECT_GFIR_FATAL |
GENWQE_INJECT_GFIR_INFO);
rc = pci_request_selected_regions(pci_dev, bars, genwqe_driver_name);
if (rc) {
dev_err(&pci_dev->dev,
"[%s] err: request bars failed (%d)\n", __func__, rc);
return -EIO;
}
cd->mmio = pci_iomap(pci_dev, 0, 0);
if (cd->mmio == NULL) {
dev_err(&pci_dev->dev,
"[%s] err: mapping BAR0 failed\n", __func__);
return -ENOMEM;
}
return 0;
}
开发者ID:020gzh,项目名称:linux,代码行数:61,代码来源:card_base.c
示例18: amd_ntb_init_pci
static int amd_ntb_init_pci(struct amd_ntb_dev *ndev,
struct pci_dev *pdev)
{
int rc;
pci_set_drvdata(pdev, ndev);
rc = pci_enable_device(pdev);
if (rc)
goto err_pci_enable;
rc = pci_request_regions(pdev, NTB_NAME);
if (rc)
goto err_pci_regions;
pci_set_master(pdev);
rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));
if (rc) {
rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
if (rc)
goto err_dma_mask;
dev_warn(&pdev->dev, "Cannot DMA highmem\n");
}
rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
if (rc) {
rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
if (rc)
goto err_dma_mask;
dev_warn(&pdev->dev, "Cannot DMA consistent highmem\n");
}
ndev->self_mmio = pci_iomap(pdev, 0, 0);
if (!ndev->self_mmio) {
rc = -EIO;
goto err_dma_mask;
}
ndev->peer_mmio = ndev->self_mmio + AMD_PEER_OFFSET;
return 0;
err_dma_mask:
pci_clear_master(pdev);
err_pci_regions:
pci_disable_device(pdev);
err_pci_enable:
pci_set_drvdata(pdev, NULL);
return rc;
}
开发者ID:grate-driver,项目名称:linux,代码行数:50,代码来源:ntb_hw_amd.c
示例19: flexcop_pci_init
static int flexcop_pci_init(struct flexcop_pci *fc_pci)
{
int ret;
u8 card_rev;
pci_read_config_byte(fc_pci->pdev, PCI_CLASS_REVISION, &card_rev);
info("card revision %x", card_rev);
if ((ret = pci_enable_device(fc_pci->pdev)) != 0)
return ret;
pci_set_master(fc_pci->pdev);
/* enable interrupts */
// pci_write_config_dword(pdev, 0x6c, 0x8000);
if ((ret = pci_request_regions(fc_pci->pdev, DRIVER_NAME)) != 0)
goto err_pci_disable_device;
fc_pci->io_mem = pci_iomap(fc_pci->pdev, 0, 0x800);
if (!fc_pci->io_mem) {
err("cannot map io memory\n");
ret = -EIO;
goto err_pci_release_regions;
}
pci_set_drvdata(fc_pci->pdev, fc_pci);
if ((ret = request_irq(fc_pci->pdev->irq, flexcop_pci_isr,
SA_SHIRQ, DRIVER_NAME, fc_pci)) != 0)
goto err_pci_iounmap;
spin_lock_init(&fc_pci->irq_lock);
fc_pci->init_state |= FC_PCI_INIT;
goto success;
err_pci_iounmap:
pci_iounmap(fc_pci->pdev, fc_pci->io_mem);
pci_set_drvdata(fc_pci->pdev, NULL);
err_pci_release_regions:
pci_release_regions(fc_pci->pdev);
err_pci_disable_device:
pci_disable_device(fc_pci->pdev);
success:
return ret;
}
开发者ID:ena30,项目名称:snake-os,代码行数:49,代码来源:flexcop-pci.c
示例20: i2c_vr_mapregs
static int i2c_vr_mapregs(struct pci_dev *dev, int idx)
{
void __iomem *base;
if (!dev || idx >= I2C_VR_ADAP_NR)
return -EINVAL;
base = pci_iomap(dev, idx, 0);
if (!base) {
dev_dbg(&dev->dev, "error mapping memory\n");
return -EFAULT;
}
i2c_vr[idx].regs = base;
return 0;
}
开发者ID:prime5711,项目名称:blackbox,代码行数:15,代码来源:i2c-vr.c
注:本文中的pci_iomap函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论