Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Dec 2003 13:22:05 -0800 (PST)
From:      Juli Mallett <jmallett@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 44469 for review
Message-ID:  <200312282122.hBSLM59E056407@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <dev/arcs/arcs.h>
 
-/* 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_ */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200312282122.hBSLM59E056407>