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@gmail.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>


git-svn-id: svn://coreboot.org/repository/coreboot-v3@750 f3766cd6-281f-0410-b1cd-43a5c92072e9
This commit is contained in:
Ronald G. Minnich 2008-08-12 03:39:39 +00:00
commit 7e78ce492a
8 changed files with 40 additions and 12 deletions

View file

@ -422,4 +422,20 @@ struct sys_info {
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 */

View file

@ -42,6 +42,6 @@ struct amdk8_sysconf{
};
extern struct amdk8_sysconf_t sysconf;
extern struct amdk8_sysconf sysconf;
#endif

View file

@ -99,9 +99,13 @@ static inline struct cpuid_result cpuid(u32 op)
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 @@ struct rmap {
};
};
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 */

View file

@ -37,7 +37,6 @@ void console_tx_byte(unsigned char byte, void *arg);
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 @@ SHARED_WITH_ATTRIBUTES(printk, int, __attribute__((format (printf, 2, 3))),
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 */

View file

@ -89,7 +89,7 @@ struct apic_cluster_id
struct cpu_id
{
u32 cpuid[3];
u8 cpuid[24];
};
struct cpu_bus_id

View file

@ -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

View file

@ -117,8 +117,14 @@
#define RTC_LAST_BOOT_FLAG_SET (1<<1)
#define RTC_NORMAL_BOOT_FLAG_SET (1<<0)
void rtc_init(int invalid);
#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 last_boot_normal(void);
int check_normal_boot_flag(void);

View file

@ -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 strcmp(const char *s1, const char *s2);
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, ...);