From owner-p4-projects@FreeBSD.ORG Sun Dec 28 13:22:09 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id DF1B716A4D1; Sun, 28 Dec 2003 13:22:08 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9F4E716A4CE for ; Sun, 28 Dec 2003 13:22:08 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id B1AC943D2D for ; Sun, 28 Dec 2003 13:22:05 -0800 (PST) (envelope-from jmallett@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.10/8.12.10) with ESMTP id hBSLM50B056416 for ; Sun, 28 Dec 2003 13:22:05 -0800 (PST) (envelope-from jmallett@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.10/8.12.10/Submit) id hBSLM59E056407 for perforce@freebsd.org; Sun, 28 Dec 2003 13:22:05 -0800 (PST) (envelope-from jmallett@freebsd.org) Date: Sun, 28 Dec 2003 13:22:05 -0800 (PST) Message-Id: <200312282122.hBSLM59E056407@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jmallett@freebsd.org using -f From: Juli Mallett To: Perforce Change Reviews Subject: PERFORCE change 44469 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Dec 2003 21:22:09 -0000 http://perforce.freebsd.org/chv.cgi?CH=44469 Change 44469 by jmallett@jmallett_oingo on 2003/12/28 13:21:07 Add some ARCS Component stuff, quick trampoline into GetChild, make arcs_systemid() honest. Affected files ... .. //depot/projects/mips/sys/dev/arcs/arcs.c#2 edit .. //depot/projects/mips/sys/dev/arcs/arcs.h#2 edit Differences ... ==== //depot/projects/mips/sys/dev/arcs/arcs.c#2 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $P4: //depot/projects/mips/sys/dev/arcs/arcs.c#1 $ + * $P4: //depot/projects/mips/sys/dev/arcs/arcs.c#2 $ */ #include "opt_model.h" @@ -35,11 +35,6 @@ #include -/* List these not in #else's, etc., to blow up if there's a problem. */ -#if defined(IP22) -typedef int32_t ARCS_Pointer_t; -#endif - static char *ARCS_SPB; static char *ARCS_FV; @@ -56,6 +51,7 @@ #define ARCS_FV_Reboot_Offset (6 * sizeof (ARCS_Pointer_t)) #define ARCS_FV_EnterInteractiveMode_Offset (7 * sizeof (ARCS_Pointer_t)) +#define ARCS_FV_GetChild_Offset (10 * sizeof (ARCS_Pointer_t)) #define ARCS_FV_GetMemoryDescriptor_Offset (18 * sizeof (ARCS_Pointer_t)) #define ARCS_FV_Read_Offset (25 * sizeof (ARCS_Pointer_t)) #define ARCS_FV_GetReadStatus_Offset (26 * sizeof (ARCS_Pointer_t)) @@ -82,10 +78,15 @@ const char * arcs_systemid(void) { - /* XXX Need all that groovy tree-walking code. */ - /* XXX This is so badly hackish. */ - /* XXX So badly hackish it makes me almost want to fix dev/arcbios. */ - return "SGI-IP22"; + struct ARCS_Component *root; + const char *systemid; + + root = ARCS_GetChild(NULL); + if (root != NULL) + systemid = (const char *)(intptr_t)root->Identifier; + else + systemid = "SGI-IP27"; + return (systemid); } struct ARCS_Mem * @@ -192,3 +193,18 @@ len = (size_t)lend; return (len); } + +struct ARCS_Component * +ARCS_GetChild(const struct ARCS_Component *component) +{ + ARCS_Pointer_t (*GetChild)(ARCS_Pointer_t); + struct ARCS_Component *next; + ARCS_Pointer_t componentd; + ARCS_Pointer_t nextd; + + GetChild = (ARCS_Pointer_t (*)(ARCS_Pointer_t))(intptr_t)*(ARCS_Pointer_t *)&ARCS_FV[ARCS_FV_GetChild_Offset]; + componentd = (ARCS_Pointer_t)(intptr_t)component; + nextd = (*GetChild)(componentd); + next = (struct ARCS_Component *)(intptr_t)nextd; + return (next); +} ==== //depot/projects/mips/sys/dev/arcs/arcs.h#2 (text+ko) ==== @@ -23,12 +23,22 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $P4: //depot/projects/mips/sys/dev/arcs/arcs.h#1 $ + * $P4: //depot/projects/mips/sys/dev/arcs/arcs.h#2 $ */ #ifndef _DEV_ARCS_ARCS_H_ #define _DEV_ARCS_ARCS_H_ +#ifdef sgimips +#include "opt_model.h" + +#if defined (IP22) +typedef int32_t ARCS_Pointer_t; +#endif +#else +#error "ARCS not supported." +#endif + /* * Simple ARCS firmware interaction code for the SGI MIPS machines. It * is initially being written for 64-bit kernels running with a 32-bit @@ -76,6 +86,20 @@ uint32_t PageCount; } __packed; +/* Used to enumerate system components. */ +struct ARCS_Component { + uint32_t Class; + uint32_t Type; + uint32_t Flags; + uint16_t Version; + uint16_t Revision; + uint32_t Key; + uint32_t AffinityMask; + uint32_t ConfigurationDataSize; + uint32_t IdentifierLength; + ARCS_Pointer_t Identifier; +} __packed; + /* * Firmware hooks. */ @@ -86,5 +110,6 @@ size_t ARCS_Read(int, char *, size_t); int ARCS_GetReadStatus(int); size_t ARCS_Write(int, const char *, size_t); +struct ARCS_Component *ARCS_GetChild(const struct ARCS_Component *); #endif /* _DEV_ARCS_ARCS_H_ */