Commit b09603b1 authored by Andi Kleen's avatar Andi Kleen Committed by Dave Jones

Fix x86-64 AGPGART/IOMMU compilation.

parent c3e454f0
......@@ -72,6 +72,7 @@ static unsigned long *iommu_gart_bitmap; /* guarded by iommu_bitmap_lock */
#define EMERGENCY_PAGES 32 /* = 128KB */
#ifdef CONFIG_AGP
extern int agp_amdk8_init(void);
extern int agp_init(void);
#define AGPEXTERN extern
#else
......@@ -453,10 +454,14 @@ void __init pci_iommu_init(void)
unsigned long aper_size;
unsigned long iommu_start;
#ifndef CONFIG_AGP
#ifndef CONFIG_AGP_AMD_8151
no_agp = 1;
#else
no_agp = no_agp || (agp_init() < 0) || (agp_copy_info(&info) < 0);
/* Add other K8 AGP bridge drivers here */
no_agp = no_agp ||
(agp_init() < 0) ||
(agp_amdk8_init() < 0) ||
(agp_copy_info(&info) < 0);
#endif
if (no_iommu || (!force_mmu && end_pfn < 0xffffffff>>PAGE_SHIFT)) {
......
......@@ -8,6 +8,12 @@
* removed now).
*/
/*
* On x86-64 the AGP driver needs to be initialized early by the IOMMU
* code. When you use this driver as a template for a new K8 AGP bridge
* driver don't forget to change arch/x86_64/kernel/pci-gart.c too -AK.
*/
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/init.h>
......@@ -505,7 +511,8 @@ static struct __initdata pci_driver agp_amdk8_pci_driver = {
.probe = agp_amdk8_probe,
};
static int __init agp_amdk8_init(void)
/* Not static due to IOMMU code calling it early. */
int __init agp_amdk8_init(void)
{
int ret_val;
......@@ -524,8 +531,12 @@ static void __exit agp_amdk8_cleanup(void)
pci_unregister_driver(&agp_amdk8_pci_driver);
}
/* On x86-64 the PCI driver needs to initialize this driver early
for the IOMMU, so it has to be called via a backdoor. */
#ifndef CONFIG_GART_IOMMU
module_init(agp_amdk8_init);
module_exit(agp_amdk8_cleanup);
#endif
MODULE_AUTHOR("Dave Jones <davej@codemonkey.org.uk>");
MODULE_LICENSE("GPL and additional rights");
......
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