From e988aa7c524b54ea6ebb7dd17703510bb6317b6b Mon Sep 17 00:00:00 2001 From: Gordon Willem Klok Date: Sun, 25 Feb 2007 04:13:49 +0000 Subject: 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@ --- sys/arch/macppc/macppc/mainbus.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'sys/arch') 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); -- cgit v1.2.3