summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/amd64/conf/GENERIC4
-rw-r--r--sys/arch/amd64/conf/files.amd649
-rw-r--r--sys/arch/amd64/pci/pchb.c20
-rw-r--r--sys/arch/i386/conf/GENERIC5
-rw-r--r--sys/arch/i386/conf/files.i3869
-rw-r--r--sys/arch/i386/pci/pchb.c23
-rw-r--r--sys/conf/files8
-rw-r--r--sys/dev/ic/vga.c18
-rw-r--r--sys/dev/pci/agp.c7
-rw-r--r--sys/dev/pci/agpvar.h4
-rw-r--r--sys/dev/pci/files.agp22
-rw-r--r--sys/dev/pci/vga_pci.c89
12 files changed, 154 insertions, 64 deletions
diff --git a/sys/arch/amd64/conf/GENERIC b/sys/arch/amd64/conf/GENERIC
index d73dc574843..a3b2d0dfdf7 100644
--- a/sys/arch/amd64/conf/GENERIC
+++ b/sys/arch/amd64/conf/GENERIC
@@ -1,4 +1,4 @@
-# $OpenBSD: GENERIC,v 1.216 2008/02/25 23:16:47 brad Exp $
+# $OpenBSD: GENERIC,v 1.217 2008/03/16 19:00:28 oga Exp $
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
@@ -64,7 +64,7 @@ pci* at pchb?
pcib* at pci? # PCI-ISA bridge
amdpcib* at pci? # AMD 8111 LPC bridge
-agp* at pchb? # AGP bridge
+agp* at vga? # AGP bridge
# National Semiconductor LM7[89] and compatible hardware monitors
lm0 at isa? port 0x290
diff --git a/sys/arch/amd64/conf/files.amd64 b/sys/arch/amd64/conf/files.amd64
index 12f7f9daf8b..7ee92539d4b 100644
--- a/sys/arch/amd64/conf/files.amd64
+++ b/sys/arch/amd64/conf/files.amd64
@@ -1,4 +1,4 @@
-# $OpenBSD: files.amd64,v 1.38 2007/11/26 23:50:03 art Exp $
+# $OpenBSD: files.amd64,v 1.39 2008/03/16 19:00:28 oga Exp $
maxpartitions 16
maxusers 2 16 128
@@ -103,12 +103,13 @@ file arch/amd64/pci/pciide_machdep.c pciide
include "dev/puc/files.puc"
-# AGP
-include "dev/pci/files.agp"
+# AGP devices
+device agp: agp_i810
+attach agp at agpbus
file arch/amd64/pci/agp_machdep.c agp
# PCI Host bridge chipsets
-device pchb: pcibus, agpbus, agp_i810
+device pchb: pcibus
attach pchb at pci
file arch/amd64/pci/pchb.c pchb
diff --git a/sys/arch/amd64/pci/pchb.c b/sys/arch/amd64/pci/pchb.c
index 2e3f9252b48..744da8d0866 100644
--- a/sys/arch/amd64/pci/pchb.c
+++ b/sys/arch/amd64/pci/pchb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pchb.c,v 1.18 2008/01/04 00:23:26 kettenis Exp $ */
+/* $OpenBSD: pchb.c,v 1.19 2008/03/16 19:00:28 oga Exp $ */
/* $NetBSD: pchb.c,v 1.1 2003/04/26 18:39:50 fvdl Exp $ */
/*
* Copyright (c) 2000 Michael Shalayeff
@@ -78,6 +78,8 @@
#include <dev/ic/i82802reg.h>
+#include "agp.h"
+
/* XXX should be in dev/ic/i82424{reg.var}.h */
#define I82424_CPU_BCTL_REG 0x53
#define I82424_PCI_BCTL_REG 0x54
@@ -127,7 +129,6 @@ struct cfdriver pchb_cd = {
};
int pchb_print(void *, const char *);
-int agpbus_print(void *, const char *);
void pchb_rnd(void *);
void pchb_amd64ht_attach(struct device *, struct pci_attach_args *, int);
@@ -148,7 +149,6 @@ pchbattach(struct device *parent, struct device *self, void *aux)
{
struct pchb_softc *sc = (struct pchb_softc *)self;
struct pci_attach_args *pa = aux;
- struct agpbus_attach_args apa;
int has_agp = 0, i, r;
switch (PCI_VENDOR(pa->pa_id)) {
@@ -231,6 +231,7 @@ pchbattach(struct device *parent, struct device *self, void *aux)
break;
}
+#if NAGP > 0
/*
* If we haven't detected AGP yet (via a product ID),
* then check for AGP capability on the device.
@@ -238,10 +239,9 @@ pchbattach(struct device *parent, struct device *self, void *aux)
if (has_agp ||
pci_get_capability(pa->pa_pc, pa->pa_tag, PCI_CAP_AGP,
NULL, NULL) != 0) {
- apa.apa_busname = "agp";
- apa.apa_pci_args = *pa;
- config_found(self, &apa, agpbus_print);
+ agp_set_pchb(pa);
}
+#endif
}
int
@@ -255,14 +255,6 @@ pchb_print(void *aux, const char *pnp)
return (UNCONF);
}
-int
-agpbus_print(void *vaa, const char *pnp)
-{
- if (pnp)
- printf("agp at %s", pnp);
- return (UNCONF);
-}
-
/*
* Should do FIPS testing as per:
* http://csrc.nist.gov/publications/fips/fips140-1/fips1401.pdf
diff --git a/sys/arch/i386/conf/GENERIC b/sys/arch/i386/conf/GENERIC
index 4ff07e85eef..68672b403c6 100644
--- a/sys/arch/i386/conf/GENERIC
+++ b/sys/arch/i386/conf/GENERIC
@@ -1,4 +1,4 @@
-# $OpenBSD: GENERIC,v 1.603 2008/02/25 23:16:47 brad Exp $
+# $OpenBSD: GENERIC,v 1.604 2008/03/16 19:00:28 oga Exp $
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
@@ -85,7 +85,6 @@ gpio* at gscpcib?
glxpcib* at pci? # AMD CS5536 PCI-ISA bridge
gpio* at glxpcib?
-agp* at pchb? # AGP bridges
# power management and other environmental stuff
elansc* at pci? # AMD Elan SC520 System Controller
gpio* at elansc?
@@ -318,6 +317,8 @@ wskbd* at pckbd? mux 1
wsmouse* at pms? mux 0
wsmouse* at pmsi? mux 0
+agp* at vga? # AGP bridges
+
#vesabios0 at mainbus?
# option VESABIOSVERBOSE
diff --git a/sys/arch/i386/conf/files.i386 b/sys/arch/i386/conf/files.i386
index d7ef2e18a9e..669df8ef1f5 100644
--- a/sys/arch/i386/conf/files.i386
+++ b/sys/arch/i386/conf/files.i386
@@ -1,4 +1,4 @@
-# $OpenBSD: files.i386,v 1.172 2008/03/04 21:14:29 oga Exp $
+# $OpenBSD: files.i386,v 1.173 2008/03/16 19:00:28 oga Exp $
#
# new style config file for i386 architecture
#
@@ -96,12 +96,15 @@ file arch/i386/i386/mainbus.c mainbus
#
include "../../../dev/pci/files.pci"
-include "../../../dev/pci/files.agp"
file arch/i386/pci/pci_machdep.c pci
-file arch/i386/pci/agp_machdep.c agp
file arch/i386/pci/pciide_machdep.c pciide
file arch/i386/pci/pcic_pci_machdep.c pcic_pci
+# AGP devices
+device agp: agp_ali, agp_amd, agp_i810, agp_intel, agp_sis, agp_via
+attach agp at agpbus
+file arch/i386/pci/agp_machdep.c agp
+
# PCI-Host bridge chipsets
device pchb: pcibus, agpbus, agp_amd, agp_i810, agp_intel, agp_sis,
agp_via
diff --git a/sys/arch/i386/pci/pchb.c b/sys/arch/i386/pci/pchb.c
index 759bd9c2953..28b8efad035 100644
--- a/sys/arch/i386/pci/pchb.c
+++ b/sys/arch/i386/pci/pchb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pchb.c,v 1.66 2008/01/04 00:23:25 kettenis Exp $ */
+/* $OpenBSD: pchb.c,v 1.67 2008/03/16 19:00:28 oga Exp $ */
/* $NetBSD: pchb.c,v 1.65 2007/08/15 02:26:13 markd Exp $ */
/*
@@ -79,6 +79,8 @@
#include <dev/ic/i82802reg.h>
+#include "agp.h"
+
#define PCISET_INTEL_BRIDGETYPE_MASK 0x3
#define PCISET_INTEL_TYPE_COMPAT 0x1
#define PCISET_INTEL_TYPE_AUX 0x2
@@ -139,7 +141,6 @@ struct cfdriver pchb_cd = {
};
int pchb_print(void *, const char *);
-int agpbus_print(void *, const char *);
void pchb_rnd(void *);
void pchb_amd64ht_attach(struct device *, struct pci_attach_args *, int);
@@ -174,7 +175,6 @@ pchbattach(struct device *parent, struct device *self, void *aux)
struct pchb_softc *sc = (struct pchb_softc *)self;
struct pci_attach_args *pa = aux;
struct pcibus_attach_args pba;
- struct agpbus_attach_args apa;
pcireg_t bcreg;
u_char bdnum, pbnum;
pcitag_t tag;
@@ -396,17 +396,16 @@ pchbattach(struct device *parent, struct device *self, void *aux)
break;
}
+#if NAGP > 0
/*
* If we haven't detected AGP yet (via a product ID),
* then check for AGP capability on the device.
*/
if (has_agp ||
pci_get_capability(pa->pa_pc, pa->pa_tag, PCI_CAP_AGP,
- NULL, NULL) != 0) {
- apa.apa_busname = "agp";
- apa.apa_pci_args = *pa;
- config_found(self, &apa, agpbus_print);
- }
+ NULL, NULL) != 0)
+ agp_set_pchb(pa);
+#endif /* NAGP > 0 */
#ifdef __i386__
if (doattach == 0)
return;
@@ -434,14 +433,6 @@ pchb_print(void *aux, const char *pnp)
return (UNCONF);
}
-int
-agpbus_print(void *vaa, const char *pnp)
-{
- if (pnp)
- printf("agp at %s", pnp);
- return (UNCONF);
-}
-
/*
* Should do FIPS testing as per:
* http://csrc.nist.gov/publications/fips/fips140-1/fips1401.pdf
diff --git a/sys/conf/files b/sys/conf/files
index 6cfc49eb7d8..c0b45aa724e 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -1,4 +1,4 @@
-# $OpenBSD: files,v 1.424 2008/01/21 20:00:32 sobrado Exp $
+# $OpenBSD: files,v 1.425 2008/03/16 19:00:28 oga Exp $
# $NetBSD: files,v 1.87 1996/05/19 17:17:50 jonathan Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
@@ -93,12 +93,16 @@ file dev/ic/pcdisplay_chars.c pcdisplayops
define mk48txx
file dev/ic/mk48txx.c mk48txx
+# AGP
+define agpbus {}
+include "dev/pci/files.agp"
+
# DRM - Direct Rendering Manager: /dev/drm
define drm {}
include "dev/pci/drm/files.drm"
# VGA graphics
-device vga: wsemuldisplaydev, pcdisplayops, drm
+device vga: wsemuldisplaydev, pcdisplayops, drm, agpbus
file dev/ic/vga.c vga & (vga_pci | vga_isa) needs-flag
file dev/ic/vga_subr.c vga & (vga_pci | vga_isa) needs-flag
diff --git a/sys/dev/ic/vga.c b/sys/dev/ic/vga.c
index e7458f9456d..0f64441b4a0 100644
--- a/sys/dev/ic/vga.c
+++ b/sys/dev/ic/vga.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vga.c,v 1.46 2007/10/01 04:03:51 krw Exp $ */
+/* $OpenBSD: vga.c,v 1.47 2008/03/16 19:00:28 oga Exp $ */
/* $NetBSD: vga.c,v 1.28.2.1 2000/06/30 16:27:47 simonb Exp $ */
/*
@@ -100,6 +100,8 @@ int vga_alloc_attr(void *, int, int, int, long *);
void vga_copyrows(void *, int, int, int);
void vga_unpack_attr(void *, long, int *, int *, int *);
+int displaysubmatch(struct device *, void *, void *);
+
static const struct wsdisplay_emulops vga_emulops = {
pcdisplay_cursor,
vga_mapchar,
@@ -545,7 +547,19 @@ vga_extended_attach(self, iot, memt, type, map)
aa.accesscookie = vc;
aa.defaultscreens = 0;
- config_found(self, &aa, wsemuldisplaydevprint);
+ config_found_sm(self, &aa, wsemuldisplaydevprint, displaysubmatch);
+}
+
+int
+displaysubmatch(struct device *parent, void *match, void *aux)
+{
+ extern struct cfdriver wsdisplay_cd;
+ struct cfdata *cf = match;
+
+ /* only allow wsdisplay to attach */
+ if (cf->cf_driver == &wsdisplay_cd)
+ return ((*cf->cf_attach->ca_match)(parent, match, aux));
+ return (0);
}
int
diff --git a/sys/dev/pci/agp.c b/sys/dev/pci/agp.c
index 49bcbef2704..05526203d67 100644
--- a/sys/dev/pci/agp.c
+++ b/sys/dev/pci/agp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: agp.c,v 1.16 2008/01/04 00:23:26 kettenis Exp $ */
+/* $OpenBSD: agp.c,v 1.17 2008/03/16 19:00:28 oga Exp $ */
/*-
* Copyright (c) 2000 Doug Rabson
* All rights reserved.
@@ -110,6 +110,11 @@ agp_probe(struct device *parent, void *match, void *aux)
struct agpbus_attach_args *aaa = aux;
struct pci_attach_args *pa = &aaa->apa_pci_args;
+ /* pci_args must be a pchb */
+ if (PCI_CLASS(pa->pa_class) != PCI_CLASS_BRIDGE ||
+ PCI_SUBCLASS(pa->pa_class) != PCI_SUBCLASS_BRIDGE_HOST)
+ return (0);
+
if (agp_lookup(pa) == NULL)
return (0);
diff --git a/sys/dev/pci/agpvar.h b/sys/dev/pci/agpvar.h
index ecceb70dd88..2f8b9d9a495 100644
--- a/sys/dev/pci/agpvar.h
+++ b/sys/dev/pci/agpvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: agpvar.h,v 1.10 2007/12/07 17:35:22 oga Exp $ */
+/* $OpenBSD: agpvar.h,v 1.11 2008/03/16 19:00:28 oga Exp $ */
/* $NetBSD: agpvar.h,v 1.4 2001/10/01 21:54:48 fvdl Exp $ */
/*-
@@ -44,7 +44,6 @@
#define AGPUNIT(x) minor(x)
struct agpbus_attach_args {
- char *apa_busname;
struct pci_attach_args apa_pci_args;
};
@@ -174,6 +173,7 @@ paddr_t agpmmap(void *, off_t, int);
int agpioctl(dev_t, u_long, caddr_t, int, struct proc *);
int agpopen(dev_t, int, int, struct proc *);
int agpclose(dev_t, int, int , struct proc *);
+void agp_set_pchb(struct pci_attach_args*);
/*
* Functions private to the AGP code.
*/
diff --git a/sys/dev/pci/files.agp b/sys/dev/pci/files.agp
index e1b5249e1f3..cdd86684e62 100644
--- a/sys/dev/pci/files.agp
+++ b/sys/dev/pci/files.agp
@@ -1,31 +1,27 @@
-# $OpenBSD: files.agp,v 1.1 2007/11/25 17:11:12 oga Exp $
+# $OpenBSD: files.agp,v 1.2 2008/03/16 19:00:28 oga Exp $
-define agpbus { }
-
-device agp
-attach agp at agpbus
file dev/pci/agp.c agp needs-flag
define agp_ali
-file dev/pci/agp_ali.c agp_ali & agp needs-flag
+file dev/pci/agp_ali.c agp_ali & agpbus needs-flag
define agp_amd
-file dev/pci/agp_amd.c agp_amd & agp needs-flag
+file dev/pci/agp_amd.c agp_amd & agpbus needs-flag
define agp_apple
-file dev/pci/agp_apple.c agp_apple & agp needs-flag
+file dev/pci/agp_apple.c agp_apple & agpbus needs-flag
define agp_i810
-file dev/pci/agp_i810.c agp_i810 & agp needs-flag
+file dev/pci/agp_i810.c agp_i810 & agpbus needs-flag
define agp_intel
-file dev/pci/agp_intel.c agp_intel & agp needs-flag
+file dev/pci/agp_intel.c agp_intel & agpbus needs-flag
define agp_sis
-file dev/pci/agp_sis.c agp_sis & agp needs-flag
+file dev/pci/agp_sis.c agp_sis & agpbus needs-flag
define agp_via
-file dev/pci/agp_via.c agp_via & agp needs-flag
+file dev/pci/agp_via.c agp_via & agpbus needs-flag
define agp_amd64
-file dev/pci/agp_amd64.c agp_amd64 & agp needs-flag
+file dev/pci/agp_amd64.c agp_amd64 & agpbus needs-flag
diff --git a/sys/dev/pci/vga_pci.c b/sys/dev/pci/vga_pci.c
index 6f8abdb67c3..7caf597c200 100644
--- a/sys/dev/pci/vga_pci.c
+++ b/sys/dev/pci/vga_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vga_pci.c,v 1.29 2007/11/28 23:37:34 oga Exp $ */
+/* $OpenBSD: vga_pci.c,v 1.30 2008/03/16 19:00:28 oga Exp $ */
/* $NetBSD: vga_pci.c,v 1.3 1998/06/08 06:55:58 thorpej Exp $ */
/*
@@ -79,6 +79,8 @@
#include <dev/pci/pcivar.h>
#include <dev/pci/pcidevs.h>
+#include <dev/pci/agpvar.h>
+
#include <dev/ic/mc6845reg.h>
#include <dev/ic/pcdisplayvar.h>
#include <dev/ic/vgareg.h>
@@ -93,12 +95,21 @@
#include <dev/vesa/vesabiosvar.h>
#endif
+#include "agp.h"
#include "drmbase.h"
int vga_pci_match(struct device *, void *, void *);
void vga_pci_attach(struct device *, struct device *, void *);
paddr_t vga_pci_mmap(void* v, off_t off, int prot);
-int vga_drm_print(void *, const char *);
+
+#if NAGP > 0
+int agpsubmatch(struct device *, void *, void *);
+int agpbus_print(void *, const char *);
+#endif
+#if NDRMBASE > 0
+int drmsubmatch(struct device *, void *, void *);
+int vga_drm_print(void *, const char *);
+#endif
#ifdef VESAFB
int vesafb_putcmap(struct vga_pci_softc *, struct wsdisplay_cmap *);
@@ -109,6 +120,20 @@ struct cfattach vga_pci_ca = {
sizeof(struct vga_pci_softc), vga_pci_match, vga_pci_attach,
};
+#if NAGP > 0
+struct pci_attach_args agp_pchb_pa;
+int agp_pchb_pa_set = 0;
+
+void
+agp_set_pchb(struct pci_attach_args *pa)
+{
+ if (!agp_pchb_pa_set) {
+ memcpy(&agp_pchb_pa, pa, sizeof *pa);
+ agp_pchb_pa_set++;
+ }
+}
+#endif
+
int
vga_pci_match(struct device *parent, void *match, void *aux)
{
@@ -140,6 +165,9 @@ void
vga_pci_attach(struct device *parent, struct device *self, void *aux)
{
struct pci_attach_args *pa = aux;
+#if NAGP >0
+ struct agpbus_attach_args aba;
+#endif
pcireg_t reg;
#ifdef VESAFB
struct vga_pci_softc *sc = (struct vga_pci_softc *)self;
@@ -165,11 +193,65 @@ vga_pci_attach(struct device *parent, struct device *self, void *aux)
vga_common_attach(self, pa->pa_iot, pa->pa_memt,
WSDISPLAY_TYPE_PCIVGA);
+#if NAGP > 0
+ /*
+ * attach agp here instead of pchb so it can share mappings
+ * with the DRM
+ */
+ if (agp_pchb_pa_set) {
+ aba.apa_pci_args = agp_pchb_pa;
+ config_found_sm(self, &aba, agpbus_print, agpsubmatch);
+
+ }
+#endif
+
#if NDRMBASE > 0
- config_found(self, aux, vga_drm_print);
+ config_found_sm(self, aux, vga_drm_print, drmsubmatch);
#endif
}
+#if NAGP > 0
+int
+agpsubmatch(struct device *parent, void *match, void *aux)
+{
+ extern struct cfdriver agp_cd;
+ struct cfdata *cf = match;
+
+ /* only allow agp to attach */
+ if (cf->cf_driver == &agp_cd)
+ return ((*cf->cf_attach->ca_match)(parent, match, aux));
+ return (0);
+}
+
+int
+agpbus_print(void *vaa, const char *pnp)
+{
+ if (pnp)
+ printf("agp at %s", pnp);
+ return (UNCONF);
+}
+#endif
+
+#if NDRMBASE > 0
+int
+drmsubmatch(struct device *parent, void *match, void *aux)
+{
+ struct cfdata *cf = match;
+ struct cfdriver *cd;
+ size_t len = 0;
+ char *sm;
+
+ cd = cf->cf_driver;
+
+ /* is this a *drm device? */
+ len = strlen(cd->cd_name);
+ sm = cd->cd_name + len -3;
+ if (strncmp(sm,"drm",3) == 0)
+ return ((*cf->cf_attach->ca_match)(parent, match, aux));
+
+ return (0);
+}
+
int
vga_drm_print(void *aux, const char *pnp)
{
@@ -177,6 +259,7 @@ vga_drm_print(void *aux, const char *pnp)
printf("direct rendering for %s", pnp);
return (UNSUPP);
}
+#endif
paddr_t
vga_pci_mmap(void *v, off_t off, int prot)