FreeBSD kernel AGP device code
agp_amd64.c File Reference
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/malloc.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/bus.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/proc.h>
#include <dev/agp/agppriv.h>
#include <dev/agp/agpreg.h>
#include <dev/pci/pcivar.h>
#include <dev/pci/pcireg.h>
#include <vm/vm.h>
#include <vm/vm_object.h>
#include <vm/pmap.h>
#include <machine/bus.h>
#include <machine/resource.h>
#include <sys/rman.h>
Include dependency graph for agp_amd64.c:

Go to the source code of this file.

Data Structures

struct  agp_amd64_softc
 

Macros

#define AMD64_MAX_MCTRL   8
 
#define AGP_AMD64_TABLE_SIZE   nitems(agp_amd64_table)
 

Functions

 __FBSDID ("$FreeBSD$")
 
void pci_cfgregwrite (int, int, int, int, uint32_t, int)
 
uint32_t pci_cfgregread (int, int, int, int, int)
 
static void agp_amd64_apbase_fixup (device_t)
 
static void agp_amd64_uli_init (device_t)
 
static int agp_amd64_uli_set_aperture (device_t, uint32_t)
 
static int agp_amd64_nvidia_match (uint16_t)
 
static void agp_amd64_nvidia_init (device_t)
 
static int agp_amd64_nvidia_set_aperture (device_t, uint32_t)
 
static int agp_amd64_via_match (void)
 
static void agp_amd64_via_init (device_t)
 
static int agp_amd64_via_set_aperture (device_t, uint32_t)
 
 MALLOC_DECLARE (M_AGP)
 
static const char * agp_amd64_match (device_t dev)
 
static int agp_amd64_probe (device_t dev)
 
static int agp_amd64_attach (device_t dev)
 
static int agp_amd64_detach (device_t dev)
 
static uint32_t agp_amd64_get_aperture (device_t dev)
 
static int agp_amd64_set_aperture (device_t dev, uint32_t aperture)
 
static int agp_amd64_bind_page (device_t dev, vm_offset_t offset, vm_offset_t physical)
 
static int agp_amd64_unbind_page (device_t dev, vm_offset_t offset)
 
static void agp_amd64_flush_tlb (device_t dev)
 
 DRIVER_MODULE (agp_amd64, hostb, agp_amd64_driver, agp_devclass, 0, 0)
 
 MODULE_DEPEND (agp_amd64, agp, 1, 1, 1)
 
 MODULE_DEPEND (agp_amd64, pci, 1, 1, 1)
 

Variables

static uint32_t agp_amd64_table []
 
static device_method_t agp_amd64_methods []
 
static driver_t agp_amd64_driver
 
static devclass_t agp_devclass
 

Macro Definition Documentation

◆ AGP_AMD64_TABLE_SIZE

#define AGP_AMD64_TABLE_SIZE   nitems(agp_amd64_table)

Definition at line 279 of file agp_amd64.c.

◆ AMD64_MAX_MCTRL

#define AMD64_MAX_MCTRL   8

Definition at line 73 of file agp_amd64.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ agp_amd64_apbase_fixup()

static void agp_amd64_apbase_fixup ( device_t  dev)
static

Definition at line 372 of file agp_amd64.c.

References agp_amd64_softc::agp, AGP_AMD64_APBASE, AGP_AMD64_APBASE_MASK, agp_amd64_softc::apbase, agp_softc::as_aperture, agp_amd64_softc::mctrl, agp_amd64_softc::n_mctrl, and pci_cfgregwrite().

Referenced by agp_amd64_nvidia_init(), agp_amd64_uli_init(), and agp_amd64_via_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agp_amd64_attach()

◆ agp_amd64_bind_page()

static int agp_amd64_bind_page ( device_t  dev,
vm_offset_t  offset,
vm_offset_t  physical 
)
static

◆ agp_amd64_detach()

static int agp_amd64_detach ( device_t  dev)
static

◆ agp_amd64_flush_tlb()

static void agp_amd64_flush_tlb ( device_t  dev)
static

Definition at line 360 of file agp_amd64.c.

References AGP_AMD64_CACHECTRL, AGP_AMD64_CACHECTRL_INVGART, agp_amd64_softc::mctrl, agp_amd64_softc::n_mctrl, pci_cfgregread(), and pci_cfgregwrite().

Here is the call graph for this function:

◆ agp_amd64_get_aperture()

