34#include <sys/malloc.h>
35#include <sys/kernel.h>
36#include <sys/module.h>
44#include <dev/pci/pcivar.h>
45#include <dev/pci/pcireg.h>
48#include <vm/vm_object.h>
50#include <machine/bus.h>
51#include <machine/resource.h>
73#define AMD64_MAX_MCTRL 8
88 if (pci_get_class(dev) != PCIC_BRIDGE ||
89 pci_get_subclass(dev) != PCIS_BRIDGE_HOST ||
93 switch (pci_get_devid(dev)) {
95 return (
"AMD 8151 AGP graphics tunnel");
97 return (
"SiS 755 host to AGP bridge");
99 return (
"SiS 760 host to AGP bridge");
101 return (
"ULi M1689 AGP Controller");
105 return (
"NVIDIA nForce3 AGP Controller");
109 return (
"NVIDIA nForce3-250 AGP Controller");
111 return (
"VIA 8380 host to PCI bridge");
113 return (
"VIA 3238 host to PCI bridge");
115 return (
"VIA K8T800Pro host to PCI bridge");
117 return (
"VIA 8385 host to PCI bridge");
155 if (resource_disabled(
"agp", device_get_unit(dev)))
158 device_set_desc(dev, desc);
159 return (BUS_PROBE_DEFAULT);
175 if (devid == 0x11031022 || devid == 0x12031022) {
186 device_printf(dev,
"%d Miscellaneous Control unit(s) found.\n",
203 if (AGP_SET_APERTURE(dev, AGP_GET_APERTURE(dev) / 2)) {
210 switch (pci_get_vendor(dev)) {
235 for (i = 0; i < sc->
n_mctrl; i++) {
257 for (i = 0; i < sc->
n_mctrl; i++)
279#define AGP_AMD64_TABLE_SIZE nitems(agp_amd64_table)
309 for (j = 0; j < sc->
n_mctrl; j++)
314 switch (pci_get_vendor(dev)) {
365 for (i = 0; i < sc->
n_mctrl; i++)
380 for (i = 0; i < sc->
n_mctrl; i++)
438 case 0x02000000: apsize = 0x0f;
break;
439 case 0x04000000: apsize = 0x0e;
break;
440 case 0x08000000: apsize = 0x0c;
break;
441 case 0x10000000: apsize = 0x08;
break;
442 case 0x20000000: apsize = 0x00;
break;
449 0xfffffff0) | apsize, 4);
474 apsize = ((
aperture - 1) >> 20) ^ 0xff;
475 if ((((apsize ^ 0xff) << 20) | ((1 << 20) - 1)) + 1 !=
aperture)
487 DEVMETHOD(device_shutdown, bus_generic_shutdown),
488 DEVMETHOD(device_suspend, bus_generic_suspend),
489 DEVMETHOD(device_resume, bus_generic_resume),
struct agp_memory * agp_generic_alloc_memory(device_t dev, int type, vm_size_t size)
int agp_bind_memory(device_t dev, void *handle, vm_offset_t offset)
void agp_free_memory(device_t dev, void *handle)
int agp_generic_bind_memory(device_t dev, struct agp_memory *mem, vm_offset_t offset)
int agp_generic_unbind_memory(device_t dev, struct agp_memory *mem)
int agp_unbind_memory(device_t dev, void *handle)
int agp_generic_detach(device_t dev)
int agp_generic_attach(device_t dev)
int agp_generic_free_memory(device_t dev, struct agp_memory *mem)
u_int8_t agp_find_caps(device_t dev)
void agp_free_res(device_t dev)
void agp_free_cdev(device_t dev)
void * agp_alloc_memory(device_t dev, int type, vm_size_t bytes)
void agp_free_gatt(struct agp_gatt *gatt)
struct agp_gatt * agp_alloc_gatt(device_t dev)
int agp_generic_enable(device_t dev, u_int32_t mode)
int agp_enable(device_t dev, u_int32_t mode)
static void agp_amd64_via_init(device_t)
static int agp_amd64_nvidia_set_aperture(device_t, uint32_t)
static int agp_amd64_set_aperture(device_t dev, uint32_t aperture)
DRIVER_MODULE(agp_amd64, hostb, agp_amd64_driver, agp_devclass, 0, 0)
static int agp_amd64_nvidia_match(uint16_t)
static uint32_t agp_amd64_get_aperture(device_t dev)
static int agp_amd64_via_match(void)
#define AGP_AMD64_TABLE_SIZE
static int agp_amd64_via_set_aperture(device_t, uint32_t)
static uint32_t agp_amd64_table[]
static void agp_amd64_uli_init(device_t)
static int agp_amd64_bind_page(device_t dev, vm_offset_t offset, vm_offset_t physical)
static int agp_amd64_attach(device_t dev)
static void agp_amd64_nvidia_init(device_t)
static void agp_amd64_apbase_fixup(device_t)
MODULE_DEPEND(agp_amd64, agp, 1, 1, 1)
static int agp_amd64_uli_set_aperture(device_t, uint32_t)
void pci_cfgregwrite(int, int, int, int, uint32_t, int)
static devclass_t agp_devclass
static const char * agp_amd64_match(device_t dev)
static int agp_amd64_probe(device_t dev)
uint32_t pci_cfgregread(int, int, int, int, int)
static device_method_t agp_amd64_methods[]
static void agp_amd64_flush_tlb(device_t dev)
static int agp_amd64_detach(device_t dev)
static driver_t agp_amd64_driver
static int agp_amd64_unbind_page(device_t dev, vm_offset_t offset)
#define AGP_AMD64_CACHECTRL
#define AGP_AMD64_NVIDIA_1_APSIZE
#define AGP_AMD64_APCTRL_DISGARTIO
#define AGP_AMD64_NVIDIA_0_APBASE
#define AGP_AMD64_APCTRL_DISGARTCPU
#define AGP_AMD64_APBASE_MASK
#define AGP_AMD64_ULI_HTT_FEATURE
#define AGP_AMD64_NVIDIA_1_APBASE2
#define AGP_AMD64_NVIDIA_1_APLIMIT1
#define AGP_AMD64_CACHECTRL_INVGART
#define AGP_AMD64_ATTBASE
#define AGP_AMD64_NVIDIA_1_APLIMIT2
#define AGP_AMD64_ULI_APBASE
#define AGP_AMD64_APCTRL_GARTEN
#define AGP_AMD64_ULI_ENU_SCR
#define AGP_AMD64_ATTBASE_MASK
#define AGP3_VIA_GARTCTRL
#define AGP_AMD64_NVIDIA_1_APBASE1
#define AGP_AMD64_APCTRL_SIZE_MASK
int mctrl[AMD64_MAX_MCTRL]
uint32_t initial_aperture
struct resource * as_aperture