Skip to contentSkip to conversation

x86: GEODE: add Virtual Systems Architecture detection

PATCH NAK Andres Salomon 3 participants 6 messages Apr 10, 2008 – Apr 11, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 x86: GEODE: add Virtual Systems Architecture detection

This is generic VSA detection. It's used by OLPC to determine whether or not the BIOS contains VSA, but since other BIOSes are coming out that don't use the VSA (ie, tinybios), it might end up being useful for others.

---
 include/asm-x86/geode.h |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
include/asm-x86/geode.h +16 -0
index c208398..882acf8 100644
@@ -103,6 +103,14 @@ extern int geode_get_dev_base(unsigned int dev);
 #define PM_AWKD			0x50
 #define PM_SSC			0x54
 
+/* VSA magic values */
+
+#define VSA_VRC_INDEX		0xAC1C
+#define VSA_VRC_DATA		0xAC1E
+#define VSA_VR_UNLOCK		0xFC53	/* unlock virtual register */
+#define VSA_VR_SIGNATURE	0x0003
+#define VSA_SIG			0x4132	/* signature is ascii 'VSA2' */
+
 /* GPIO */
 
 #define GPIO_OUTPUT_VAL		0x00
@@ -174,6 +182,14 @@ static inline int is_geode(void)
 	return (is_geode_gx() || is_geode_lx());
 }
 
+static inline int geode_has_vsa(void)
+{
+	outw(VSA_VR_UNLOCK, VSA_VRC_INDEX);
+	outw(VSA_VR_SIGNATURE, VSA_VRC_INDEX);
+
+	return (inw(VSA_VRC_DATA) == VSA_SIG);
+}
+
 /* MFGPTs */
 
 #define MFGPT_MAX_TIMERS	8
Signature · 1 line
1.5.4.2
#1 lore raw
Quoted 4 lines · On Wed, 9 Apr 2008 22:33:28 -0400 Andres Salomon <[email protected]> wrote:

This is generic VSA detection. It's used by OLPC to determine whether or not the BIOS contains VSA, but since other BIOSes are coming out that don't use the VSA (ie, tinybios), it might end up being useful for others.

NAK - but minor

This is a check for *VSA2* which is not the same as VSA1 (Cyrix one) and for older systems that actually matters as you may have VSA1 or VSA2 and they are detected differently.

Quoted 1 line

+/* VSA magic values */

These should be VSA2 I think

Quoted 1 line

+static inline int geode_has_vsa(void)

has_vsa2

Alan (Keeper of the ancient cyrix docs ;))

#2 lore raw
Quoted 8 lines · On Thu, 10 Apr 2008 09:10:57 +0100 Alan Cox <[email protected]> wrote:
Quoted 4 lines · On Wed, 9 Apr 2008 22:33:28 -0400 Andres Salomon <[email protected]> wrote:

This is generic VSA detection. It's used by OLPC to determine whether or not the BIOS contains VSA, but since other BIOSes are coming out that don't use the VSA (ie, tinybios), it might end up being useful for others.

Quoted 6 lines

NAK - but minor

This is a check for *VSA2* which is not the same as VSA1 (Cyrix one) and for older systems that actually matters as you may have VSA1 or VSA2 and they are detected differently.

Excellent point. Can we extend this to check for a VSA1-specific string, or does VSA1 not have a similar signature?

Quoted 10 lines
Quoted 1 line

+/* VSA magic values */

These should be VSA2 I think

Quoted 1 line

+static inline int geode_has_vsa(void)

has_vsa2

Alan (Keeper of the ancient cyrix docs ;))

#3 lore raw
Quoted 7 lines
Quoted 4 lines

This is a check for *VSA2* which is not the same as VSA1 (Cyrix one) and for older systems that actually matters as you may have VSA1 or VSA2 and they are detected differently.

Excellent point. Can we extend this to check for a VSA1-specific string, or does VSA1 not have a similar signature?

