Module Name:    src
Committed By:   macallan
Date:           Fri Jul  8 22:21:52 UTC 2016

Modified Files:
        src/sys/arch/macppc/pci: bandit.c

Log Message:
first step to make genfb work with /chaos/control - don't do config space
writes on /chaos.
tested by jak


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/macppc/pci/bandit.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/macppc/pci/bandit.c
diff -u src/sys/arch/macppc/pci/bandit.c:1.31 src/sys/arch/macppc/pci/bandit.c:1.32
--- src/sys/arch/macppc/pci/bandit.c:1.31	Fri Oct  2 05:22:51 2015
+++ src/sys/arch/macppc/pci/bandit.c	Fri Jul  8 22:21:52 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: bandit.c,v 1.31 2015/10/02 05:22:51 msaitoh Exp $	*/
+/*	$NetBSD: bandit.c,v 1.32 2016/07/08 22:21:52 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2000 Tsubai Masanari.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bandit.c,v 1.31 2015/10/02 05:22:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bandit.c,v 1.32 2016/07/08 22:21:52 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -46,6 +46,7 @@ struct bandit_softc {
 	struct genppc_pci_chipset sc_pc;
 	struct powerpc_bus_space sc_iot;
 	struct powerpc_bus_space sc_memt;
+	boolean_t sc_is_chaos;
 };
 
 static void bandit_attach(device_t, device_t, void *);
@@ -53,6 +54,7 @@ static int bandit_match(device_t, cfdata
 
 static pcireg_t bandit_conf_read(void *, pcitag_t, int);
 static void bandit_conf_write(void *, pcitag_t, int, pcireg_t);
+static void chaos_conf_write(void *, pcitag_t, int, pcireg_t);
 
 static void bandit_init(struct bandit_softc *);
 
@@ -89,6 +91,8 @@ bandit_attach(device_t parent, device_t 
 	aprint_normal("\n");
 	sc->sc_dev = self;
 
+	sc->sc_is_chaos = (strcmp(ca->ca_name, "chaos") == 0);
+
 	/* Bandit address */
 	if (OF_getprop(node, "reg", reg, sizeof(reg)) < 8)
 		return;
@@ -131,7 +135,10 @@ bandit_attach(device_t parent, device_t 
 	pc->pc_data = mapiodev(reg[0] + 0xc00000, 8, false);
 	pc->pc_bus = busrange[0];
 	pc->pc_conf_read = bandit_conf_read;
-	pc->pc_conf_write = bandit_conf_write;
+	if (sc->sc_is_chaos) {
+		pc->pc_conf_write = chaos_conf_write;
+	} else
+		pc->pc_conf_write = bandit_conf_write;
 
 	bandit_init(sc);
 
@@ -225,6 +232,15 @@ bandit_conf_write(void *cookie, pcitag_t
 	splx(s);
 }
 
+/*
+ * XXX
+ * /chaos really hates writes to config space, so we just don't do them
+ */
+static void
+chaos_conf_write(void *cookie, pcitag_t tag, int reg, pcireg_t data)
+{
+}
+
 #define	PCI_BANDIT		11
 
 #define	PCI_REG_MODE_SELECT	0x50

Reply via email to