Daniel,
On 08/03/13(Fri) 02:42, Daniel Dickman wrote:
> OpenBSD currently causes my PowerBook G4 laptop to power off at boot
> time. This problem seems to happen on the later PowerBook models (5,8
> and 5,9) that don't have the ADB bus. The current workaround is:
>
> UKC> disable adb
> 142 adb* disabled
> UKC> disable akbd
> 143 akbd* disabled
> UKC> quit
>
> NetBSD fixed this in sys/arch/macppc/dev/adb.c.diff revision 1.21[1].
> (Also, revision 1.28[2] drops clauses 3 and 4). I adapted those
> patches for OpenBSD[3] and testing confirms that the laptop no longer
> shuts down while booting.
>
> It seems like a few other people have had the same problem over the
> years. See: [4], [5], [6], [7], ....
Thanks for spotting this and backporting the fix. I believe that a real
solution would be to have two separate drivers one for adb and one for
pmu or cuda, so that we won't have to attach adb(4) if a machine doesn't
have an ADB bus.
But I'm not sure anyone will ever do this work, so I' fine with your
diff. I already tested that it doesn't break machines with an ADB bus.
However I don't want to commit a license change *and* a modification at
the same time.
Here's the workaround for machine that don't have an ADB bus, anyone
wants to ok it?
M.
Index: adb.c
===================================================================
RCS file: /home/cvs/src/sys/arch/macppc/dev/adb.c,v
retrieving revision 1.34
diff -u -r1.34 adb.c
--- adb.c 16 Jun 2011 10:51:48 -0000 1.34
+++ adb.c 3 Mar 2013 13:52:23 -0000
@@ -1595,7 +1590,7 @@
ADBDataBlock adbdata;
struct adb_attach_args aa_args;
int totaladbs;
- int adbindex, adbaddr;
+ int adbindex, adbaddr, adb_node;
ca->ca_reg[0] += ca->ca_baseaddr;
@@ -1624,7 +1619,9 @@
}
adb_polling = 1;
- adb_reinit();
+ adb_node = OF_getnodebyname(ca->ca_node, "adb");
+ if (adb_node)
+ adb_reinit();
mac_intr_establish(parent, ca->ca_intr[0], IST_LEVEL, IPL_HIGH,
adb_intr, sc, sc->sc_dev.dv_xname);
@@ -1633,6 +1630,23 @@
time_read = adb_read_date_time;
time_write = adb_set_date_time;
+#if NAPM > 0
+ if (adbHardware == ADB_HW_PMU) {
+ /* Magic for signalling the apm driver to match. */
+ nca.ca_name = "apm";
+ nca.ca_node = node;
+ config_found(self, &nca, NULL);
+ }
+#endif
+
+ /*
+ * see if we're supposed to have an ADB bus
+ * since some PowerBooks don't have one and their PMUs barf on ADB
+ * commands we bail here if there's no adb node
+ */
+ if(!adb_node)
+ return;
+
#ifdef ADB_DEBUG
if (adb_debug)
printf("adb: done with adb_reinit\n");
@@ -1654,15 +1668,6 @@
(void)config_found(self, &aa_args, adbprint);
}
-
-#if NAPM > 0
- if (adbHardware == ADB_HW_PMU) {
- /* Magic for signalling the apm driver to match. */
- nca.ca_name = "apm";
- nca.ca_node = node;
- config_found(self, &nca, NULL);
- }
-#endif
/* Attach I2C controller. */
for (node = OF_child(ca->ca_node); node; node = OF_peer(node)) {