static uint32_t agp_amd64_get_aperture ( device_t  dev)
static

Definition at line 282 of file agp_amd64.c.

References AGP_AMD64_APCTRL, AGP_AMD64_APCTRL_SIZE_MASK, agp_amd64_table, AGP_AMD64_TABLE_SIZE, agp_amd64_softc::mctrl, and pci_cfgregread().

Here is the call graph for this function:

◆ agp_amd64_match()

static const char * agp_amd64_match ( device_t  dev)
static

Definition at line 86 of file agp_amd64.c.

References agp_amd64_nvidia_match(), and agp_find_caps().

Referenced by agp_amd64_probe().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agp_amd64_nvidia_init()

static void agp_amd64_nvidia_init ( device_t  dev)
static

Definition at line 419 of file agp_amd64.c.

References agp_amd64_apbase_fixup(), AGP_AMD64_NVIDIA_0_APBASE, AGP_AMD64_NVIDIA_1_APBASE1, AGP_AMD64_NVIDIA_1_APBASE2, agp_amd64_softc::apbase, and pci_cfgregwrite().

Referenced by agp_amd64_attach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agp_amd64_nvidia_match()

static int agp_amd64_nvidia_match ( uint16_t  devid)
static

Definition at line 124 of file agp_amd64.c.

References pci_cfgregread().

Referenced by agp_amd64_match().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agp_amd64_nvidia_set_aperture()

static int agp_amd64_nvidia_set_aperture ( device_t  dev,
uint32_t  aperture 
)
static

Definition at line 432 of file agp_amd64.c.

References AGP_AMD64_NVIDIA_1_APLIMIT1, AGP_AMD64_NVIDIA_1_APLIMIT2, AGP_AMD64_NVIDIA_1_APSIZE, agp_amd64_softc::apbase, aperture, pci_cfgregread(), and pci_cfgregwrite().

Referenced by agp_amd64_attach(), and agp_amd64_set_aperture().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agp_amd64_probe()

static int agp_amd64_probe ( device_t  dev)
static

Definition at line 151 of file agp_amd64.c.

References agp_amd64_match().

Here is the call graph for this function:

◆ agp_amd64_set_aperture()

static int agp_amd64_set_aperture ( device_t  dev,
uint32_t  aperture 
)
static

◆ agp_amd64_uli_init()

static void agp_amd64_uli_init ( device_t  dev)
static

Definition at line 386 of file agp_amd64.c.

References agp_amd64_apbase_fixup(), AGP_AMD64_ULI_APBASE, AGP_AMD64_ULI_HTT_FEATURE, and agp_amd64_softc::apbase.

Referenced by agp_amd64_attach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agp_amd64_uli_set_aperture()

static int agp_amd64_uli_set_aperture ( device_t  dev,
uint32_t  aperture 
)
static

Definition at line 398 of file agp_amd64.c.

References AGP_AMD64_ULI_ENU_SCR, agp_amd64_softc::apbase, and aperture.

Referenced by agp_amd64_attach(), and agp_amd64_set_aperture().

Here is the caller graph for this function:

◆ agp_amd64_unbind_page()

static int agp_amd64_unbind_page ( device_t  dev,
vm_offset_t  offset 
)
static

Definition at line 347 of file agp_amd64.c.

References agp_gatt::ag_entries, agp_gatt::ag_virtual, agp_amd64_softc::gatt, and offset.

◆ agp_amd64_via_init()

static void agp_amd64_via_init ( device_t  dev)
static

Definition at line 459 of file agp_amd64.c.

References agp_gatt::ag_physical, AGP3_VIA_ATTBASE, AGP3_VIA_GARTCTRL, agp_amd64_apbase_fixup(), agp_amd64_softc::gatt, pci_cfgregread(), and pci_cfgregwrite().

Referenced by agp_amd64_attach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agp_amd64_via_match()

static int agp_amd64_via_match ( void  )
static

Definition at line 137 of file agp_amd64.c.

References AGP_VIA_AGPSEL, and pci_cfgregread().

Referenced by agp_amd64_attach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agp_amd64_via_set_aperture()

static int agp_amd64_via_set_aperture ( device_t  dev,
uint32_t  aperture 
)
static

Definition at line 470 of file agp_amd64.c.

References AGP3_VIA_APSIZE, aperture, and pci_cfgregwrite().

Referenced by agp_amd64_attach(), and agp_amd64_set_aperture().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DRIVER_MODULE()

