Changes from Eric for Alpha and other support
This commit is contained in:
parent
1bb9d68a20
commit
227ca052f7
26 changed files with 1846 additions and 157 deletions
9
src/arch/alpha/include/arch/boot/boot.h
Normal file
9
src/arch/alpha/include/arch/boot/boot.h
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#ifndef ASM_ALPHA_BOOT_H
|
||||
#define ASM_ALPHA_BOOT_H
|
||||
|
||||
#define UBE64
|
||||
#define ELF_CLASS ELFCLASS64
|
||||
#define ELF_DATA ELFDATA2LSB
|
||||
#define ELF_ARCH EM_ALPHA
|
||||
|
||||
#endif /* ASM_ALPHA_BOOT_H */
|
||||
204
src/arch/alpha/include/arch/boot/hwrpb.h
Normal file
204
src/arch/alpha/include/arch/boot/hwrpb.h
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
#ifndef BOOT_HWRPB_H
|
||||
#define BOOT_HWRPB_H
|
||||
|
||||
#define INIT_HWRPB ((struct hwrpb_struct *) 0x10000000)
|
||||
|
||||
/*
|
||||
* DEC processor types for Alpha systems. Found in HWRPB.
|
||||
* These values are architected.
|
||||
*/
|
||||
|
||||
#define EV3_CPU 1 /* EV3 */
|
||||
#define EV4_CPU 2 /* EV4 (21064) */
|
||||
#define LCA4_CPU 4 /* LCA4 (21066/21068) */
|
||||
#define EV5_CPU 5 /* EV5 (21164) */
|
||||
#define EV45_CPU 6 /* EV4.5 (21064/xxx) */
|
||||
#define EV56_CPU 7 /* EV5.6 (21164) */
|
||||
#define EV6_CPU 8 /* EV6 (21264) */
|
||||
#define PCA56_CPU 9 /* PCA56 (21164PC) */
|
||||
#define PCA57_CPU 10 /* PCA57 (notyet) */
|
||||
#define EV67_CPU 11 /* EV67 (21264A) */
|
||||
|
||||
/*
|
||||
* DEC system types for Alpha systems. Found in HWRPB.
|
||||
* These values are architected.
|
||||
*/
|
||||
|
||||
#define ST_ADU 1 /* Alpha ADU systype */
|
||||
#define ST_DEC_4000 2 /* Cobra systype */
|
||||
#define ST_DEC_7000 3 /* Ruby systype */
|
||||
#define ST_DEC_3000_500 4 /* Flamingo systype */
|
||||
#define ST_DEC_2000_300 6 /* Jensen systype */
|
||||
#define ST_DEC_3000_300 7 /* Pelican systype */
|
||||
#define ST_DEC_2100_A500 9 /* Sable systype */
|
||||
#define ST_DEC_AXPVME_64 10 /* AXPvme system type */
|
||||
#define ST_DEC_AXPPCI_33 11 /* NoName system type */
|
||||
#define ST_DEC_TLASER 12 /* Turbolaser systype */
|
||||
#define ST_DEC_2100_A50 13 /* Avanti systype */
|
||||
#define ST_DEC_MUSTANG 14 /* Mustang systype */
|
||||
#define ST_DEC_ALCOR 15 /* Alcor (EV5) systype */
|
||||
#define ST_DEC_1000 17 /* Mikasa systype */
|
||||
#define ST_DEC_EB64 18 /* EB64 systype */
|
||||
#define ST_DEC_EB66 19 /* EB66 systype */
|
||||
#define ST_DEC_EB64P 20 /* EB64+ systype */
|
||||
#define ST_DEC_BURNS 21 /* laptop systype */
|
||||
#define ST_DEC_RAWHIDE 22 /* Rawhide systype */
|
||||
#define ST_DEC_K2 23 /* K2 systype */
|
||||
#define ST_DEC_LYNX 24 /* Lynx systype */
|
||||
#define ST_DEC_XL 25 /* Alpha XL systype */
|
||||
#define ST_DEC_EB164 26 /* EB164 systype */
|
||||
#define ST_DEC_NORITAKE 27 /* Noritake systype */
|
||||
#define ST_DEC_CORTEX 28 /* Cortex systype */
|
||||
#define ST_DEC_MIATA 30 /* Miata systype */
|
||||
#define ST_DEC_XXM 31 /* XXM systype */
|
||||
#define ST_DEC_TAKARA 32 /* Takara systype */
|
||||
#define ST_DEC_YUKON 33 /* Yukon systype */
|
||||
#define ST_DEC_TSUNAMI 34 /* Tsunami systype */
|
||||
#define ST_DEC_WILDFIRE 35 /* Wildfire systype */
|
||||
#define ST_DEC_CUSCO 36 /* CUSCO systype */
|
||||
#define ST_DEC_EIGER 37 /* Eiger systype */
|
||||
#define ST_DEC_TITAN 38 /* Titan systype */
|
||||
|
||||
/* UNOFFICIAL!!! */
|
||||
#define ST_UNOFFICIAL_BIAS 100
|
||||
#define ST_DTI_RUFFIAN 101 /* RUFFIAN systype */
|
||||
|
||||
/* Alpha Processor, Inc. systems */
|
||||
#define ST_API_BIAS 200
|
||||
#define ST_API_NAUTILUS 201 /* UP1000 systype */
|
||||
|
||||
struct pcb_struct {
|
||||
unsigned long ksp;
|
||||
unsigned long usp;
|
||||
unsigned long ptbr;
|
||||
unsigned int pcc;
|
||||
unsigned int asn;
|
||||
unsigned long unique;
|
||||
unsigned long flags;
|
||||
unsigned long res1, res2;
|
||||
};
|
||||
|
||||
struct percpu_struct {
|
||||
unsigned long hwpcb[16];
|
||||
unsigned long flags;
|
||||
unsigned long pal_mem_size;
|
||||
unsigned long pal_scratch_size;
|
||||
unsigned long pal_mem_pa;
|
||||
unsigned long pal_scratch_pa;
|
||||
unsigned long pal_revision;
|
||||
unsigned long type;
|
||||
unsigned long variation;
|
||||
unsigned long revision;
|
||||
unsigned long serial_no[2];
|
||||
unsigned long logout_area_pa;
|
||||
unsigned long logout_area_len;
|
||||
unsigned long halt_PCBB;
|
||||
unsigned long halt_PC;
|
||||
unsigned long halt_PS;
|
||||
unsigned long halt_arg;
|
||||
unsigned long halt_ra;
|
||||
unsigned long halt_pv;
|
||||
unsigned long halt_reason;
|
||||
unsigned long res;
|
||||
unsigned long ipc_buffer[21];
|
||||
unsigned long palcode_avail[16];
|
||||
unsigned long compatibility;
|
||||
};
|
||||
|
||||
struct procdesc_struct {
|
||||
unsigned long weird_vms_stuff;
|
||||
unsigned long address;
|
||||
};
|
||||
|
||||
struct vf_map_struct {
|
||||
unsigned long va;
|
||||
unsigned long pa;
|
||||
unsigned long count;
|
||||
};
|
||||
|
||||
struct crb_struct {
|
||||
struct procdesc_struct * dispatch_va;
|
||||
struct procdesc_struct * dispatch_pa;
|
||||
struct procdesc_struct * fixup_va;
|
||||
struct procdesc_struct * fixup_pa;
|
||||
/* virtual->physical map */
|
||||
unsigned long map_entries;
|
||||
unsigned long map_pages;
|
||||
struct vf_map_struct map[1];
|
||||
};
|
||||
|
||||
struct memclust_struct {
|
||||
unsigned long start_pfn;
|
||||
unsigned long numpages;
|
||||
unsigned long numtested;
|
||||
unsigned long bitmap_va;
|
||||
unsigned long bitmap_pa;
|
||||
unsigned long bitmap_chksum;
|
||||
unsigned long usage;
|
||||
};
|
||||
|
||||
struct memdesc_struct {
|
||||
unsigned long chksum;
|
||||
unsigned long optional_pa;
|
||||
unsigned long numclusters;
|
||||
struct memclust_struct cluster[0];
|
||||
};
|
||||
|
||||
struct dsr_struct {
|
||||
long smm; /* SMM nubber used by LMF */
|
||||
unsigned long lurt_off; /* offset to LURT table */
|
||||
unsigned long sysname_off; /* offset to sysname char count */
|
||||
};
|
||||
|
||||
struct hwrpb_struct {
|
||||
unsigned long phys_addr; /* check: physical address of the hwrpb */
|
||||
unsigned long id; /* check: "HWRPB\0\0\0" */
|
||||
unsigned long revision;
|
||||
unsigned long size; /* size of hwrpb */
|
||||
unsigned long cpuid;
|
||||
unsigned long pagesize; /* 8192, I hope */
|
||||
unsigned long pa_bits; /* number of physical address bits */
|
||||
unsigned long max_asn;
|
||||
unsigned char ssn[16]; /* system serial number: big bother is watching */
|
||||
unsigned long sys_type;
|
||||
unsigned long sys_variation;
|
||||
unsigned long sys_revision;
|
||||
unsigned long intr_freq; /* interval clock frequency * 4096 */
|
||||
unsigned long cycle_freq; /* cycle counter frequency */
|
||||
unsigned long vptb; /* Virtual Page Table Base address */
|
||||
unsigned long res1;
|
||||
unsigned long tbhb_offset; /* Translation Buffer Hint Block */
|
||||
unsigned long nr_processors;
|
||||
unsigned long processor_size;
|
||||
unsigned long processor_offset;
|
||||
unsigned long ctb_nr;
|
||||
unsigned long ctb_size; /* console terminal block size */
|
||||
unsigned long ctbt_offset; /* console terminal block table offset */
|
||||
unsigned long crb_offset; /* console callback routine block */
|
||||
unsigned long mddt_offset; /* memory data descriptor table */
|
||||
unsigned long cdb_offset; /* configuration data block (or NULL) */
|
||||
unsigned long frut_offset; /* FRU table (or NULL) */
|
||||
void (*save_terminal)(unsigned long);
|
||||
unsigned long save_terminal_data;
|
||||
void (*restore_terminal)(unsigned long);
|
||||
unsigned long restore_terminal_data;
|
||||
void (*CPU_restart)(unsigned long);
|
||||
unsigned long CPU_restart_data;
|
||||
unsigned long res2;
|
||||
unsigned long res3;
|
||||
unsigned long chksum;
|
||||
unsigned long rxrdy;
|
||||
unsigned long txrdy;
|
||||
unsigned long dsr_offset; /* "Dynamic System Recognition Data Block Table" */
|
||||
};
|
||||
|
||||
static inline void
|
||||
hwrpb_update_checksum(struct hwrpb_struct *h)
|
||||
{
|
||||
unsigned long sum = 0, *l;
|
||||
for (l = (unsigned long *) h; l < (unsigned long *) &h->chksum; ++l)
|
||||
sum += *l;
|
||||
h->chksum = sum;
|
||||
}
|
||||
|
||||
#endif /* BOOT_HWRPB_H */
|
||||
15
src/arch/alpha/include/stddef.h
Normal file
15
src/arch/alpha/include/stddef.h
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef ALPHA_STDDEF_H
|
||||
#define ALPHA_STDDEF_H
|
||||
|
||||
typedef long ptrdiff_t;
|
||||
typedef unsigned long size_t;
|
||||
typedef long ssize_t;
|
||||
|
||||
typedef int wchar_t;
|
||||
typedef unsigned int wint_t;
|
||||
|
||||
#define NULL 0
|
||||
|
||||
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
|
||||
|
||||
#endif /* ALPHA_STDDEF_H */
|
||||
53
src/arch/alpha/include/stdint.h
Normal file
53
src/arch/alpha/include/stdint.h
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
#ifndef ALPHA_STDINT_H
|
||||
#define ALPHA_STDINT_H
|
||||
|
||||
/* Exact integral types */
|
||||
typedef unsigned char uint8_t;
|
||||
typedef signed char int8_t;
|
||||
|
||||
typedef unsigned short uint16_t;
|
||||
typedef signed short int16_t;
|
||||
|
||||
typedef unsigned int uint32_t;
|
||||
typedef signed int int32_t;
|
||||
|
||||
typedef unsigned long uint64_t;
|
||||
typedef signed long int64_t;
|
||||
|
||||
|
||||
/* Small types */
|
||||
typedef unsigned char uint_least8_t;
|
||||
typedef signed char int_least8_t;
|
||||
|
||||
typedef unsigned short uint_least16_t;
|
||||
typedef signed short int_least16_t;
|
||||
|
||||
typedef unsigned int uint_least32_t;
|
||||
typedef signed int int_least32_t;
|
||||
|
||||
typedef unsigned long uint_least64_t;
|
||||
typedef signed long int_least64_t;
|
||||
|
||||
/* Fast Types */
|
||||
typedef unsigned char uint_fast8_t;
|
||||
typedef signed char int_fast8_t;
|
||||
|
||||
typedef unsigned long uint_fast16_t;
|
||||
typedef signed long int_fast16_t;
|
||||
|
||||
typedef unsigned long uint_fast32_t;
|
||||
typedef signed long int_fast32_t;
|
||||
|
||||
typedef unsigned long uint_fast64_t;
|
||||
typedef signed long int_fast64_t;
|
||||
|
||||
/* Types for `void *' pointers. */
|
||||
typedef long intptr_t;
|
||||
typedef unsigned long uintptr_t;
|
||||
|
||||
/* Largest integral types */
|
||||
typedef long intmax_t;
|
||||
typedef unsigned long uintmax_t;
|
||||
|
||||
|
||||
#endif /* ALPHA_STDINT_H */
|
||||
2
src/arch/i386/Config
Normal file
2
src/arch/i386/Config
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
makedefine ARCH=i386
|
||||
dir boot
|
||||
1
src/arch/i386/boot/Config
Normal file
1
src/arch/i386/boot/Config
Normal file
|
|
@ -0,0 +1 @@
|
|||
object boot.o
|
||||
92
src/arch/i386/boot/boot.c
Normal file
92
src/arch/i386/boot/boot.c
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
#include <boot/uniform_boot.h>
|
||||
#include <boot/elf.h>
|
||||
|
||||
#ifndef CMD_LINE
|
||||
#define CMD_LINE ""
|
||||
#endif
|
||||
|
||||
/* FIXME: the current placement of ube_all could lead to problems...
|
||||
* It should be in a location normally reserved for the bios.
|
||||
*/
|
||||
|
||||
static struct {
|
||||
struct uniform_boot_header header;
|
||||
struct {
|
||||
struct {
|
||||
struct ube_memory memory;
|
||||
struct ube_memory_range range[2];
|
||||
} mem;
|
||||
}env;
|
||||
unsigned char command_line[1024];
|
||||
} ube_all = {
|
||||
.header = {
|
||||
.header_bytes = sizeof(ube_all.header),
|
||||
.header_checksum = 0,
|
||||
.arg = (unsigned long)&ube_all.command_line,
|
||||
.arg_bytes = sizeof(ube_all.command_line),
|
||||
.env = (unsigned long)&ube_all.env,
|
||||
.env_bytes = sizeof(ube_all.env),
|
||||
},
|
||||
.env = {
|
||||
.mem = {
|
||||
.memory = {
|
||||
.tag = UBE_TAG_MEMORY,
|
||||
.size = sizeof(ube_all.env.mem),
|
||||
},
|
||||
.range = {
|
||||
#if 0
|
||||
{
|
||||
.start = 0,
|
||||
.size = 0xa0000, /* 640k */
|
||||
.type = UBE_MEM_RAM,
|
||||
},
|
||||
#else
|
||||
{
|
||||
.start = 4096, /* skip the first page */
|
||||
.size = 0x9f000, /* 640k */
|
||||
.type = UBE_MEM_RAM,
|
||||
},
|
||||
#endif
|
||||
{
|
||||
.start = 0x00100000, /* 1M */
|
||||
.size = 0, /* Fill in the size */
|
||||
.type = UBE_MEM_RAM,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
},
|
||||
.command_line = CMD_LINE,
|
||||
};
|
||||
|
||||
void *get_ube_pointer(unsigned long totalram)
|
||||
{
|
||||
ube_all.env.mem.range[1].size = ((totalram - 1024) << 10);
|
||||
ube_all.header.header_checksum = 0;
|
||||
ube_all.header.header_checksum =
|
||||
uniform_boot_compute_header_checksum(&ube_all.header);
|
||||
return &ube_all.header;
|
||||
}
|
||||
|
||||
int elf_check_arch(Elf_ehdr *ehdr)
|
||||
{
|
||||
return (
|
||||
((ehdr->e_machine == EM_386) || (ehdr->e_machine == EM_486)) &&
|
||||
(ehdr->e_ident[EI_CLASS] == ELFCLASS32) &&
|
||||
(ehdr->e_ident[EI_DATA] == ELFDATA2LSB)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
void jmp_to_elf_entry(void *entry, void *ube)
|
||||
{
|
||||
unsigned long type = 0x0A11B007;
|
||||
|
||||
/* Jump to kernel */
|
||||
__asm__ __volatile__(
|
||||
"pushl %0\n\t"
|
||||
"ret\n\t"
|
||||
:: "g" (entry), "a"(type), "b"(ube));
|
||||
}
|
||||
|
||||
|
||||
9
src/arch/i386/include/arch/boot/boot.h
Normal file
9
src/arch/i386/include/arch/boot/boot.h
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#ifndef ASM_I386_BOOT_H
|
||||
#define ASM_I386_BOOT_H
|
||||
|
||||
#define UBE32
|
||||
#define ELF_CLASS ELFCLASS32
|
||||
#define ELF_DATA ELFDATA2LSB
|
||||
#define ELF_ARCH EM_386
|
||||
|
||||
#endif /* ASM_I386_BOOT_H */
|
||||
15
src/arch/i386/include/stddef.h
Normal file
15
src/arch/i386/include/stddef.h
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef I386_STDDEF_H
|
||||
#define I386_STDDEF_H
|
||||
|
||||
typedef long ptrdiff_t;
|
||||
typedef unsigned long size_t;
|
||||
typedef long ssize_t;
|
||||
|
||||
typedef int wchar_t;
|
||||
typedef unsigned int wint_t;
|
||||
|
||||
#define NULL 0
|
||||
|
||||
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
|
||||
|
||||
#endif I386_STDDEF_H
|
||||
52
src/arch/i386/include/stdint.h
Normal file
52
src/arch/i386/include/stdint.h
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
#ifndef I386_STDINT_H
|
||||
#define I386_STDINT_H
|
||||
|
||||
/* Exact integral types */
|
||||
typedef unsigned char uint8_t;
|
||||
typedef signed char int8_t;
|
||||
|
||||
typedef unsigned short uint16_t;
|
||||
typedef signed short int16_t;
|
||||
|
||||
typedef unsigned int uint32_t;
|
||||
typedef signed int int32_t;
|
||||
|
||||
typedef unsigned long long uint64_t;
|
||||
typedef signed long long int64_t;
|
||||
|
||||
/* Small types */
|
||||
typedef unsigned char uint_least8_t;
|
||||
typedef signed char int_least8_t;
|
||||
|
||||
typedef unsigned short uint_least16_t;
|
||||
typedef signed short int_least16_t;
|
||||
|
||||
typedef unsigned int uint_least32_t;
|
||||
typedef signed int int_least32_t;
|
||||
|
||||
typedef unsigned long long uint_least64_t;
|
||||
typedef signed long long int_least64_t;
|
||||
|
||||
/* Fast Types */
|
||||
typedef unsigned char uint_fast8_t;
|
||||
typedef signed char int_fast8_t;
|
||||
|
||||
typedef unsigned int uint_fast16_t;
|
||||
typedef signed int int_fast16_t;
|
||||
|
||||
typedef unsigned int uint_fast32_t;
|
||||
typedef signed int int_fast32_t;
|
||||
|
||||
typedef unsigned long long uint_fast64_t;
|
||||
typedef signed long long int_fast64_t;
|
||||
|
||||
/* Types for `void *' pointers. */
|
||||
typedef int intptr_t;
|
||||
typedef unsigned int uintptr_t;
|
||||
|
||||
/* Largest integral types */
|
||||
typedef long long int intmax_t;
|
||||
typedef unsigned long long uintmax_t;
|
||||
|
||||
|
||||
#endif /* I386_STDINT_H */
|
||||
Loading…
Add table
Add a link
Reference in a new issue