Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Apr 2003 11:25:07 -0700 (PDT)
From:      Juli Mallett <jmallett@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 29801 for review
Message-ID:  <200304261825.h3QIP7Hf082929@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=29801

Change 29801 by jmallett@jmallett_dalek on 2003/04/26 11:24:58

	Convert to use ArcPointer_t for at least the stuff we pull
	from memory, and access everything by way of KSEG1.  The
	pointers I get back, at least on IP22, are in KSEG1, but
	32-bit, and something is preserving bit values rather than
	extending to fill the top 64-bits.  This hacks around that.
	Probably all of these things will become macros/typedefs.

Affected files ...

.. //depot/projects/mips/sys/dev/arcbios/arcbios.c#6 edit
.. //depot/projects/mips/sys/dev/arcbios/arcbios.h#3 edit
.. //depot/projects/mips/sys/dev/arcbios/arcbiosvar.h#3 edit

Differences ...

==== //depot/projects/mips/sys/dev/arcbios/arcbios.c#6 (text+ko) ====

@@ -45,8 +45,12 @@
 #include <dev/arcbios/arcbios.h>
 #include <dev/arcbios/arcbiosvar.h>
 
+#include <machine/cpuregs.h>
+
 const struct arcbios_spb *ARCBIOS_SPB;
-const struct arcbios_fv *ARCBIOS;
+const struct arcbios_fv *ARCBIOS_FV;
+struct arcbios ARCBIOS_Vector;
+struct arcbios *ARCBIOS = &ARCBIOS_Vector;
 
 char arcbios_sysid_vendor[ARCBIOS_SYSID_FIELDLEN + 1];
 char arcbios_sysid_product[ARCBIOS_SYSID_FIELDLEN + 1];
@@ -58,6 +62,7 @@
 static cn_getc_t arcbios_cngetc;
 static cn_putc_t arcbios_cnputc;
 
+static void arcbios_fill_vector(struct arcbios *, const struct arcbios_fv *);
 void	arcbios_fetch_system_identifier(struct arcbios_component *,
 	    struct arcbios_treewalk_context *);
 
@@ -87,7 +92,8 @@
 	}
 
 	/* Initialize our pointer to the firmware vector. */
-	ARCBIOS = ARCBIOS_SPB->FirmwareVector;
+	ARCBIOS_FV = (struct arcbios_fv *) MIPS_PHYS_TO_KSEG1(ARCBIOS_SPB->FirmwareVector);
+	arcbios_fill_vector(ARCBIOS, ARCBIOS_FV);
 
 	/*
 	 * Fetch the system ID.
@@ -130,6 +136,60 @@
 	}
 }
 
+static void
+arcbios_fill_vector(struct arcbios *A, const struct arcbios_fv *V)
+{
+#define	ARCSET(Func)	A->Func = (void (*)(void))(int) V->Func
+	ARCSET(Load);
+	ARCSET(Invoke);
+	ARCSET(Execute);
+	ARCSET(Halt);
+	ARCSET(PowerDown);
+	ARCSET(Restart);
+	ARCSET(Reboot);
+	ARCSET(EnterInteractiveMode);
+#if defined(sgimips)
+	ARCSET(reserved0);
+#else
+	ARCSET(ReturnFromMain);
+#endif
+	ARCSET(GetPeer);
+	ARCSET(GetChild);
+	ARCSET(GetParent);
+	ARCSET(GetConfigurationData);
+	ARCSET(AddChild);
+	ARCSET(DeleteComponent);
+	ARCSET(GetComponent);
+	ARCSET(SaveConfiguration);
+	ARCSET(GetSystemId);
+	ARCSET(GetMemoryDescriptor);
+#if defined(sgimips)
+	ARCSET(reserved1);
+#else
+	ARCSET(Signal);
+#endif
+	ARCSET(GetTime);
+	ARCSET(GetRelativeTime);
+	ARCSET(GetDirectoryEntry);
+	ARCSET(Open);
+	ARCSET(Close);
+	ARCSET(Read);
+	ARCSET(GetReadStatus);
+	ARCSET(Write);
+	ARCSET(Seek);
+	ARCSET(Mount);
+	ARCSET(GetEnvironmentVariable);
+	ARCSET(SetEnvironmentVariable);
+	ARCSET(GetFileInformation);
+	ARCSET(SetFileInformation);
+	ARCSET(FlushAllCaches);
+#if !defined(sgimips)
+	ARCSET(TestUnicode);
+	ARCSET(GetDisplayStatus);
+#endif
+#undef	ARCSET
+}
+
 /****************************************************************************
  * ARC component tree walking routines.
  ****************************************************************************/
@@ -170,7 +230,7 @@
 	dstsize--;
 	if (dstsize > node->IdentifierLength)
 		dstsize = node->IdentifierLength;
