Path: blob/master/arch/mn10300/unit-asb2305/pci-iomap.c
10817 views
/* ASB2305 PCI I/O mapping handler1*2* Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.3* Written by David Howells ([email protected])4*5* This program is free software; you can redistribute it and/or6* modify it under the terms of the GNU General Public Licence7* as published by the Free Software Foundation; either version8* 2 of the Licence, or (at your option) any later version.9*/10#include <linux/pci.h>11#include <linux/module.h>1213/*14* Create a virtual mapping cookie for a PCI BAR (memory or IO)15*/16void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)17{18resource_size_t start = pci_resource_start(dev, bar);19resource_size_t len = pci_resource_len(dev, bar);20unsigned long flags = pci_resource_flags(dev, bar);2122if (!len || !start)23return NULL;2425if ((flags & IORESOURCE_IO) || (flags & IORESOURCE_MEM))26return (void __iomem *) start;2728return NULL;29}30EXPORT_SYMBOL(pci_iomap);313233