summaryrefslogtreecommitdiff
path: root/sys/arch/macppc/pci
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/macppc/pci')
-rw-r--r--sys/arch/macppc/pci/vgafb.c10
-rw-r--r--sys/arch/macppc/pci/vgafb_pci.c34
-rw-r--r--sys/arch/macppc/pci/vgafb_pcivar.h4
-rw-r--r--sys/arch/macppc/pci/vgafbvar.h3
4 files changed, 26 insertions, 25 deletions
diff --git a/sys/arch/macppc/pci/vgafb.c b/sys/arch/macppc/pci/vgafb.c
index 91d3cb8bc74..19523be8b0a 100644
--- a/sys/arch/macppc/pci/vgafb.c
+++ b/sys/arch/macppc/pci/vgafb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vgafb.c,v 1.48 2013/07/06 18:08:47 mpi Exp $ */
+/* $OpenBSD: vgafb.c,v 1.49 2013/08/12 08:03:56 mpi Exp $ */
/* $NetBSD: vga.c,v 1.3 1996/12/02 22:24:54 cgd Exp $ */
/*
@@ -298,6 +298,14 @@ vgafb_mmap(void *v, off_t off, int prot)
}
int
+vgafb_is_console(int node)
+{
+ extern int fbnode;
+
+ return (fbnode == node);
+}
+
+int
vgafb_cnattach(bus_space_tag_t iot, bus_space_tag_t memt, int type, int check)
{
struct vga_config *vc = &vgafbcn;
diff --git a/sys/arch/macppc/pci/vgafb_pci.c b/sys/arch/macppc/pci/vgafb_pci.c
index a1994ee5815..a32a9d21080 100644
--- a/sys/arch/macppc/pci/vgafb_pci.c
+++ b/sys/arch/macppc/pci/vgafb_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vgafb_pci.c,v 1.31 2013/06/04 02:26:36 mpi Exp $ */
+/* $OpenBSD: vgafb_pci.c,v 1.32 2013/08/12 08:03:56 mpi Exp $ */
/* $NetBSD: vga_pci.c,v 1.4 1996/12/05 01:39:38 cgd Exp $ */
/*
@@ -62,7 +62,6 @@ const struct cfattach vgafb_pci_ca = {
sizeof(struct vga_pci_softc), vgafb_pci_match, vgafb_pci_attach,
};
-pcitag_t vgafb_pci_console_tag;
struct vga_config vgafbcn;
void
@@ -140,6 +139,7 @@ int
vgafb_pci_match(struct device *parent, void *match, void *aux)
{
struct pci_attach_args *pa = aux;
+ int node;
if (DEVICE_IS_VGA_PCI(pa->pa_class) == 0) {
/*
@@ -151,23 +151,15 @@ vgafb_pci_match(struct device *parent, void *match, void *aux)
return (0);
}
- /* If it's the console, we have a winner! */
- if (!bcmp(&pa->pa_tag, &vgafb_pci_console_tag, sizeof(pa->pa_tag))) {
- return (1);
- }
-
-#ifdef DEBUG_VGAFB
- {
- int i;
- pci_chipset_tag_t pc = pa->pa_pc;
- for (i = 0x10; i < 0x24; i+=4) {
- printf("vgafb confread %x %x\n",
- i, pci_conf_read(pc, pa->pa_tag, i));
- }
- }
-#endif
+ /*
+ * XXX Non-console devices do not get configured by the PROM,
+ * XXX so do not attach them yet.
+ */
+ node = PCITAG_NODE(pa->pa_tag);
+ if (!vgafb_is_console(node))
+ return (0);
- return (0);
+ return (1);
}
void
@@ -178,15 +170,17 @@ vgafb_pci_attach(struct device *parent, struct device *self, void *aux)
struct vga_config *vc;
u_int32_t memaddr, memsize;
u_int32_t mmioaddr, mmiosize;
- int console;
+ int console, node;
pcireg_t reg;
+ node = PCITAG_NODE(pa->pa_tag);
+
vga_pci_bar_init(sc, pa);
vgafb_pci_mem_init(sc, &memaddr, &memsize, &mmioaddr, &mmiosize);
- console = (!bcmp(&pa->pa_tag, &vgafb_pci_console_tag, sizeof(pa->pa_tag)));
+ console = vgafb_is_console(node);
if (console) {
vc = sc->sc_vc = &vgafbcn;
diff --git a/sys/arch/macppc/pci/vgafb_pcivar.h b/sys/arch/macppc/pci/vgafb_pcivar.h
index b21b0fcaa46..d2f47cc18c9 100644
--- a/sys/arch/macppc/pci/vgafb_pcivar.h
+++ b/sys/arch/macppc/pci/vgafb_pcivar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vgafb_pcivar.h,v 1.7 2012/12/13 13:55:18 mpi Exp $ */
+/* $OpenBSD: vgafb_pcivar.h,v 1.8 2013/08/12 08:03:56 mpi Exp $ */
/* $NetBSD: vga_pcivar.h,v 1.1 1996/11/19 04:38:36 cgd Exp $ */
/*
@@ -28,7 +28,5 @@
* rights to redistribute these changes.
*/
-extern pcitag_t vgafb_pci_console_tag;
-
/* XXX */
int vgafb_cnattach(bus_space_tag_t, bus_space_tag_t, int, int);
diff --git a/sys/arch/macppc/pci/vgafbvar.h b/sys/arch/macppc/pci/vgafbvar.h
index a49396cb977..c5816575d0f 100644
--- a/sys/arch/macppc/pci/vgafbvar.h
+++ b/sys/arch/macppc/pci/vgafbvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vgafbvar.h,v 1.19 2013/06/04 02:29:32 mpi Exp $ */
+/* $OpenBSD: vgafbvar.h,v 1.20 2013/08/12 08:03:56 mpi Exp $ */
/* $NetBSD: vgavar.h,v 1.2 1996/11/23 06:06:43 cgd Exp $ */
/*
@@ -53,6 +53,7 @@ struct vga_config {
};
int vgafb_cnattach(bus_space_tag_t, bus_space_tag_t, int, int);
+int vgafb_is_console(int);
void vgafb_init(bus_space_tag_t, bus_space_tag_t,
struct vga_config *, u_int32_t, size_t);