diff options
author | Gordon Willem Klok <gwk@cvs.openbsd.org> | 2007-02-25 04:13:49 +0000 |
---|---|---|
committer | Gordon Willem Klok <gwk@cvs.openbsd.org> | 2007-02-25 04:13:49 +0000 |
commit | e988aa7c524b54ea6ebb7dd17703510bb6317b6b (patch) | |
tree | 9e2b54bbaaca5e787744e563837937ab0b6dab35 | |
parent | 4c91ec43bcbf710667a2b965a62ca7f3bb4fd274 (diff) |
Change how we determin if were running on a new world versus old world
machine for the purposes of printing model information durring boot and
the hw.vendor/product sysctls. Turns out the apple didnt use the same
format in the early imacs as they did in the latter new world machines
resulting in NULL strings as found by drahn@. In this case and all future
cases where we dont understand the format the default is to print whats
found in the name property without interpertation.
ok drahn@
-rw-r--r-- | sys/arch/macppc/macppc/mainbus.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/sys/arch/macppc/macppc/mainbus.c b/sys/arch/macppc/macppc/mainbus.c index c93b187dbae..dda5fcb23bc 100644 --- a/sys/arch/macppc/macppc/mainbus.c +++ b/sys/arch/macppc/macppc/mainbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mainbus.c,v 1.16 2007/02/12 22:22:39 gwk Exp $ */ +/* $OpenBSD: mainbus.c,v 1.17 2007/02/25 04:13:48 gwk Exp $ */ /* * Copyright (c) 1994, 1995 Carnegie-Mellon University. @@ -93,23 +93,18 @@ mbattach(struct device *parent, struct device *self, void *aux) len = OF_getprop(node, "compatible", name, sizeof(name)); if (len > 1) { name[len] = '\0'; - if ((strncmp(t, name, strlen(t))) == 0) { - /* New World Macintosh */ + /* Old World Macintosh */ + if ((strncmp(name, "AAPL", 4)) == 0) { hw_vendor = "Apple Computer, Inc."; - hw_prod = t; - } else { - /* Old World Macintosh */ - if ((strncmp(name, "AAPL", 4)) == 0) { - hw_vendor = "Apple Computer, Inc."; - slen = strlen(t) + strlen(name) - 3; - if ((hw_prod = malloc(slen, M_DEVBUF, - M_NOWAIT)) != NULL) { - snprintf(hw_prod, slen, "%s %s", t, - name + 5); - free(t, M_DEVBUF); - } + slen = strlen(t) + strlen(name) - 3; + if ((hw_prod = malloc(slen, M_DEVBUF, M_NOWAIT)) != NULL) { + snprintf(hw_prod, slen, "%s %s", t, name + 5); + free(t, M_DEVBUF); } - + } else { + /* New World Macintosh or Unknown */ + hw_vendor = "Apple Computer, Inc."; + hw_prod = t; } } printf(": model %s\n", hw_prod); |