mirror of
https://github.com/fail0verflow/switch-coreboot.git
synced 2025-05-04 01:39:18 -04:00
This change will support stage2 running LAR files. The initial example
is running the VSA in the geode lx northbridge. It builds but is not tested. lar.h: make LAR functions SHARED lar.c: make process_file non-static (i.e. global) vsmsetup.c: modify to use LAR functions. stage1.c: new function, init_archive, which is SHARED and will set up the initial archive struct. Note that some work remains. The use of unsigned longs and unsigned shorts should be changed to u32/u16 as Carl-Daniel has pointed out, Because this change requires changes elsewhere I am not including them in this patch. 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@561 f3766cd6-281f-0410-b1cd-43a5c92072e9
This commit is contained in:
parent
3ac5450814
commit
5de5570bac
4 changed files with 47 additions and 33 deletions
|
@ -50,7 +50,21 @@ static void enable_rom(void)
|
|||
post_code(POST_STAGE1_ENABLE_ROM);
|
||||
}
|
||||
|
||||
void init_archive(struct mem_file *archive)
|
||||
{
|
||||
// FIXME this should be defined in the VPD area
|
||||
// but NOT IN THE CODE.
|
||||
|
||||
/* The len field starts behind the reset vector on x86.
|
||||
* The start is not correct for all platforms. sc520 will
|
||||
* need some hands on here.
|
||||
*/
|
||||
archive->len = *(u32 *)0xfffffff4;
|
||||
archive->start =(void *)(0UL-archive->len);
|
||||
|
||||
// FIXME check integrity
|
||||
|
||||
}
|
||||
/* until we get rid of elf */
|
||||
int legacy(struct mem_file *archive, char *name, void *where, struct lb_memory *mem)
|
||||
{
|
||||
|
@ -121,18 +135,7 @@ void __attribute__((stdcall)) stage1_main(u32 bist)
|
|||
|
||||
// location and size of image.
|
||||
|
||||
// FIXME this should be defined in the VPD area
|
||||
// but NOT IN THE CODE.
|
||||
|
||||
/* The len field starts behind the reset vector on x86.
|
||||
* The start is not correct for all platforms. sc520 will
|
||||
* need some hands on here.
|
||||
*/
|
||||
archive.len = *(u32 *)0xfffffff4;
|
||||
archive.start =(void *)(0UL-archive.len);
|
||||
|
||||
// FIXME check integrity
|
||||
|
||||
init_archive(&archive);
|
||||
|
||||
// find first initram
|
||||
if (check_normal_boot_flag()) {
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#define LAR_H
|
||||
|
||||
#include <types.h>
|
||||
#include <shared.h>
|
||||
|
||||
#define MAGIC "LARCHIVE"
|
||||
#define MAX_PATHLEN 1024
|
||||
|
@ -82,11 +83,15 @@ struct mem_file {
|
|||
};
|
||||
|
||||
/* Prototypes. */
|
||||
int find_file(const struct mem_file *archive, const char *filename, struct mem_file *result);
|
||||
int copy_file(const struct mem_file *archive, const char *filename, void *where);
|
||||
int run_file(const struct mem_file *archive, const char *filename, void *where);
|
||||
int execute_in_place(const struct mem_file *archive, const char *filename);
|
||||
int run_address(void *f);
|
||||
void *load_file(const struct mem_file *archive, const char *filename);
|
||||
void *load_file_segments(const struct mem_file *archive, const char *filename);
|
||||
/* architecture-defined */
|
||||
SHARED(init_archive, void, struct mem_file *);
|
||||
/* architecture-independent */
|
||||
SHARED(find_file, int, const struct mem_file *archive, const char *filename, struct mem_file *result);
|
||||
SHARED(copy_file, int, const struct mem_file *archive, const char *filename, void *where);
|
||||
SHARED(run_file, int, const struct mem_file *archive, const char *filename, void *where);
|
||||
SHARED(execute_in_place, int, const struct mem_file *archive, const char *filename);
|
||||
SHARED(run_address, int, void *f);
|
||||
SHARED(load_file, void *, const struct mem_file *archive, const char *filename);
|
||||
SHARED(load_file_segments, void *, const struct mem_file *archive, const char *filename);
|
||||
SHARED(process_file, int, const struct mem_file *archive, void *where);
|
||||
#endif /* LAR_H */
|
||||
|
|
|
@ -145,7 +145,7 @@ int find_file(const struct mem_file *archive, const char *filename, struct mem_f
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int process_file(const struct mem_file *archive, void *where)
|
||||
int process_file(const struct mem_file *archive, void *where)
|
||||
{
|
||||
printk(BIOS_SPEW, "LAR: Compression algorithm #%i used\n", archive->compression);
|
||||
/* no compression */
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <device/pci_ids.h>
|
||||
#include <msr.h>
|
||||
#include <amd_geodelx.h>
|
||||
#include <lar.h>
|
||||
|
||||
#define VSA2_BUFFER 0x60000
|
||||
#define VSA2_ENTRY_POINT 0x60020
|
||||
|
@ -169,25 +170,30 @@ u32 VSA_msrRead(u32 msrAddr)
|
|||
|
||||
void do_vsmbios(void *bios)
|
||||
{
|
||||
struct device *dev;
|
||||
unsigned long busdevfn;
|
||||
unsigned int rom = 0;
|
||||
unsigned char *buf;
|
||||
unsigned int size = SMM_SIZE * 1024;
|
||||
int i;
|
||||
unsigned long ilen, olen;
|
||||
struct mem_file archive;
|
||||
struct mem_file file;
|
||||
|
||||
printk(BIOS_ERR, "do_vsmbios\n");
|
||||
/* clear vsm bios data area */
|
||||
for (i = 0x400; i < 0x500; i++) {
|
||||
*(volatile unsigned char *)i = 0;
|
||||
}
|
||||
init_archive(&archive);
|
||||
|
||||
if (find_file(&archive, "/blob/vsa", &file)){
|
||||
printk(BIOS_ERR, "NO VSA found!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (process_file(&file, (void *)VSA2_BUFFER)) {
|
||||
printk(BIOS_ERR, "Processing /blob/vsa failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
rom = (unsigned long) bios;
|
||||
buf = (unsigned char *)VSA2_BUFFER;
|
||||
// FIXME
|
||||
//olen = unrv2b((u8 *) rom, buf, &ilen);
|
||||
printk(BIOS_DEBUG, "buf ilen %d olen%d\n", ilen, olen);
|
||||
printk(BIOS_DEBUG, "buf ilen %d real len %uld\n", file.len, file.reallen);
|
||||
printk(BIOS_DEBUG, "buf %p *buf %d buf[256k] %d\n",
|
||||
buf, buf[0], buf[SMM_SIZE * 1024]);
|
||||
printk(BIOS_DEBUG, "buf[0x20] signature is %x:%x:%x:%x\n",
|
||||
|
@ -253,16 +259,16 @@ static int biosint(unsigned long intnumber,
|
|||
eax, ebx, ecx, edx);
|
||||
printk(BIOS_DEBUG, "biosint: ebp 0x%lx esp 0x%lx edi 0x%lx esi 0x%lx\n",
|
||||
ebp, esp, edi, esi);
|
||||
printk(BIOS_DEBUG, "biosint: ip 0x%x cs 0x%x flags 0x%x\n",
|
||||
printk(BIOS_DEBUG, "biosint: ip 0x%lx cs 0x%lx flags 0x%lx\n",
|
||||
ip, cs, flags);
|
||||
printk(BIOS_DEBUG, "biosint: gs 0x%x fs 0x%x ds 0x%x es 0x%x\n",
|
||||
printk(BIOS_DEBUG, "biosint: gs 0x%lx fs 0x%lx ds 0x%lx es 0x%lx\n",
|
||||
gsfs >> 16, gsfs & 0xffff, dses >> 16, dses & 0xffff);
|
||||
|
||||
// cases in a good compiler are just as good as your own tables.
|
||||
switch (intnumber) {
|
||||
case 0 ... 15:
|
||||
// These are not BIOS service, but the CPU-generated exceptions
|
||||
printk(BIOS_INFO, "biosint: Oops, exception %u\n", intnumber);
|
||||
printk(BIOS_INFO, "biosint: Oops, exception %lu\n", intnumber);
|
||||
if (esp < 0x1000) {
|
||||
printk(BIOS_DEBUG, "Stack contents: ");
|
||||
while (esp < 0x1000) {
|
||||
|
@ -290,7 +296,7 @@ static int biosint(unsigned long intnumber,
|
|||
&ebx, &edx, &ecx, &eax, &flags);
|
||||
break;
|
||||
default:
|
||||
printk(BIOS_INFO, "BIOSINT: Unsupport int #0x%x\n", intnumber);
|
||||
printk(BIOS_INFO, "BIOSINT: Unsupport int #0x%lx\n", intnumber);
|
||||
break;
|
||||
}
|
||||
if (ret)
|
||||
|
|
Loading…
Add table
Reference in a new issue