attached.
ron
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.
Signed-off-by: Ronald G. Minnich <[EMAIL PROTECTED]>
Index: include/console.h
===================================================================
--- include/console.h (revision 744)
+++ include/console.h (working copy)
@@ -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 */
Index: include/mc146818rtc.h
===================================================================
--- include/mc146818rtc.h (revision 744)
+++ include/mc146818rtc.h (working copy)
@@ -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);
Index: include/string.h
===================================================================
--- include/string.h (revision 744)
+++ include/string.h (working copy)
@@ -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, ...);
Index: include/lib.h
===================================================================
--- include/lib.h (revision 744)
+++ include/lib.h (working copy)
@@ -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
Index: include/device/device.h
===================================================================
--- include/device/device.h (revision 744)
+++ include/device/device.h (working copy)
@@ -89,7 +89,7 @@
struct cpu_id
{
- u32 cpuid[3];
+ u8 cpuid[24];
};
struct cpu_bus_id
Index: include/arch/x86/amd/k8/k8.h
===================================================================
--- include/arch/x86/amd/k8/k8.h (revision 744)
+++ include/arch/x86/amd/k8/k8.h (working copy)
@@ -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 */
Index: include/arch/x86/amd/k8/sysconf.h
===================================================================
--- include/arch/x86/amd/k8/sysconf.h (revision 744)
+++ include/arch/x86/amd/k8/sysconf.h (working copy)
@@ -42,6 +42,6 @@
};
-extern struct amdk8_sysconf_t sysconf;
+extern struct amdk8_sysconf sysconf;
#endif
Index: include/arch/x86/cpu.h
===================================================================
--- include/arch/x86/cpu.h (revision 744)
+++ include/arch/x86/cpu.h (working copy)
@@ -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 */
--
coreboot mailing list
[email protected]
http://www.coreboot.org/mailman/listinfo/coreboot