-	memcpy(dst, node->Identifier, dstsize);
+	memcpy(dst, MIPS_PHYS_TO_KSEG1(node->Identifier), dstsize);
 	dst[dstsize] = '\0';
 }
 

==== //depot/projects/mips/sys/dev/arcbios/arcbios.h#3 (text+ko) ====

@@ -78,6 +78,8 @@
 #define	ARCBIOS_ENOCONNECT	34	/* not connected */
 #endif /* sgimips */
 
+typedef	uint32_t	ArcPointer_t;/* XXX */
+
 /*
  * 4.2.2: System Parameter Block
  */
@@ -86,18 +88,18 @@
 	uint32_t	SPBLength;
 	uint16_t	Version;
 	uint16_t	Revision;
-	void		*RestartBlock;
-	void		*DebugBlock;
-	void		*GEVector;
-	void		*UTLBMissVector;
+	ArcPointer_t	RestartBlock;
+	ArcPointer_t	DebugBlock;
+	ArcPointer_t	GEVector;
+	ArcPointer_t	UTLBMissVector;
 	uint32_t	FirmwareVectorLength;
-	void		*FirmwareVector;
+	ArcPointer_t	FirmwareVector;
 	uint32_t	PrivateVectorLength;
-	void		*PrivateVector;
+	ArcPointer_t	PrivateVector;
 	uint32_t	AdapterCount;
 	uint32_t	AdapterType;
 	uint32_t	AdapterVectorLength;
-	void		*AdapterVector;
+	ArcPointer_t	AdapterVector;
 };
 
 #define	ARCBIOS_SPB_SIGNATURE	0x53435241	/* A R C S */
@@ -116,7 +118,7 @@
 	uint32_t	AffinityMask;
 	uint32_t	ConfigurationDataSize;
 	uint32_t	IdentifierLength;
-	char		*Identifier;
+	ArcPointer_t	Identifier;
 };
 
 /* 
@@ -321,9 +323,9 @@
 };
 
 /*
- * ARC firmware vector
+ * ARC firmware vector, and the API we present.
  */
-struct arcbios_fv {
+struct arcbios {
 	uint32_t	(*Load)(
 			    char *,		/* image to load */
 			    uint32_t,		/* top address */
@@ -467,3 +469,53 @@
 			    uint32_t);		/* file ID */
 #endif
 };
+
+struct arcbios_fv {
+	ArcPointer_t	Load;
+	ArcPointer_t	Invoke;
+	ArcPointer_t	Execute;
+	ArcPointer_t	Halt;
+	ArcPointer_t	PowerDown;
+	ArcPointer_t	Restart;
+	ArcPointer_t	Reboot;
+	ArcPointer_t	EnterInteractiveMode;
+#if defined(sgimips)
+	ArcPointer_t	reserved0;
+#else
+	ArcPointer_t	ReturnFromMain;
+#endif
+	ArcPointer_t	GetPeer;
+	ArcPointer_t	GetChild;
+	ArcPointer_t	GetParent;
+	ArcPointer_t	GetConfigurationData;
+	ArcPointer_t	AddChild;
+	ArcPointer_t	DeleteComponent;
+	ArcPointer_t	GetComponent;
+	ArcPointer_t	SaveConfiguration;
+	ArcPointer_t	GetSystemId;
+	ArcPointer_t	GetMemoryDescriptor;
+#if defined(sgimips)
+	ArcPointer_t	reserved1;
+#else
+	ArcPointer_t	Signal;
+#endif
+	ArcPointer_t	GetTime;
+	ArcPointer_t	GetRelativeTime;
+	ArcPointer_t	GetDirectoryEntry;
+	ArcPointer_t	Open;
+	ArcPointer_t	Close;
+	ArcPointer_t	Read;
+	ArcPointer_t	GetReadStatus;
+	ArcPointer_t	Write;
+	ArcPointer_t	Seek;
+	ArcPointer_t	Mount;
+	ArcPointer_t	GetEnvironmentVariable;
+	ArcPointer_t	SetEnvironmentVariable;
+	ArcPointer_t	GetFileInformation;
+	ArcPointer_t	SetFileInformation;
+	ArcPointer_t	FlushAllCaches;
+#if !defined(sgimips)
+	ArcPointer_t	TestUnicode;
+	ArcPointer_t	GetDisplayStatus;
+#endif
+};

==== //depot/projects/mips/sys/dev/arcbios/arcbiosvar.h#3 (text+ko) ====

@@ -47,7 +47,8 @@
 };
 
 extern const struct arcbios_spb *ARCBIOS_SPB;
-extern const struct arcbios_fv *ARCBIOS;
+extern const struct arcbios_fv *ARCBIOS_FV;
+extern struct arcbios *ARCBIOS;
 
 extern char arcbios_sysid_vendor[];
 extern char arcbios_sysid_product[];



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