summaryrefslogtreecommitdiff
path: root/sys/dev/pci/agp_amd.c
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2007-11-25 17:11:13 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2007-11-25 17:11:13 +0000
commitf6e609402178409f4ffab378b534c5668d547e35 (patch)
tree01a30adae412455b8dc5fff7ffeb751f12ffbb93 /sys/dev/pci/agp_amd.c
parent36d2c964c15e49779643651e2e0f68f3a2b9f26c (diff)
Make agp attach as a device. This means that many more agp bridges
actually get detected and attached. Also adds a kernel api for manipulating agp. Enable this on i386 and amd64. "I think you should commit it" deraadt@, ok matthieu. Looked over by several others.
Diffstat (limited to 'sys/dev/pci/agp_amd.c')
-rw-r--r--sys/dev/pci/agp_amd.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/sys/dev/pci/agp_amd.c b/sys/dev/pci/agp_amd.c
index d09027a3183..ce9c3b2f850 100644
--- a/sys/dev/pci/agp_amd.c
+++ b/sys/dev/pci/agp_amd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: agp_amd.c,v 1.4 2007/10/06 23:50:54 krw Exp $ */
+/* $OpenBSD: agp_amd.c,v 1.5 2007/11/25 17:11:12 oga Exp $ */
/* $NetBSD: agp_amd.c,v 1.6 2001/10/06 02:48:50 thorpej Exp $ */
@@ -74,11 +74,11 @@ struct agp_amd_softc {
bus_space_tag_t iot;
};
-static u_int32_t agp_amd_get_aperture(struct vga_pci_softc *);
-static int agp_amd_set_aperture(struct vga_pci_softc *, u_int32_t);
-static int agp_amd_bind_page(struct vga_pci_softc *, off_t, bus_addr_t);
-static int agp_amd_unbind_page(struct vga_pci_softc *, off_t);
-static void agp_amd_flush_tlb(struct vga_pci_softc *);
+static u_int32_t agp_amd_get_aperture(struct agp_softc *);
+static int agp_amd_set_aperture(struct agp_softc *, u_int32_t);
+static int agp_amd_bind_page(struct agp_softc *, off_t, bus_addr_t);
+static int agp_amd_unbind_page(struct agp_softc *, off_t);
+static void agp_amd_flush_tlb(struct agp_softc *);
struct agp_methods agp_amd_methods = {
@@ -96,7 +96,7 @@ struct agp_methods agp_amd_methods = {
static struct agp_amd_gatt *
-agp_amd_alloc_gatt(struct vga_pci_softc *sc)
+agp_amd_alloc_gatt(struct agp_softc *sc)
{
u_int32_t apsize = AGP_GET_APERTURE(sc);
u_int32_t entries = apsize >> AGP_PAGE_SHIFT;
@@ -104,7 +104,7 @@ agp_amd_alloc_gatt(struct vga_pci_softc *sc)
int i, npages;
caddr_t vdir;
- gatt = malloc(sizeof(struct agp_amd_gatt), M_DEVBUF, M_NOWAIT);
+ gatt = malloc(sizeof(struct agp_amd_gatt), M_AGP, M_NOWAIT);
if (!gatt)
return (0);
@@ -113,7 +113,7 @@ agp_amd_alloc_gatt(struct vga_pci_softc *sc)
&gatt->ag_dmamap, &vdir, &gatt->ag_pdir,
&gatt->ag_dmaseg, 1, &gatt->ag_nseg) != 0) {
printf("failed to allocate GATT\n");
- free(gatt, M_DEVBUF);
+ free(gatt, M_AGP);
return (NULL);
}
@@ -145,42 +145,42 @@ agp_amd_alloc_gatt(struct vga_pci_softc *sc)
#if 0
static void
-agp_amd_free_gatt(struct vga_pci_softc *sc, struct agp_amd_gatt *gatt)
+agp_amd_free_gatt(struct agp_softc *sc, struct agp_amd_gatt *gatt)
{
agp_free_dmamem(sc->sc_dmat, gatt->ag_size,
gatt->ag_dmamap, (caddr_t)gatt->ag_virtual, &gatt->ag_dmaseg,
gatt->ag_nseg);
- free(gatt, M_DEVBUF);
+ free(gatt, M_AGP);
}
#endif
int
-agp_amd_attach(struct vga_pci_softc *sc, struct pci_attach_args *pa, struct pci_attach_args *pchb_pa)
+agp_amd_attach(struct agp_softc *sc, struct pci_attach_args *pa)
{
struct agp_amd_softc *asc;
struct agp_amd_gatt *gatt;
pcireg_t reg;
int error;
- asc = malloc(sizeof *asc, M_DEVBUF, M_NOWAIT | M_ZERO);
+ asc = malloc(sizeof *asc, M_AGP, M_NOWAIT | M_ZERO);
if (asc == NULL) {
printf(": can't allocate softc\n");
/* agp_generic_detach(sc) */
return (ENOMEM);
}
- error = pci_mapreg_map(pchb_pa, AGP_AMD751_REGISTERS,
- PCI_MAPREG_TYPE_MEM,0, &asc->iot, &asc->ioh, NULL, NULL, 0);
+ error = pci_mapreg_map(pa, AGP_AMD751_REGISTERS,
+ PCI_MAPREG_TYPE_MEM, 0, &asc->iot, &asc->ioh, NULL, NULL, 0);
if (error != 0) {
printf(": can't map AGP registers\n");
agp_generic_detach(sc);
return (error);
}
- if (agp_map_aperture(sc, AGP_APBASE, PCI_MAPREG_TYPE_MEM) != 0) {
+ if (agp_map_aperture(pa, sc, AGP_APBASE, PCI_MAPREG_TYPE_MEM) != 0) {
printf(": can't map aperture\n");
agp_generic_detach(sc);
- free(asc, M_DEVBUF);
+ free(asc, M_AGP);
return (ENXIO);
}
sc->sc_methods = &agp_amd_methods;
@@ -221,7 +221,7 @@ agp_amd_attach(struct vga_pci_softc *sc, struct pci_attach_args *pa, struct pci_
#if 0
static int
-agp_amd_detach(struct vga_pci_softc *sc)
+agp_amd_detach(struct agp_softc *sc)
{
pcireg_t reg;
struct agp_amd_softc *asc = sc->sc_chipc;
@@ -250,7 +250,7 @@ agp_amd_detach(struct vga_pci_softc *sc)
#endif
static u_int32_t
-agp_amd_get_aperture(struct vga_pci_softc *sc)
+agp_amd_get_aperture(struct agp_softc *sc)
{
int vas;
@@ -264,7 +264,7 @@ agp_amd_get_aperture(struct vga_pci_softc *sc)
}
static int
-agp_amd_set_aperture(struct vga_pci_softc *sc, u_int32_t aperture)
+agp_amd_set_aperture(struct agp_softc *sc, u_int32_t aperture)
{
int vas;
pcireg_t reg;
@@ -288,7 +288,7 @@ agp_amd_set_aperture(struct vga_pci_softc *sc, u_int32_t aperture)
}
static int
-agp_amd_bind_page(struct vga_pci_softc *sc, off_t offset, bus_addr_t physical)
+agp_amd_bind_page(struct agp_softc *sc, off_t offset, bus_addr_t physical)
{
struct agp_amd_softc *asc = sc->sc_chipc;
@@ -300,7 +300,7 @@ agp_amd_bind_page(struct vga_pci_softc *sc, off_t offset, bus_addr_t physical)
}
static int
-agp_amd_unbind_page(struct vga_pci_softc *sc, off_t offset)
+agp_amd_unbind_page(struct agp_softc *sc, off_t offset)
{
struct agp_amd_softc *asc = sc->sc_chipc;
@@ -312,7 +312,7 @@ agp_amd_unbind_page(struct vga_pci_softc *sc, off_t offset)
}
static void
-agp_amd_flush_tlb(struct vga_pci_softc *sc)
+agp_amd_flush_tlb(struct agp_softc *sc)
{
struct agp_amd_softc *asc = sc->sc_chipc;