Jacob Garber has uploaded this change for review.

View Change

payloads/coreinfo: Use fixed-width integers for cpuid

This function executes the cpuid instruction, which takes a 32 bit input
value (idx), and then stores output in eax, ebx, ecx, and edx, which are
all 32 bit registers. Update the prototype to use fixed-width integers,
and update all usage calls appropriately.

Change-Id: I15876fa35628d3a505864fb49be4fdab1fd19f4a
Signed-off-by: Jacob Garber <jgarber1@ualberta.ca>
---
M payloads/coreinfo/coreinfo.h
M payloads/coreinfo/cpuinfo_module.c
2 files changed, 7 insertions(+), 8 deletions(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/62/33862/1
diff --git a/payloads/coreinfo/coreinfo.h b/payloads/coreinfo/coreinfo.h
index 073c5f9..03e59c9 100644
--- a/payloads/coreinfo/coreinfo.h
+++ b/payloads/coreinfo/coreinfo.h
@@ -27,8 +27,7 @@
int (*handle) (int);
};

-extern void docpuid(int, unsigned long *, unsigned long *, unsigned long *,
- unsigned long *);
+extern void docpuid(uint32_t idx, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx);

void print_module_title(WINDOW *win, const char *title);

diff --git a/payloads/coreinfo/cpuinfo_module.c b/payloads/coreinfo/cpuinfo_module.c
index 0ea2dfc..94379f3 100644
--- a/payloads/coreinfo/cpuinfo_module.c
+++ b/payloads/coreinfo/cpuinfo_module.c
@@ -85,7 +85,7 @@
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
};

-static unsigned long vendor;
+static uint32_t vendor;
static unsigned int cpu_khz;

static void decode_flags(WINDOW *win, unsigned long reg, const char **flags,
@@ -114,7 +114,7 @@

static void get_features(WINDOW *win, int *row)
{
- unsigned long eax, ebx, ecx, edx;
+ uint32_t eax, ebx, ecx, edx;
int lrow = *row;

wmove(win, lrow++, 1);
@@ -150,12 +150,12 @@
static void do_name(WINDOW *win, int row)
{
char name[49], *p;
- unsigned long eax, ebx, ecx, edx;
- int i, t;
+ uint32_t eax, ebx, ecx, edx;
+ int t;

p = name;

- for (i = 0x80000002; i <= 0x80000004; i++) {
+ for (uint32_t i = 0x80000002; i <= 0x80000004; i++) {
docpuid(i, &eax, &ebx, &ecx, &edx);

if (eax == 0)
@@ -176,7 +176,7 @@

static int cpuinfo_module_redraw(WINDOW *win)
{
- unsigned long eax, ebx, ecx, edx;
+ uint32_t eax, ebx, ecx, edx;
unsigned int brand;
char *vstr;
int row = 2;

To view, visit change 33862. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I15876fa35628d3a505864fb49be4fdab1fd19f4a
Gerrit-Change-Number: 33862
Gerrit-PatchSet: 1
Gerrit-Owner: Jacob Garber <jgarber1@ualberta.ca>
Gerrit-MessageType: newchange