Author: rminnich
Date: 2008-08-12 05:39:39 +0200 (Tue, 12 Aug 2008)
New Revision: 750
Modified:
coreboot-v3/include/arch/x86/amd/k8/k8.h
coreboot-v3/include/arch/x86/amd/k8/sysconf.h
coreboot-v3/include/arch/x86/cpu.h
coreboot-v3/include/console.h
coreboot-v3/include/device/device.h
coreboot-v3/include/lib.h
coreboot-v3/include/mc146818rtc.h
coreboot-v3/include/string.h
Log:
Make some things (die, mem*, resourcemap code, option code) SHARED.
The option code is tricky as it is used by standalone code. If you
include that file and you are standalone, you now have to define
STANDALONE (is there a better way?)
Change the cpuid to be a 24-byte string instead of 3 u32s.
Make the CPUID usage PIC-safe by not using %ebx.
Test building on two different geodes, tested to boot on dbe62
Signed-off-by: Ronald G. Minnich <rminnich(a)gmail.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006(a)gmx.net>
Modified: coreboot-v3/include/arch/x86/amd/k8/k8.h
===================================================================
--- coreboot-v3/include/arch/x86/amd/k8/k8.h 2008-08-11 23:55:10 UTC (rev 749)
+++ coreboot-v3/include/arch/x86/amd/k8/k8.h 2008-08-12 03:39:39 UTC (rev 750)
@@ -422,4 +422,20 @@
u32 sblk;
u32 sbbusn;
} __attribute__((packed));
+
+/* dual core support */
+unsigned int read_nb_cfg_54(void);
+
+struct node_core_id {
+ unsigned nodeid;
+ unsigned coreid;
+};
+
+// it can be used to get unitid and coreid it running only
+struct node_core_id get_node_core_id(unsigned int nb_cfg_54);
+
+struct device;
+unsigned get_apicid_base(unsigned ioapic_num);
+void amd_sibling_init(struct device *cpu);
+
#endif /* ! ASSEMBLY */
Modified: coreboot-v3/include/arch/x86/amd/k8/sysconf.h
===================================================================
--- coreboot-v3/include/arch/x86/amd/k8/sysconf.h 2008-08-11 23:55:10 UTC (rev 749)
+++ coreboot-v3/include/arch/x86/amd/k8/sysconf.h 2008-08-12 03:39:39 UTC (rev 750)
@@ -42,6 +42,6 @@
};
-extern struct amdk8_sysconf_t sysconf;
+extern struct amdk8_sysconf sysconf;
#endif
Modified: coreboot-v3/include/arch/x86/cpu.h
===================================================================
--- coreboot-v3/include/arch/x86/cpu.h 2008-08-11 23:55:10 UTC (rev 749)
+++ coreboot-v3/include/arch/x86/cpu.h 2008-08-12 03:39:39 UTC (rev 750)
@@ -99,9 +99,13 @@
r.ecx = 0;
/* ecx is often an input as well as an output. */
- __asm__("cpuid"
+ /* can't use ebx in PIC mode */
+ __asm__("pushl %%ebx"
+ "\n\tcpuid"
+ "\n\tmovl %%ebx, %%esi"
+ "\n\tpopl %%ebx"
: "=a" (r.eax),
- "=b" (r.ebx),
+ "=S" (r.ebx),
"=c" (r.ecx),
"=d" (r.edx)
: "0" (r.eax), "2" (r.ecx));
@@ -246,9 +250,9 @@
};
};
-void setup_resource_map_x_offset(const struct rmap *rm, u32 max,
+SHARED(setup_resource_map_x_offset, void, const struct rmap *rm, u32 max,
u32 offset_dev, u32 offset_pciio,
u32 offset_io);
-void setup_resource_map(const struct rmap *rm, u32 max);
+SHARED(setup_resource_map, void, const struct rmap *rm, u32 max);
#endif /* ARCH_X86_CPU_H */
Modified: coreboot-v3/include/console.h
===================================================================
--- coreboot-v3/include/console.h 2008-08-11 23:55:10 UTC (rev 749)
+++ coreboot-v3/include/console.h 2008-08-12 03:39:39 UTC (rev 750)
@@ -37,7 +37,6 @@
void console_tx_flush(void);
unsigned char console_rx_byte(void);
int console_tst_byte(void);
-void die(const char *msg);
#ifdef CONFIG_CONSOLE_BUFFER
void printk_buffer_init(void);
void printk_buffer_move(void *newaddr, int newsize);
@@ -64,5 +63,6 @@
int msg_level, const char *fmt, ...);
SHARED(banner, void, int msg_level, const char *msg);
SHARED(dump_mem_range, void, int msg_level, unsigned char *buf, int size);
+SHARED(die, void, const char *msg);
#endif /* CONSOLE_H */
Modified: coreboot-v3/include/device/device.h
===================================================================
--- coreboot-v3/include/device/device.h 2008-08-11 23:55:10 UTC (rev 749)
+++ coreboot-v3/include/device/device.h 2008-08-12 03:39:39 UTC (rev 750)
@@ -89,7 +89,7 @@
struct cpu_id
{
- u32 cpuid[3];
+ u8 cpuid[24];
};
struct cpu_bus_id
Modified: coreboot-v3/include/lib.h
===================================================================
--- coreboot-v3/include/lib.h 2008-08-11 23:55:10 UTC (rev 749)
+++ coreboot-v3/include/lib.h 2008-08-12 03:39:39 UTC (rev 750)
@@ -20,6 +20,7 @@
#ifndef LIB_H
#define LIB_H
+#include <shared.h>
/**
* Return the size of a given array, no matter of which data type
Modified: coreboot-v3/include/mc146818rtc.h
===================================================================
--- coreboot-v3/include/mc146818rtc.h 2008-08-11 23:55:10 UTC (rev 749)
+++ coreboot-v3/include/mc146818rtc.h 2008-08-12 03:39:39 UTC (rev 750)
@@ -117,8 +117,14 @@
#define RTC_LAST_BOOT_FLAG_SET (1<<1)
#define RTC_NORMAL_BOOT_FLAG_SET (1<<0)
+#ifdef STANDALONE /* standalone program using this file */
+int get_option(void *dest, char *name);
+#else
+#include <shared.h>
+
+SHARED(get_option, int, void *dest, char *name);
+#endif
void rtc_init(int invalid);
-int get_option(void *dest, char *name);
int last_boot_normal(void);
int check_normal_boot_flag(void);
Modified: coreboot-v3/include/string.h
===================================================================
--- coreboot-v3/include/string.h 2008-08-11 23:55:10 UTC (rev 749)
+++ coreboot-v3/include/string.h 2008-08-12 03:39:39 UTC (rev 750)
@@ -22,6 +22,7 @@
#define STRING_H
#include <types.h>
+#include <shared.h>
/* lib/string.c */
size_t strnlen(const char *str, size_t maxlen);
@@ -30,10 +31,10 @@
int strncmp(const char *s1, const char *s2, int maxlen);
/* lib/mem.c */
-void *memcpy(void *dest, const void *src, size_t len);
-void *memmove(void *dest, const void *src, size_t len);
-void *memset(void *s, int c, size_t len);
-int memcmp(const void *s1, const void *s2, size_t len);
+SHARED(memcpy, void *, void *dest, const void *src, size_t len);
+SHARED(memmove, void *, void *dest, const void *src, size_t len);
+SHARED(memset, void *, void *s, int c, size_t len);
+SHARED(memcmp, int , const void *s1, const void *s2, size_t len);
/* console/vsprintf.c */
int sprintf(char *buf, const char *fmt, ...);