DRIVER_MODULE ( agp_amd64  ,
hostb  ,
agp_amd64_driver  ,
agp_devclass  ,
,
 
)

◆ MALLOC_DECLARE()

MALLOC_DECLARE ( M_AGP  )

◆ MODULE_DEPEND() [1/2]

MODULE_DEPEND ( agp_amd64  ,
agp  ,
,
,
 
)

◆ MODULE_DEPEND() [2/2]

MODULE_DEPEND ( agp_amd64  ,
pci  ,
,
,
 
)

◆ pci_cfgregread()

uint32_t pci_cfgregread ( int  ,
int  ,
int  ,
int  ,
int   
)

◆ pci_cfgregwrite()

void pci_cfgregwrite ( int  ,
int  ,
int  ,
int  ,
uint32_t  ,
int   
)

Variable Documentation

◆ agp_amd64_driver

driver_t agp_amd64_driver
static
Initial value:
= {
"agp",
sizeof(struct agp_amd64_softc),
}
static device_method_t agp_amd64_methods[]
Definition: agp_amd64.c:482

Definition at line 505 of file agp_amd64.c.

◆ agp_amd64_methods

device_method_t agp_amd64_methods[]
static
Initial value:
= {
DEVMETHOD(device_probe, agp_amd64_probe),
DEVMETHOD(device_attach, agp_amd64_attach),
DEVMETHOD(device_detach, agp_amd64_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
DEVMETHOD(device_suspend, bus_generic_suspend),
DEVMETHOD(device_resume, bus_generic_resume),
DEVMETHOD(agp_get_aperture, agp_amd64_get_aperture),
DEVMETHOD(agp_set_aperture, agp_amd64_set_aperture),
DEVMETHOD(agp_bind_page, agp_amd64_bind_page),
DEVMETHOD(agp_unbind_page, agp_amd64_unbind_page),
DEVMETHOD(agp_flush_tlb, agp_amd64_flush_tlb),
{ 0, 0 }
}
struct agp_memory * agp_generic_alloc_memory(device_t dev, int type, vm_size_t size)
Definition: agp.c:496
int agp_bind_memory(device_t dev, void *handle, vm_offset_t offset)
Definition: agp.c:982
void agp_free_memory(device_t dev, void *handle)
Definition: agp.c:976
int agp_generic_bind_memory(device_t dev, struct agp_memory *mem, vm_offset_t offset)
Definition: agp.c:543
int agp_generic_unbind_memory(device_t dev, struct agp_memory *mem)
Definition: agp.c:649
int agp_unbind_memory(device_t dev, void *handle)
Definition: agp.c:988
int agp_generic_free_memory(device_t dev, struct agp_memory *mem)
Definition: agp.c:528
void * agp_alloc_memory(device_t dev, int type, vm_size_t bytes)
Definition: agp.c:971
int agp_generic_enable(device_t dev, u_int32_t mode)
Definition: agp.c:466
int agp_enable(device_t dev, u_int32_t mode)
Definition: agp.c:966
static int agp_amd64_set_aperture(device_t dev, uint32_t aperture)
Definition: agp_amd64.c:297
static uint32_t agp_amd64_get_aperture(device_t dev)
Definition: agp_amd64.c:282
static int agp_amd64_bind_page(device_t dev, vm_offset_t offset, vm_offset_t physical)
Definition: agp_amd64.c:333
static int agp_amd64_attach(device_t dev)
Definition: agp_amd64.c:166
static int agp_amd64_probe(device_t dev)
Definition: agp_amd64.c:151
static void agp_amd64_flush_tlb(device_t dev)
Definition: agp_amd64.c:360
static int agp_amd64_detach(device_t dev)
Definition: agp_amd64.c:250
static int agp_amd64_unbind_page(device_t dev, vm_offset_t offset)
Definition: agp_amd64.c:347

Definition at line 482 of file agp_amd64.c.

◆ agp_amd64_table

uint32_t agp_amd64_table[]
static
Initial value:
= {
0x02000000,
0x04000000,
0x08000000,
0x10000000,
0x20000000,
0x40000000,
0x80000000,
}

Definition at line 269 of file agp_amd64.c.

Referenced by agp_amd64_get_aperture(), and agp_amd64_set_aperture().

◆ agp_devclass

devclass_t agp_devclass
static

Definition at line 511 of file agp_amd64.c.