VSA1 requires you grovelling around poking at the video registers to get a reliable answer and the only bits we need it for are the DMA bug (where we assume all have it) and the sound driver (which uses the PCI space to see what audio setup is there).

X cares but we don't currently.

#4 lore raw
Quoted 8 lines · On Thu, 10 Apr 2008 15:20:19 +0100 Alan Cox <[email protected]> wrote:
Quoted 7 lines
Quoted 4 lines

This is a check for *VSA2* which is not the same as VSA1 (Cyrix one) and for older systems that actually matters as you may have VSA1 or VSA2 and they are detected differently.

Excellent point. Can we extend this to check for a VSA1-specific string, or does VSA1 not have a similar signature?

Quoted 6 lines

VSA1 requires you grovelling around poking at the video registers to get a reliable answer and the only bits we need it for are the DMA bug (where we assume all have it) and the sound driver (which uses the PCI space to see what audio setup is there).

X cares but we don't currently.

How about this?

This is generic VSA2 detection. It's used by OLPC to determine whether or not the BIOS contains VSA2, but since other BIOSes are coming out that don't use the VSA (ie, tinybios), it might end up being useful for others.

---
 include/asm-x86/geode.h |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
include/asm-x86/geode.h +19 -0
index c208398..6cded63 100644
@@ -103,6 +103,14 @@ extern int geode_get_dev_base(unsigned int dev);
 #define PM_AWKD			0x50
 #define PM_SSC			0x54
 
+/* VSA2 magic values */
+
+#define VSA_VRC_INDEX		0xAC1C
+#define VSA_VRC_DATA		0xAC1E
+#define VSA_VR_UNLOCK		0xFC53	/* unlock virtual register */
+#define VSA_VR_SIGNATURE	0x0003
+#define VSA_SIG			0x4132	/* signature is ascii 'VSA2' */
+
 /* GPIO */
 
 #define GPIO_OUTPUT_VAL		0x00
@@ -174,6 +182,17 @@ static inline int is_geode(void)
 	return (is_geode_gx() || is_geode_lx());
 }
 
+/*
+ * The VSA has virtual registers that we can query for a signature.
+ */
+static inline int geode_has_vsa2(void)
+{
+	outw(VSA_VR_UNLOCK, VSA_VRC_INDEX);
+	outw(VSA_VR_SIGNATURE, VSA_VRC_INDEX);
+
+	return (inw(VSA_VRC_DATA) == VSA_SIG);
+}
+
 /* MFGPTs */
 
 #define MFGPT_MAX_TIMERS	8
Signature · 1 line
1.5.4.2
#5 lore raw
In reply to Andres Salomon
Quoted 13 lines · Andres Salomon
Quoted 10 lines · On Thu, 10 Apr 2008 09:10:57 +0100 Alan Cox <[email protected]> wrote:
Quoted 4 lines · On Wed, 9 Apr 2008 22:33:28 -0400 Andres Salomon <[email protected]> wrote:

This is generic VSA detection. It's used by OLPC to determine whether or not the BIOS contains VSA, but since other BIOSes are coming out that don't use the VSA (ie, tinybios), it might end up being useful for others.

NAK - but minor

Quoted 7 lines
Quoted 4 lines

This is a check for *VSA2* which is not the same as VSA1 (Cyrix one) and for older systems that actually matters as you may have VSA1 or VSA2 and they are detected differently.

Excellent point. Can we extend this to check for a VSA1-specific string, or does VSA1 not have a similar signature?

I don't think we need to worry about it. 99.99% of Geode systems run with VSA happily transparent in the background, and thus would have no good reason to check for it. Certainly, there are no processors with VSA1 that would care to check.

But Alan does have a good point - we should name it vsa2 for strict correctness.

Jordan

Signature · 3 lines
Jordan Crouse
Systems Software Development Engineer 
Advanced Micro Devices, Inc.