From: "Robert Richter" <robert.richter@amd.com>
To: "Thomas Gleixner" <tglx@linutronix.de>,
"Ingo Molnar" <mingo@redhat.com>,
"H. Peter Anvin" <hpa@zytor.com>,
"LKML" <linux-kernel@vger.kernel.org>
Cc: "Robert Richter" <robert.richter@amd.com>
Subject: [patch 4/6] x86: apicdef unification: CONFIG_X86_32 checks added
Date: Tue, 06 Nov 2007 19:36:49 +0100 [thread overview]
Message-ID: <20071106183646.338940000@amd.com> (raw)
In-Reply-To: 20071106183645.951275000@amd.com
[-- Attachment #1: apicdef/0004-apicdef-CONFIG_X86_32-checks-added.patch --]
[-- Type: text/plain, Size: 3925 bytes --]
Signed-off-by: Robert Richter <robert.richter@amd.com>
---
include/asm-x86/apicdef_32.h | 28 ++++++++++++++++++++++++++++
include/asm-x86/apicdef_64.h | 11 +++++++++++
2 files changed, 39 insertions(+), 0 deletions(-)
Index: linux-perfmon/include/asm-x86/apicdef_32.h
===================================================================
--- linux-perfmon.orig/include/asm-x86/apicdef_32.h
+++ linux-perfmon/include/asm-x86/apicdef_32.h
@@ -11,12 +11,19 @@
#define APIC_DEFAULT_PHYS_BASE 0xfee00000
#define APIC_ID 0x20
+#ifndef CONFIG_X86_32
+#define APIC_ID_MASK (0xFFu<<24)
+#define GET_APIC_ID(x) (((x)>>24)&0xFFu)
+#define SET_APIC_ID(x) (((x)<<24))
+#endif
#define APIC_LVR 0x30
#define APIC_LVR_MASK 0xFF00FF
#define GET_APIC_VERSION(x) ((x)&0xFFu)
#define GET_APIC_MAXLVT(x) (((x)>>16)&0xFFu)
#define APIC_INTEGRATED(x) ((x)&0xF0u)
+#ifdef CONFIG_X86_32
#define APIC_XAPIC(x) ((x) >= 0x14)
+#endif
#define APIC_TASKPRI 0x80
#define APIC_TPRI_MASK 0xFFu
#define APIC_ARBPRI 0x90
@@ -60,6 +67,9 @@
#define APIC_INT_ASSERT 0x04000
#define APIC_ICR_BUSY 0x01000
#define APIC_DEST_LOGICAL 0x00800
+#ifndef CONFIG_X86_32
+#define APIC_DEST_PHYSICAL 0x00000
+#endif
#define APIC_DM_FIXED 0x00000
#define APIC_DM_LOWEST 0x00100
#define APIC_DM_SMI 0x00200
@@ -111,7 +121,25 @@
#define APIC_BASE (fix_to_virt(FIX_APIC_BASE))
+#ifdef CONFIG_X86_32
#define MAX_IO_APICS 64
+#else
+#define MAX_IO_APICS 128
+#define MAX_LOCAL_APIC 256
+#define BAD_APICID 0xFFu
+
+/*
+ * All x86-64 systems are xAPIC compatible.
+ * In the following, "apicid" is a physical APIC ID.
+ */
+#define XAPIC_DEST_CPUS_SHIFT 4
+#define XAPIC_DEST_CPUS_MASK ((1u << XAPIC_DEST_CPUS_SHIFT) - 1)
+#define XAPIC_DEST_CLUSTER_MASK (XAPIC_DEST_CPUS_MASK << XAPIC_DEST_CPUS_SHIFT)
+#define APIC_CLUSTER(apicid) ((apicid) & XAPIC_DEST_CLUSTER_MASK)
+#define APIC_CLUSTERID(apicid) (APIC_CLUSTER(apicid) >> XAPIC_DEST_CPUS_SHIFT)
+#define APIC_CPUID(apicid) ((apicid) & XAPIC_DEST_CPUS_MASK)
+#define NUM_APIC_CLUSTERS ((BAD_APICID + 1) >> XAPIC_DEST_CPUS_SHIFT)
+#endif
/*
* the local APIC register structure, memory mapped. Not terribly well
Index: linux-perfmon/include/asm-x86/apicdef_64.h
===================================================================
--- linux-perfmon.orig/include/asm-x86/apicdef_64.h
+++ linux-perfmon/include/asm-x86/apicdef_64.h
@@ -11,14 +11,19 @@
#define APIC_DEFAULT_PHYS_BASE 0xfee00000
#define APIC_ID 0x20
+#ifndef CONFIG_X86_32
#define APIC_ID_MASK (0xFFu<<24)
#define GET_APIC_ID(x) (((x)>>24)&0xFFu)
#define SET_APIC_ID(x) (((x)<<24))
+#endif
#define APIC_LVR 0x30
#define APIC_LVR_MASK 0xFF00FF
#define GET_APIC_VERSION(x) ((x)&0xFFu)
#define GET_APIC_MAXLVT(x) (((x)>>16)&0xFFu)
#define APIC_INTEGRATED(x) ((x)&0xF0u)
+#ifdef CONFIG_X86_32
+#define APIC_XAPIC(x) ((x) >= 0x14)
+#endif
#define APIC_TASKPRI 0x80
#define APIC_TPRI_MASK 0xFFu
#define APIC_ARBPRI 0x90
@@ -62,7 +67,9 @@
#define APIC_INT_ASSERT 0x04000
#define APIC_ICR_BUSY 0x01000
#define APIC_DEST_LOGICAL 0x00800
+#ifndef CONFIG_X86_32
#define APIC_DEST_PHYSICAL 0x00000
+#endif
#define APIC_DM_FIXED 0x00000
#define APIC_DM_LOWEST 0x00100
#define APIC_DM_SMI 0x00200
@@ -114,6 +121,9 @@
#define APIC_BASE (fix_to_virt(FIX_APIC_BASE))
+#ifdef CONFIG_X86_32
+#define MAX_IO_APICS 64
+#else
#define MAX_IO_APICS 128
#define MAX_LOCAL_APIC 256
#define BAD_APICID 0xFFu
@@ -129,6 +139,7 @@
#define APIC_CLUSTERID(apicid) (APIC_CLUSTER(apicid) >> XAPIC_DEST_CPUS_SHIFT)
#define APIC_CPUID(apicid) ((apicid) & XAPIC_DEST_CPUS_MASK)
#define NUM_APIC_CLUSTERS ((BAD_APICID + 1) >> XAPIC_DEST_CPUS_SHIFT)
+#endif
/*
* the local APIC register structure, memory mapped. Not terribly well
--
Advanced Micro Devices, Inc.
Operating System Research Center
email: robert.richter@amd.com
next prev parent reply other threads:[~2007-11-06 18:48 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-06 18:36 [patch 0/6] x86: apicdef.h unification Robert Richter
2007-11-06 18:36 ` [patch 1/6] x86: apicdef unification: some constants made unsigned Robert Richter
2007-11-07 20:41 ` Jeremy Fitzhardinge
2007-11-08 10:14 ` Robert Richter
2007-11-12 12:31 ` Maciej W. Rozycki
2007-11-12 15:56 ` Robert Richter
2007-11-12 17:58 ` H. Peter Anvin
2007-11-06 18:36 ` [patch 2/6] x86: apicdef unification: minor changes in macro order Robert Richter
2007-11-06 18:36 ` [patch 3/6] x86: apicdef unification: whitespace changes only Robert Richter
2007-11-06 18:36 ` Robert Richter [this message]
2007-11-06 18:36 ` [patch 5/6] x86: apicdef unification: 32 and 64 bit files coalesced Robert Richter
2007-11-06 18:36 ` [patch 6/6] x86: apicdef unification: more whitespace changes Robert Richter
2007-11-06 20:32 ` [patch 0/6] x86: apicdef.h unification Thomas Gleixner
2007-11-08 10:24 ` Robert Richter
2007-11-08 17:53 ` Thomas Gleixner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071106183646.338940000@amd.com \
--to=robert.richter@amd.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox