2 #include <linux/kernel.h>
3 #include <arch/hwregs/intr_vect.h>
5 void pcibios_fixup_bus(struct pci_bus
*b
)
9 void pcibios_set_master(struct pci_dev
*dev
)
12 pci_read_config_byte(dev
, PCI_LATENCY_TIMER
, &lat
);
13 printk(KERN_DEBUG
"PCI: Setting latency timer of device %s to %d\n", pci_name(dev
), lat
);
14 pci_write_config_byte(dev
, PCI_LATENCY_TIMER
, lat
);
17 int pci_mmap_page_range(struct pci_dev
*dev
, struct vm_area_struct
*vma
,
18 enum pci_mmap_state mmap_state
, int write_combine
)
22 /* Leave vm_pgoff as-is, the PCI space address is the physical
23 * address on this platform.
25 prot
= pgprot_val(vma
->vm_page_prot
);
26 vma
->vm_page_prot
= __pgprot(prot
);
28 /* Write-combine setting is ignored, it is changed via the mtrr
29 * interfaces on this platform.
31 if (remap_pfn_range(vma
, vma
->vm_start
, vma
->vm_pgoff
,
32 vma
->vm_end
- vma
->vm_start
,
40 pcibios_align_resource(void *data
, const struct resource
*res
,
41 resource_size_t size
, resource_size_t align
)
43 resource_size_t start
= res
->start
;
45 if ((res
->flags
& IORESOURCE_IO
) && (start
& 0x300))
46 start
= (start
+ 0x3ff) & ~0x3ff;
51 int pcibios_enable_resources(struct pci_dev
*dev
, int mask
)
57 pci_read_config_word(dev
, PCI_COMMAND
, &cmd
);
59 for(idx
=0; idx
<6; idx
++) {
60 /* Only set up the requested stuff */
61 if (!(mask
& (1<<idx
)))
64 r
= &dev
->resource
[idx
];
65 if (!r
->start
&& r
->end
) {
66 printk(KERN_ERR
"PCI: Device %s not available because of resource collisions\n", pci_name(dev
));
69 if (r
->flags
& IORESOURCE_IO
)
70 cmd
|= PCI_COMMAND_IO
;
71 if (r
->flags
& IORESOURCE_MEM
)
72 cmd
|= PCI_COMMAND_MEMORY
;
74 if (dev
->resource
[PCI_ROM_RESOURCE
].start
)
75 cmd
|= PCI_COMMAND_MEMORY
;
77 printk("PCI: Enabling device %s (%04x -> %04x)\n", pci_name(dev
), old_cmd
, cmd
);
78 pci_write_config_word(dev
, PCI_COMMAND
, cmd
);
83 int pcibios_enable_irq(struct pci_dev
*dev
)
85 dev
->irq
= EXT_INTR_VECT
;
89 int pcibios_enable_device(struct pci_dev
*dev
, int mask
)
93 if ((err
= pcibios_enable_resources(dev
, mask
)) < 0)
96 if (!dev
->msi_enabled
)
97 pcibios_enable_irq(dev
);