Skip to content

Commit

Permalink
[PATCH] 64bit resource: change pci core and arch code to use resource…
Browse files Browse the repository at this point in the history
…_size_t

Based on a patch series originally from Vivek Goyal <[email protected]>

Cc: Vivek Goyal <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
gregkh committed Jun 27, 2006
1 parent d75fc8b commit e31dd6e
Show file tree
Hide file tree
Showing 31 changed files with 76 additions and 74 deletions.
4 changes: 2 additions & 2 deletions arch/alpha/kernel/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,12 @@ DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, pcibios_fixup_final);

void
pcibios_align_resource(void *data, struct resource *res,
unsigned long size, unsigned long align)
resource_size_t size, resource_size_t align)
{
struct pci_dev *dev = data;
struct pci_controller *hose = dev->sysdata;
unsigned long alignto;
unsigned long start = res->start;
resource_size_t start = res->start;

if (res->flags & IORESOURCE_IO) {
/* Make sure we start at our min on all hoses */
Expand Down
6 changes: 3 additions & 3 deletions arch/arm/kernel/bios32.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ static inline int pdev_bad_for_parity(struct pci_dev *dev)
static void __devinit
pdev_fixup_device_resources(struct pci_sys_data *root, struct pci_dev *dev)
{
unsigned long offset;
resource_size_t offset;
int i;

for (i = 0; i < PCI_NUM_RESOURCES; i++) {
Expand Down Expand Up @@ -634,9 +634,9 @@ char * __init pcibios_setup(char *str)
* which might be mirrored at 0x0100-0x03ff..
*/
void pcibios_align_resource(void *data, struct resource *res,
unsigned long size, unsigned long align)
resource_size_t size, resource_size_t align)
{
unsigned long start = res->start;
resource_size_t start = res->start;

if (res->flags & IORESOURCE_IO && start & 0x300)
start = (start + 0x3ff) & ~0x3ff;
Expand Down
4 changes: 2 additions & 2 deletions arch/cris/arch-v32/drivers/pci/bios.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,

void
pcibios_align_resource(void *data, struct resource *res,
unsigned long size, unsigned long align)
resource_size_t size, resource_size_t align)
{
if (res->flags & IORESOURCE_IO) {
unsigned long start = res->start;
resource_size_t start = res->start;

if (start & 0x300) {
start = (start + 0x3ff) & ~0x3ff;
Expand Down
4 changes: 2 additions & 2 deletions arch/frv/mb93090-mb00/pci-frv.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ pcibios_update_resource(struct pci_dev *dev, struct resource *root,
*/
void
pcibios_align_resource(void *data, struct resource *res,
unsigned long size, unsigned long align)
resource_size_t size, resource_size_t align)
{
if (res->flags & IORESOURCE_IO) {
unsigned long start = res->start;
resource_size_t start = res->start;

if (start & 0x300) {
start = (start + 0x3ff) & ~0x3ff;
Expand Down
4 changes: 2 additions & 2 deletions arch/i386/pci/i386.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@
*/
void
pcibios_align_resource(void *data, struct resource *res,
unsigned long size, unsigned long align)
resource_size_t size, resource_size_t align)
{
if (res->flags & IORESOURCE_IO) {
unsigned long start = res->start;
resource_size_t start = res->start;

if (start & 0x300) {
start = (start + 0x3ff) & ~0x3ff;
Expand Down
2 changes: 1 addition & 1 deletion arch/ia64/pci/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ pcibios_disable_device (struct pci_dev *dev)

void
pcibios_align_resource (void *data, struct resource *res,
unsigned long size, unsigned long align)
resource_size_t size, resource_size_t align)
{
}

Expand Down
3 changes: 2 additions & 1 deletion arch/m68knommu/kernel/comempci.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,8 @@ void pcibios_fixup_bus(struct pci_bus *b)

/*****************************************************************************/

void pcibios_align_resource(void *data, struct resource *res, unsigned long size, unsigned long align)
void pcibios_align_resource(void *data, struct resource *res,
resource_size_t size, resource_size_t align)
{
}

Expand Down
4 changes: 2 additions & 2 deletions arch/mips/pci/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ unsigned long PCIBIOS_MIN_MEM = 0;
*/
void
pcibios_align_resource(void *data, struct resource *res,
unsigned long size, unsigned long align)
resource_size_t size, resource_size_t align)
{
struct pci_dev *dev = data;
struct pci_controller *hose = dev->sysdata;
unsigned long start = res->start;
resource_size_t start = res->start;

if (res->flags & IORESOURCE_IO) {
/* Make sure we start at our min on all hoses */
Expand Down
4 changes: 2 additions & 2 deletions arch/mips/pmc-sierra/yosemite/ht.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,12 +383,12 @@ void pcibios_update_resource(struct pci_dev *dev, struct resource *root,


void pcibios_align_resource(void *data, struct resource *res,
unsigned long size, unsigned long align)
resource_size_t size, resource_size_t align)
{
struct pci_dev *dev = data;

if (res->flags & IORESOURCE_IO) {
unsigned long start = res->start;
resource_size_t start = res->start;

/* We need to avoid collisions with `mirrored' VGA ports
and other strange ISA hardware, so we always want the
Expand Down
2 changes: 1 addition & 1 deletion arch/parisc/kernel/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ EXPORT_SYMBOL(pcibios_bus_to_resource);
* than res->start.
*/
void pcibios_align_resource(void *data, struct resource *res,
unsigned long size, unsigned long alignment)
resource_size_t size, resource_size_t alignment)
{
unsigned long mask, align;

Expand Down
10 changes: 5 additions & 5 deletions arch/powerpc/kernel/pci_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,18 +173,18 @@ EXPORT_SYMBOL(pcibios_bus_to_resource);
* but we want to try to avoid allocating at 0x2900-0x2bff
* which might have be mirrored at 0x0100-0x03ff..
*/
void pcibios_align_resource(void *data, struct resource *res, unsigned long size,
unsigned long align)
void pcibios_align_resource(void *data, struct resource *res,
resource_size_t size, resource_size_t align)
{
struct pci_dev *dev = data;

if (res->flags & IORESOURCE_IO) {
unsigned long start = res->start;
resource_size_t start = res->start;

if (size > 0x100) {
printk(KERN_ERR "PCI: I/O Region %s/%d too large"
" (%lld bytes)\n", pci_name(dev),
dev->resource - res, size);
dev->resource - res, (unsigned long long)size);
}

if (start & 0x300) {
Expand Down Expand Up @@ -1756,7 +1756,7 @@ long sys_pciconfig_iobase(long which, unsigned long bus, unsigned long devfn)

void pci_resource_to_user(const struct pci_dev *dev, int bar,
const struct resource *rsrc,
u64 *start, u64 *end)
resource_size_t *start, resource_size_t *end)
{
struct pci_controller *hose = pci_bus_to_hose(dev->bus->number);
unsigned long offset = 0;
Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/kernel/pci_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ EXPORT_SYMBOL(pcibios_bus_to_resource);
* which might have be mirrored at 0x0100-0x03ff..
*/
void pcibios_align_resource(void *data, struct resource *res,
unsigned long size, unsigned long align)
resource_size_t size, resource_size_t align)
{
struct pci_dev *dev = data;
struct pci_controller *hose = pci_bus_to_host(dev->bus);
unsigned long start = res->start;
resource_size_t start = res->start;
unsigned long alignto;

if (res->flags & IORESOURCE_IO) {
Expand Down
12 changes: 6 additions & 6 deletions arch/ppc/kernel/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,13 @@ EXPORT_SYMBOL(pcibios_bus_to_resource);
* but we want to try to avoid allocating at 0x2900-0x2bff
* which might have be mirrored at 0x0100-0x03ff..
*/
void pcibios_align_resource(void *data, struct resource *res, unsigned long size,
unsigned long align)
void pcibios_align_resource(void *data, struct resource *res,
resource_size_t size, resource_size_t align)
{
struct pci_dev *dev = data;

if (res->flags & IORESOURCE_IO) {
unsigned long start = res->start;
resource_size_t start = res->start;

if (size > 0x100) {
printk(KERN_ERR "PCI: I/O Region %s/%d too large"
Expand Down Expand Up @@ -960,8 +960,8 @@ static pgprot_t __pci_mmap_set_pgprot(struct pci_dev *dev, struct resource *rp,
else
prot |= _PAGE_GUARDED;

printk("PCI map for %s:%llx, prot: %llx\n", pci_name(dev), rp->start,
prot);
printk("PCI map for %s:%llx, prot: %lx\n", pci_name(dev),
(unsigned long long)rp->start, prot);

return __pgprot(prot);
}
Expand Down Expand Up @@ -1130,7 +1130,7 @@ long sys_pciconfig_iobase(long which, unsigned long bus, unsigned long devfn)

void pci_resource_to_user(const struct pci_dev *dev, int bar,
const struct resource *rsrc,
u64 *start, u64 *end)
resource_size_t *start, resource_size_t *end)
{
struct pci_controller *hose = pci_bus_to_hose(dev->bus->number);
unsigned long offset = 0;
Expand Down
4 changes: 2 additions & 2 deletions arch/sh/boards/mpc1211/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,9 @@ void __init pcibios_fixup_irqs(void)
}

void pcibios_align_resource(void *data, struct resource *res,
unsigned long size, unsigned long align)
resource_size_t size, resource_size_t align)
{
unsigned long start = res->start;
resource_size_t start = res->start;

if (res->flags & IORESOURCE_IO) {
if (start >= 0x10000UL) {
Expand Down
2 changes: 1 addition & 1 deletion arch/sh/boards/overdrive/galileo.c
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ void __init pcibios_fixup_bus(struct pci_bus *bus)
}

void pcibios_align_resource(void *data, struct resource *res,
unsigned long size)
resource_size_t size)
{
}

Expand Down
6 changes: 3 additions & 3 deletions arch/sh/drivers/pci/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ pcibios_update_resource(struct pci_dev *dev, struct resource *root,
}

void pcibios_align_resource(void *data, struct resource *res,
unsigned long size, unsigned long align)
resource_size_t size, resource_size_t align)
__attribute__ ((weak));

/*
Expand All @@ -85,10 +85,10 @@ void pcibios_align_resource(void *data, struct resource *res,
* modulo 0x400.
*/
void pcibios_align_resource(void *data, struct resource *res,
unsigned long size, unsigned long align)
resource_size_t size, resource_size_t align)
{
if (res->flags & IORESOURCE_IO) {
unsigned long start = res->start;
resource_size_t start = res->start;

if (start & 0x300) {
start = (start + 0x3ff) & ~0x3ff;
Expand Down
4 changes: 2 additions & 2 deletions arch/sh64/kernel/pcibios.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ pcibios_update_resource(struct pci_dev *dev, struct resource *root,
* modulo 0x400.
*/
void pcibios_align_resource(void *data, struct resource *res,
unsigned long size, unsigned long align)
resource_size_t size, resource_size_t align)
{
if (res->flags & IORESOURCE_IO) {
unsigned long start = res->start;
resource_size_t start = res->start;

if (start & 0x300) {
start = (start + 0x3ff) & ~0x3ff;
Expand Down
2 changes: 1 addition & 1 deletion arch/sparc/kernel/pcic.c
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ char * __init pcibios_setup(char *str)
}

void pcibios_align_resource(void *data, struct resource *res,
unsigned long size, unsigned long align)
resource_size_t size, resource_size_t align)
{
}

Expand Down
2 changes: 1 addition & 1 deletion arch/sparc64/kernel/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ void pcibios_update_irq(struct pci_dev *pdev, int irq)
}

void pcibios_align_resource(void *data, struct resource *res,
unsigned long size, unsigned long align)
resource_size_t size, resource_size_t align)
{
}

Expand Down
2 changes: 1 addition & 1 deletion arch/v850/kernel/rte_mb_a_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ void pcibios_fixup_bus(struct pci_bus *b)

void
pcibios_align_resource (void *data, struct resource *res,
unsigned long size, unsigned long align)
resource_size_t size, resource_size_t align)
{
}

Expand Down
6 changes: 3 additions & 3 deletions arch/xtensa/kernel/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ static int pci_bus_count;
* which might have be mirrored at 0x0100-0x03ff..
*/
void
pcibios_align_resource(void *data, struct resource *res, unsigned long size,
unsigned long align)
pcibios_align_resource(void *data, struct resource *res, resource_size_t size,
resource_size_t align)
{
struct pci_dev *dev = data;

if (res->flags & IORESOURCE_IO) {
unsigned long start = res->start;
resource_size_t start = res->start;

if (size > 0x100) {
printk(KERN_ERR "PCI: I/O Region %s/%d too large"
Expand Down
10 changes: 5 additions & 5 deletions drivers/pci/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
*/
int
pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res,
unsigned long size, unsigned long align, unsigned long min,
unsigned int type_mask,
void (*alignf)(void *, struct resource *,
unsigned long, unsigned long),
void *alignf_data)
resource_size_t size, resource_size_t align,
resource_size_t min, unsigned int type_mask,
void (*alignf)(void *, struct resource *, resource_size_t,
resource_size_t),
void *alignf_data)
{
int i, ret = -ENOMEM;

Expand Down
4 changes: 2 additions & 2 deletions drivers/pci/pci-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ resource_show(struct device * dev, struct device_attribute *attr, char * buf)
char * str = buf;
int i;
int max = 7;
u64 start, end;
resource_size_t start, end;

if (pci_dev->subordinate)
max = DEVICE_COUNT_RESOURCE;
Expand Down Expand Up @@ -365,7 +365,7 @@ pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr,
struct device, kobj));
struct resource *res = (struct resource *)attr->private;
enum pci_mmap_state mmap_type;
u64 start, end;
resource_size_t start, end;
int i;

for (i = 0; i < PCI_ROM_RESOURCE; i++)
Expand Down
6 changes: 3 additions & 3 deletions drivers/pci/pci.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ extern int pci_create_sysfs_dev_files(struct pci_dev *pdev);
extern void pci_remove_sysfs_dev_files(struct pci_dev *pdev);
extern void pci_cleanup_rom(struct pci_dev *dev);
extern int pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res,
unsigned long size, unsigned long align,
unsigned long min, unsigned int type_mask,
resource_size_t size, resource_size_t align,
resource_size_t min, unsigned int type_mask,
void (*alignf)(void *, struct resource *,
unsigned long, unsigned long),
resource_size_t, resource_size_t),
void *alignf_data);
/* Firmware callbacks */
extern int (*platform_pci_choose_state)(struct pci_dev *dev, pm_message_t state);
Expand Down
4 changes: 2 additions & 2 deletions drivers/pci/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -350,14 +350,14 @@ static int show_device(struct seq_file *m, void *v)
dev->irq);
/* Here should be 7 and not PCI_NUM_RESOURCES as we need to preserve compatibility */
for (i=0; i<7; i++) {
u64 start, end;
resource_size_t start, end;
pci_resource_to_user(dev, i, &dev->resource[i], &start, &end);
seq_printf(m, "\t%16llx",
(unsigned long long)(start |
(dev->resource[i].flags & PCI_REGION_FLAG_MASK)));
}
for (i=0; i<7; i++) {
u64 start, end;
resource_size_t start, end;
pci_resource_to_user(dev, i, &dev->resource[i], &start, &end);
seq_printf(m, "\t%16llx",
dev->resource[i].start < dev->resource[i].end ?
Expand Down
Loading

0 comments on commit e31dd6e

Please sign in to comment.