From: Peter Oruba <peter.oruba@amd.com>
To: Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
Tigran Aivazian <tigran@aivazian.fsnet.co.uk>
Cc: LKML <linux-kernel@vger.kernel.org>, Peter Oruba <peter.oruba@amd.com>
Subject: [patch 5/9] [PATCH 5/9] x86: Structure declaration renaming.
Date: Fri, 25 Jul 2008 18:17:28 +0200 [thread overview]
Message-ID: <20080725162002.976728160@amd.com> (raw)
In-Reply-To: 20080725161723.636932280@amd.com
[-- Attachment #1: 0005-x86-Structure-declaration-renaming.patch --]
[-- Type: text/plain, Size: 6644 bytes --]
Renamed common structures to vendor specific naming scheme
so other vendors will be able to use the same naming
convention.
Signed-off-by: Peter Oruba <peter.oruba@amd.com>
Conflicts:
---
arch/x86/kernel/microcode_intel.c | 46 +++++++++++++++++++-----------------
include/asm-x86/microcode.h | 10 +++++---
2 files changed, 30 insertions(+), 26 deletions(-)
diff --git a/arch/x86/kernel/microcode_intel.c b/arch/x86/kernel/microcode_intel.c
index a30c799..4754137 100644
--- a/arch/x86/kernel/microcode_intel.c
+++ b/arch/x86/kernel/microcode_intel.c
@@ -100,17 +100,19 @@ MODULE_AUTHOR("Tigran Aivazian <tigran@aivazian.fsnet.co.uk>");
MODULE_LICENSE("GPL");
#define DEFAULT_UCODE_DATASIZE (2000) /* 2000 bytes */
-#define MC_HEADER_SIZE (sizeof(struct microcode_header)) /* 48 bytes */
+#define MC_HEADER_SIZE (sizeof(struct microcode_header_intel)) /* 48 bytes */
#define DEFAULT_UCODE_TOTALSIZE (DEFAULT_UCODE_DATASIZE + MC_HEADER_SIZE) /* 2048 bytes */
#define EXT_HEADER_SIZE (sizeof(struct extended_sigtable)) /* 20 bytes */
#define EXT_SIGNATURE_SIZE (sizeof(struct extended_signature)) /* 12 bytes */
#define DWSIZE (sizeof(u32))
#define get_totalsize(mc) \
- (((struct microcode *)mc)->hdr.totalsize ? \
- ((struct microcode *)mc)->hdr.totalsize : DEFAULT_UCODE_TOTALSIZE)
+ (((struct microcode_intel *)mc)->hdr.totalsize ? \
+ ((struct microcode_intel *)mc)->hdr.totalsize : \
+ DEFAULT_UCODE_TOTALSIZE)
+
#define get_datasize(mc) \
- (((struct microcode *)mc)->hdr.datasize ? \
- ((struct microcode *)mc)->hdr.datasize : DEFAULT_UCODE_DATASIZE)
+ (((struct microcode_intel *)mc)->hdr.datasize ? \
+ ((struct microcode_intel *)mc)->hdr.datasize : DEFAULT_UCODE_DATASIZE)
#define sigmatch(s1, s2, p1, p2) \
(((s1) == (s2)) && (((p1) & (p2)) || (((p1) == 0) && ((p2) == 0))))
@@ -134,7 +136,7 @@ void collect_cpu_info(int cpu_num)
/* We should bind the task to the CPU */
BUG_ON(raw_smp_processor_id() != cpu_num);
uci->pf = uci->rev = 0;
- uci->mc = NULL;
+ uci->mc.mc_intel = NULL;
uci->valid = 1;
if (c->x86_vendor != X86_VENDOR_INTEL || c->x86 < 6 ||
@@ -163,7 +165,7 @@ void collect_cpu_info(int cpu_num)
}
static inline int microcode_update_match(int cpu_num,
- struct microcode_header *mc_header, int sig, int pf)
+ struct microcode_header_intel *mc_header, int sig, int pf)
{
struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num;
@@ -175,7 +177,7 @@ static inline int microcode_update_match(int cpu_num,
int microcode_sanity_check(void *mc)
{
- struct microcode_header *mc_header = mc;
+ struct microcode_header_intel *mc_header = mc;
struct extended_sigtable *ext_header = NULL;
struct extended_signature *ext_sig;
unsigned long total_size, data_size, ext_table_size;
@@ -260,7 +262,7 @@ int microcode_sanity_check(void *mc)
int get_matching_microcode(void *mc, int cpu)
{
struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
- struct microcode_header *mc_header = mc;
+ struct microcode_header_intel *mc_header = mc;
struct extended_sigtable *ext_header;
unsigned long total_size = get_totalsize(mc_header);
int ext_sigcount, i;
@@ -294,10 +296,10 @@ find:
}
/* free previous update file */
- vfree(uci->mc);
+ vfree(uci->mc.mc_intel);
memcpy(new_mc, mc, total_size);
- uci->mc = new_mc;
+ uci->mc.mc_intel = new_mc;
return 1;
}
@@ -311,7 +313,7 @@ void apply_microcode(int cpu)
/* We should bind the task to the CPU */
BUG_ON(cpu_num != cpu);
- if (uci->mc == NULL)
+ if (uci->mc.mc_intel == NULL)
return;
/* serialize access to the physical write to MSR 0x79 */
@@ -319,8 +321,8 @@ void apply_microcode(int cpu)
/* write microcode via MSR 0x79 */
wrmsr(MSR_IA32_UCODE_WRITE,
- (unsigned long) uci->mc->bits,
- (unsigned long) uci->mc->bits >> 16 >> 16);
+ (unsigned long) uci->mc.mc_intel->bits,
+ (unsigned long) uci->mc.mc_intel->bits >> 16 >> 16);
wrmsr(MSR_IA32_UCODE_REV, 0, 0);
/* see notes above for revision 1.07. Apparent chip bug */
@@ -330,14 +332,14 @@ void apply_microcode(int cpu)
rdmsr(MSR_IA32_UCODE_REV, val[0], val[1]);
spin_unlock_irqrestore(µcode_update_lock, flags);
- if (val[1] != uci->mc->hdr.rev) {
+ if (val[1] != uci->mc.mc_intel->hdr.rev) {
printk(KERN_ERR "microcode: CPU%d update from revision "
"0x%x to 0x%x failed\n", cpu_num, uci->rev, val[1]);
return;
}
printk(KERN_INFO "microcode: CPU%d updated from revision "
"0x%x to 0x%x, date = %08x \n",
- cpu_num, uci->rev, val[1], uci->mc->hdr.date);
+ cpu_num, uci->rev, val[1], uci->mc.mc_intel->hdr.date);
uci->rev = val[1];
}
@@ -347,7 +349,7 @@ extern unsigned int user_buffer_size; /* it's size */
long get_next_ucode(void **mc, long offset)
{
- struct microcode_header mc_header;
+ struct microcode_header_intel mc_header;
unsigned long total_size;
/* No more data */
@@ -378,13 +380,13 @@ long get_next_ucode(void **mc, long offset)
static long get_next_ucode_from_buffer(void **mc, const u8 *buf,
unsigned long size, long offset)
{
- struct microcode_header *mc_header;
+ struct microcode_header_intel *mc_header;
unsigned long total_size;
/* No more data */
if (offset >= size)
return 0;
- mc_header = (struct microcode_header *)(buf + offset);
+ mc_header = (struct microcode_header_intel *)(buf + offset);
total_size = get_totalsize(mc_header);
if (offset + total_size > size) {
@@ -462,7 +464,7 @@ int apply_microcode_check_cpu(int cpu)
int err = 0;
/* Check if the microcode is available */
- if (!uci->mc)
+ if (!uci->mc.mc_intel)
return 0;
old = current->cpus_allowed;
@@ -507,7 +509,7 @@ void microcode_fini_cpu(int cpu)
mutex_lock(µcode_mutex);
uci->valid = 0;
- kfree(uci->mc);
- uci->mc = NULL;
+ kfree(uci->mc.mc_intel);
+ uci->mc.mc_intel = NULL;
mutex_unlock(µcode_mutex);
}
diff --git a/include/asm-x86/microcode.h b/include/asm-x86/microcode.h
index d34a1fc..ef77c6f 100644
--- a/include/asm-x86/microcode.h
+++ b/include/asm-x86/microcode.h
@@ -1,4 +1,4 @@
-struct microcode_header {
+struct microcode_header_intel {
unsigned int hdrver;
unsigned int rev;
unsigned int date;
@@ -11,8 +11,8 @@ struct microcode_header {
unsigned int reserved[3];
};
-struct microcode {
- struct microcode_header hdr;
+struct microcode_intel {
+ struct microcode_header_intel hdr;
unsigned int bits[0];
};
@@ -35,5 +35,7 @@ struct ucode_cpu_info {
unsigned int sig;
unsigned int pf;
unsigned int rev;
- struct microcode *mc;
+ union {
+ struct microcode_intel *mc_intel;
+ } mc;
};
--
1.5.4.5
next prev parent reply other threads:[~2008-07-25 16:18 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-25 16:17 [patch 0/9] x86: AMD microcode patch loading support Peter Oruba
2008-07-25 16:17 ` [patch 1/9] [PATCH 1/9] x86: Moved Intel microcode patch loader declarations to seperate header file Peter Oruba
2008-07-25 16:17 ` [patch 2/9] [PATCH 2/9] x86: Typedef removal Peter Oruba
2008-07-25 16:17 ` [patch 3/9] [PATCH 3/9] x86: Moved per CPU microcode structure declaration to header file Peter Oruba
2008-07-25 16:17 ` [patch 4/9] [PATCH 4/9] x86: Code split to two parts Peter Oruba
2008-07-25 16:17 ` Peter Oruba [this message]
2008-07-25 16:17 ` [patch 6/9] [PATCH 6/9] x86: Add AMD specific declarations Peter Oruba
2008-07-25 16:17 ` [patch 7/9] [PATCH 7/9] x86: First step of refactoring, introducing microcode_ops Peter Oruba
2008-07-25 16:17 ` [patch 8/9] [PATCH 8/9] x86: Major refactoring Peter Oruba
2008-07-26 9:11 ` Daniel K.
2008-07-25 16:17 ` [patch 9/9] [PATCH 9/9] x86: AMD microcode patch loading support Peter Oruba
2008-07-26 8:00 ` Rabin Vincent
2008-07-25 16:44 ` [PATCH] x86: Add entry to MAINTAINERS file Peter Oruba
2008-07-26 13:37 ` [patch 0/9] x86: AMD microcode patch loading support Ingo Molnar
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=20080725162002.976728160@amd.com \
--to=peter.oruba@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
--cc=tigran@aivazian.fsnet.co.uk \
/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