Commit a2eb0723 authored by David S. Miller's avatar David S. Miller

[SPARC64]: Fix pcibios_resource_to_bus and the build for this platform.

parent f364ff23
...@@ -470,6 +470,54 @@ int pci_assign_resource(struct pci_dev *pdev, int resource) ...@@ -470,6 +470,54 @@ int pci_assign_resource(struct pci_dev *pdev, int resource)
return err; return err;
} }
/* Sort resources by alignment */
void pdev_sort_resources(struct pci_dev *dev, struct resource_list *head)
{
int i;
for (i = 0; i < PCI_NUM_RESOURCES; i++) {
struct resource *r;
struct resource_list *list, *tmp;
unsigned long r_align;
r = &dev->resource[i];
r_align = r->end - r->start;
if (!(r->flags) || r->parent)
continue;
if (!r_align) {
printk(KERN_WARNING "PCI: Ignore bogus resource %d "
"[%lx:%lx] of %s\n",
i, r->start, r->end, dev->dev.name);
continue;
}
r_align = (i < PCI_BRIDGE_RESOURCES) ? r_align + 1 : r->start;
for (list = head; ; list = list->next) {
unsigned long align = 0;
struct resource_list *ln = list->next;
int idx;
if (ln) {
idx = ln->res - &ln->dev->resource[0];
align = (idx < PCI_BRIDGE_RESOURCES) ?
ln->res->end - ln->res->start + 1 :
ln->res->start;
}
if (r_align > align) {
tmp = kmalloc(sizeof(*tmp), GFP_KERNEL);
if (!tmp)
panic("pdev_sort_resources(): "
"kmalloc() failed!\n");
tmp->next = ln;
tmp->res = r;
tmp->dev = dev;
list->next = tmp;
break;
}
}
}
}
void pcibios_update_irq(struct pci_dev *pdev, int irq) void pcibios_update_irq(struct pci_dev *pdev, int irq)
{ {
} }
...@@ -484,6 +532,27 @@ int pcibios_enable_device(struct pci_dev *pdev, int mask) ...@@ -484,6 +532,27 @@ int pcibios_enable_device(struct pci_dev *pdev, int mask)
return 0; return 0;
} }
void pcibios_resource_to_bus(struct pci_dev *pdev, struct pci_bus_region *region,
struct resource *res)
{
struct pci_pbm_info *pbm = pci_bus2pbm[pdev->bus->number];
struct resource zero_res, *root;
zero_res.start = 0;
zero_res.end = 0;
zero_res.flags = res->flags;
if (res->flags & IORESOURCE_IO)
root = &pbm->io_space;
else
root = &pbm->mem_space;
pbm->parent->resource_adjust(pdev, &zero_res, root);
region->start = res->start - zero_res.start;
region->end = res->end - zero_res.start;
}
char * __init pcibios_setup(char *str) char * __init pcibios_setup(char *str)
{ {
if (!strcmp(str, "onboardfirst")) { if (!strcmp(str, "onboardfirst")) {
......
...@@ -205,9 +205,10 @@ extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, ...@@ -205,9 +205,10 @@ extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
#define HAVE_ARCH_PCI_MWI #define HAVE_ARCH_PCI_MWI
extern int pcibios_prep_mwi(struct pci_dev *dev); extern int pcibios_prep_mwi(struct pci_dev *dev);
#endif /* __KERNEL__ */ extern void
pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
struct resource *res);
/* generic pci stuff */ #endif /* __KERNEL__ */
#include <asm-generic/pci.h>
#endif /* __SPARC64_PCI_H */ #endif /* __SPARC64_PCI_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment