Cleanup of the header mess: removed the redundant APIC/mp structure definitions
from smp_priv.h and stage2_priv.h. Created a new file smp_apic.h which now contains those definitions. Made the APIC_xxx register offsets only base offsets (without referencing a particular variable). Other small cleanups (i.e. "unsigned int" to uint32). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2604 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
2dc97fdf08
commit
9175b5a5e0
@ -7,7 +7,6 @@
|
||||
|
||||
#include <stage2_struct.h>
|
||||
|
||||
|
||||
#define MAX_BOOT_PTABLES 4
|
||||
|
||||
#define _PACKED __attribute__((packed))
|
||||
@ -18,25 +17,25 @@
|
||||
// kernel args
|
||||
typedef struct {
|
||||
// architecture specific
|
||||
unsigned int system_time_cv_factor;
|
||||
unsigned int phys_pgdir;
|
||||
unsigned int vir_pgdir;
|
||||
unsigned int num_pgtables;
|
||||
unsigned int pgtables[MAX_BOOT_PTABLES];
|
||||
unsigned int phys_idt;
|
||||
unsigned int vir_idt;
|
||||
unsigned int phys_gdt;
|
||||
unsigned int vir_gdt;
|
||||
unsigned int page_hole;
|
||||
uint32 system_time_cv_factor;
|
||||
uint32 phys_pgdir;
|
||||
uint32 vir_pgdir;
|
||||
uint32 num_pgtables;
|
||||
uint32 pgtables[MAX_BOOT_PTABLES];
|
||||
uint32 phys_idt;
|
||||
uint32 vir_idt;
|
||||
uint32 phys_gdt;
|
||||
uint32 vir_gdt;
|
||||
uint32 page_hole;
|
||||
// smp stuff
|
||||
unsigned int apic_time_cv_factor; // apic ticks per second
|
||||
unsigned int apic_phys;
|
||||
unsigned int *apic;
|
||||
unsigned int ioapic_phys;
|
||||
unsigned int *ioapic;
|
||||
unsigned int cpu_apic_id[MAX_BOOT_CPUS];
|
||||
unsigned int cpu_os_id[MAX_BOOT_CPUS];
|
||||
unsigned int cpu_apic_version[MAX_BOOT_CPUS];
|
||||
uint32 apic_time_cv_factor; // apic ticks per second
|
||||
uint32 apic_phys;
|
||||
uint32 *apic;
|
||||
uint32 ioapic_phys;
|
||||
uint32 *ioapic;
|
||||
uint32 cpu_apic_id[MAX_BOOT_CPUS];
|
||||
uint32 cpu_os_id[MAX_BOOT_CPUS];
|
||||
uint32 cpu_apic_version[MAX_BOOT_CPUS];
|
||||
} arch_kernel_args;
|
||||
|
||||
#endif /* _KERNEL_ARCH_x86_STAGE2_H */
|
||||
|
161
headers/private/kernel/arch/x86/smp_apic.h
Normal file
161
headers/private/kernel/arch/x86/smp_apic.h
Normal file
@ -0,0 +1,161 @@
|
||||
/*
|
||||
** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
||||
** Distributed under the terms of the NewOS License.
|
||||
*/
|
||||
#ifndef _KERNEL_ARCH_x86_SMP_APIC_H
|
||||
#define _KERNEL_ARCH_x86_SMP_APIC_H
|
||||
|
||||
#define MP_FLT_SIGNATURE '_PM_'
|
||||
#define MP_CTH_SIGNATURE 'PCMP'
|
||||
|
||||
#define APIC_DM_INIT (5 << 8)
|
||||
#define APIC_DM_STARTUP (6 << 8)
|
||||
#define APIC_LEVEL_TRIG (1 << 14)
|
||||
#define APIC_ASSERT (1 << 13)
|
||||
|
||||
#define APIC_ENABLE 0x100
|
||||
#define APIC_FOCUS (~(1 << 9))
|
||||
#define APIC_SIV (0xff)
|
||||
|
||||
// offsets to APIC register
|
||||
#define APIC_ID 0x020
|
||||
#define APIC_VERSION 0x030
|
||||
#define APIC_TPRI 0x080
|
||||
#define APIC_EOI 0x0b0
|
||||
#define APIC_LDR 0x0d0
|
||||
#define APIC_SIVR 0x0f0
|
||||
#define APIC_ESR 0x280
|
||||
#define APIC_ICR1 0x300
|
||||
#define APIC_ICR2 0x310
|
||||
#define APIC_LVTT 0x320
|
||||
#define APIC_LINT0 0x350
|
||||
#define APIC_LINT1 0x360
|
||||
#define APIC_LVT3 0x370
|
||||
#define APIC_ICRT 0x380
|
||||
#define APIC_CCRT 0x390
|
||||
#define APIC_TDCR 0x3e0
|
||||
|
||||
#define APIC_ICR1_WRITE_MASK 0xfff3f000
|
||||
#define APIC_ICR1_DELMODE_FIXED 0
|
||||
#define APIC_ICR1_DELMODE_LOWESTPRI (1 << 8)
|
||||
#define APIC_ICR1_DESTMODE_LOG (1 << 11)
|
||||
#define APIC_ICR1_DESTMODE_PHYS 0
|
||||
|
||||
#define APIC_ICR1_READ_MASK 0xfff32000
|
||||
#define APIC_ICR1_DELSTATUS (1 << 12)
|
||||
|
||||
#define APIC_ICR1_DEST_FIELD (0)
|
||||
#define APIC_ICR1_DEST_SELF (1 << 18)
|
||||
#define APIC_ICR1_DEST_ALL (2 << 18)
|
||||
#define APIC_ICR1_DEST_ALL_BUT_SELF (3 << 18)
|
||||
|
||||
#define APIC_ICR2_MASK 0x00ffffff
|
||||
|
||||
#define APIC_TDCR_2 0x00
|
||||
#define APIC_TDCR_4 0x01
|
||||
#define APIC_TDCR_8 0x02
|
||||
#define APIC_TDCR_16 0x03
|
||||
#define APIC_TDCR_32 0x08
|
||||
#define APIC_TDCR_64 0x09
|
||||
#define APIC_TDCR_128 0x0a
|
||||
#define APIC_TDCR_1 0x0b
|
||||
|
||||
#define APIC_LVTT_MASK 0x000310ff
|
||||
#define APIC_LVTT_VECTOR 0x000000ff
|
||||
#define APIC_LVTT_DS 0x00001000
|
||||
#define APIC_LVTT_M 0x00010000
|
||||
#define APIC_LVTT_TM 0x00020000
|
||||
|
||||
#define APIC_LVT_DM 0x00000700
|
||||
#define APIC_LVT_DM_ExtINT 0x00000700
|
||||
#define APIC_LVT_DM_NMI 0x00000400
|
||||
#define APIC_LVT_IIPP 0x00002000
|
||||
#define APIC_LVT_TM 0x00008000
|
||||
#define APIC_LVT_M 0x00010000
|
||||
#define APIC_LVT_OS 0x00020000
|
||||
|
||||
#define APIC_TPR_PRIO 0x000000ff
|
||||
#define APIC_TPR_INT 0x000000f0
|
||||
#define APIC_TPR_SUB 0x0000000f
|
||||
|
||||
#define APIC_SVR_SWEN 0x00000100
|
||||
#define APIC_SVR_FOCUS 0x00000200
|
||||
|
||||
#define APIC_DEST_STARTUP 0x00600
|
||||
|
||||
#define LOPRIO_LEVEL 0x00000010
|
||||
|
||||
#define IOAPIC_ID 0x0
|
||||
#define IOAPIC_VERSION 0x1
|
||||
#define IOAPIC_ARB 0x2
|
||||
#define IOAPIC_REDIR_TABLE 0x10
|
||||
|
||||
#define IPI_CACHE_FLUSH 0x40
|
||||
#define IPI_INV_TLB 0x41
|
||||
#define IPI_INV_PTE 0x42
|
||||
#define IPI_INV_RESCHED 0x43
|
||||
#define IPI_STOP 0x44
|
||||
|
||||
#define MP_EXT_PE 0
|
||||
#define MP_EXT_BUS 1
|
||||
#define MP_EXT_IO_APIC 2
|
||||
#define MP_EXT_IO_INT 3
|
||||
#define MP_EXT_LOCAL_INT 4
|
||||
|
||||
#define MP_EXT_PE_LEN 20
|
||||
#define MP_EXT_BUS_LEN 8
|
||||
#define MP_EXT_IO_APIC_LEN 8
|
||||
#define MP_EXT_IO_INT_LEN 8
|
||||
#define MP_EXT_LOCAL_INT_LEN 8
|
||||
|
||||
struct mp_config_table {
|
||||
uint32 signature; /* "PCMP" */
|
||||
uint16 table_len; /* length of this structure */
|
||||
uint8 mp_rev; /* spec supported, 1 for 1.1 or 4 for 1.4 */
|
||||
uint8 checksum; /* checksum, all bytes add up to zero */
|
||||
char oem[8]; /* oem identification, not null-terminated */
|
||||
char product[12]; /* product name, not null-terminated */
|
||||
void *oem_table_ptr; /* addr of oem-defined table, zero if none */
|
||||
uint16 oem_len; /* length of oem table */
|
||||
uint16 num_entries; /* number of entries in base table */
|
||||
uint32 apic; /* address of apic */
|
||||
uint16 ext_len; /* length of extended section */
|
||||
uint8 ext_checksum; /* checksum of extended table entries */
|
||||
};
|
||||
|
||||
struct mp_flt_struct {
|
||||
uint32 signature; /* "_MP_" */
|
||||
struct mp_config_table *mpc; /* address of mp configuration table */
|
||||
uint8 mpc_len; /* length of this structure in 16-byte units */
|
||||
uint8 mp_rev; /* spec supported, 1 for 1.1 or 4 for 1.4 */
|
||||
uint8 checksum; /* checksum, all bytes add up to zero */
|
||||
uint8 mp_feature_1; /* mp system configuration type if no mpc */
|
||||
uint8 mp_feature_2; /* imcrp */
|
||||
uint8 mp_feature_3, mp_feature_4, mp_feature_5; /* reserved */
|
||||
};
|
||||
|
||||
struct mp_ext_pe {
|
||||
uint8 type;
|
||||
uint8 apic_id;
|
||||
uint8 apic_version;
|
||||
uint8 cpu_flags;
|
||||
uint32 signature; /* stepping, model, family, each four bits */
|
||||
uint32 feature_flags;
|
||||
uint32 res1, res2;
|
||||
};
|
||||
|
||||
struct mp_ext_ioapic {
|
||||
uint8 type;
|
||||
uint8 ioapic_id;
|
||||
uint8 ioapic_version;
|
||||
uint8 ioapic_flags;
|
||||
uint32 *addr;
|
||||
};
|
||||
|
||||
struct mp_ext_bus {
|
||||
uint8 type;
|
||||
uint8 bus_id;
|
||||
char name[6];
|
||||
};
|
||||
|
||||
#endif /* _KERNEL_ARCH_x86_SMP_APIC_H */
|
@ -2,8 +2,8 @@
|
||||
** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
||||
** Distributed under the terms of the NewOS License.
|
||||
*/
|
||||
#ifndef _NEWOS_KERNEL_ARCH_I386_SMP_PRIV_H
|
||||
#define _NEWOS_KERNEL_ARCH_I386_SMP_PRIV_H
|
||||
#ifndef _KERNEL_ARCH_x86_SMP_PRIV_H
|
||||
#define _KERNEL_ARCH_x86_SMP_PRIV_H
|
||||
|
||||
int i386_smp_interrupt(int vector);
|
||||
void arch_smp_ack_interrupt(void);
|
||||
@ -11,151 +11,4 @@ int arch_smp_set_apic_timer(bigtime_t relative_timeout);
|
||||
int arch_smp_clear_apic_timer(void);
|
||||
int smp_intercpu_int_handler(void);
|
||||
|
||||
#define MP_FLT_SIGNATURE '_PM_'
|
||||
#define MP_CTH_SIGNATURE 'PCMP'
|
||||
|
||||
#define APIC_DM_INIT (5 << 8)
|
||||
#define APIC_DM_STARTUP (6 << 8)
|
||||
#define APIC_LEVEL_TRIG (1 << 14)
|
||||
#define APIC_ASSERT (1 << 13)
|
||||
|
||||
#define APIC_ENABLE 0x100
|
||||
#define APIC_FOCUS (~(1 << 9))
|
||||
#define APIC_SIV (0xff)
|
||||
|
||||
#define APIC_ID ((unsigned int *) ((unsigned int) apic + 0x020))
|
||||
#define APIC_VERSION ((unsigned int *) ((unsigned int) apic + 0x030))
|
||||
#define APIC_TPRI ((unsigned int *) ((unsigned int) apic + 0x080))
|
||||
#define APIC_EOI ((unsigned int *) ((unsigned int) apic + 0x0b0))
|
||||
#define APIC_SIVR ((unsigned int *) ((unsigned int) apic + 0x0f0))
|
||||
#define APIC_ESR ((unsigned int *) ((unsigned int) apic + 0x280))
|
||||
#define APIC_ICR1 ((unsigned int *) ((unsigned int) apic + 0x300))
|
||||
#define APIC_ICR2 ((unsigned int *) ((unsigned int) apic + 0x310))
|
||||
#define APIC_LVTT ((unsigned int *) ((unsigned int) apic + 0x320))
|
||||
#define APIC_LINT0 ((unsigned int *) ((unsigned int) apic + 0x350))
|
||||
#define APIC_LVT3 ((unsigned int *) ((unsigned int) apic + 0x370))
|
||||
#define APIC_ICRT ((unsigned int *) ((unsigned int) apic + 0x380))
|
||||
#define APIC_CCRT ((unsigned int *) ((unsigned int) apic + 0x390))
|
||||
#define APIC_TDCR ((unsigned int *) ((unsigned int) apic + 0x3e0))
|
||||
|
||||
#define APIC_ICR1_WRITE_MASK 0xfff3f000
|
||||
#define APIC_ICR1_DELMODE_FIXED 0
|
||||
#define APIC_ICR1_DELMODE_LOWESTPRI (1 << 8)
|
||||
#define APIC_ICR1_DESTMODE_LOG (1 << 11)
|
||||
#define APIC_ICR1_DESTMODE_PHYS 0
|
||||
|
||||
#define APIC_ICR1_READ_MASK 0xfff32000
|
||||
#define APIC_ICR1_DELSTATUS (1 << 12)
|
||||
|
||||
#define APIC_ICR1_DEST_FIELD (0)
|
||||
#define APIC_ICR1_DEST_SELF (1 << 18)
|
||||
#define APIC_ICR1_DEST_ALL (2 << 18)
|
||||
#define APIC_ICR1_DEST_ALL_BUT_SELF (3 << 18)
|
||||
|
||||
|
||||
|
||||
#define APIC_ICR2_MASK 0x00ffffff
|
||||
|
||||
#define APIC_TDCR_2 0x00
|
||||
#define APIC_TDCR_4 0x01
|
||||
#define APIC_TDCR_8 0x02
|
||||
#define APIC_TDCR_16 0x03
|
||||
#define APIC_TDCR_32 0x08
|
||||
#define APIC_TDCR_64 0x09
|
||||
#define APIC_TDCR_128 0x0a
|
||||
#define APIC_TDCR_1 0x0b
|
||||
|
||||
#define APIC_LVTT_MASK 0x000310ff
|
||||
#define APIC_LVTT_VECTOR 0x000000ff
|
||||
#define APIC_LVTT_DS 0x00001000
|
||||
#define APIC_LVTT_M 0x00010000
|
||||
#define APIC_LVTT_TM 0x00020000
|
||||
|
||||
#define APIC_LVT_DM 0x00000700
|
||||
#define APIC_LVT_IIPP 0x00002000
|
||||
#define APIC_LVT_TM 0x00008000
|
||||
#define APIC_LVT_M 0x00010000
|
||||
#define APIC_LVT_OS 0x00020000
|
||||
|
||||
#define APIC_TPR_PRIO 0x000000ff
|
||||
#define APIC_TPR_INT 0x000000f0
|
||||
#define APIC_TPR_SUB 0x0000000f
|
||||
|
||||
#define APIC_SVR_SWEN 0x00000100
|
||||
#define APIC_SVR_FOCUS 0x00000200
|
||||
|
||||
#define APIC_DEST_STARTUP 0x00600
|
||||
|
||||
#define LOPRIO_LEVEL 0x00000010
|
||||
|
||||
#define IOAPIC_ID 0x0
|
||||
#define IOAPIC_VERSION 0x1
|
||||
#define IOAPIC_ARB 0x2
|
||||
#define IOAPIC_REDIR_TABLE 0x10
|
||||
|
||||
#define IPI_CACHE_FLUSH 0x40
|
||||
#define IPI_INV_TLB 0x41
|
||||
#define IPI_INV_PTE 0x42
|
||||
#define IPI_INV_RESCHED 0x43
|
||||
#define IPI_STOP 0x44
|
||||
|
||||
#define MP_EXT_PE 0
|
||||
#define MP_EXT_BUS 1
|
||||
#define MP_EXT_IO_APIC 2
|
||||
#define MP_EXT_IO_INT 3
|
||||
#define MP_EXT_LOCAL_INT 4
|
||||
|
||||
#define MP_EXT_PE_LEN 20
|
||||
#define MP_EXT_BUS_LEN 8
|
||||
#define MP_EXT_IO_APIC_LEN 8
|
||||
#define MP_EXT_IO_INT_LEN 8
|
||||
#define MP_EXT_LOCAL_INT_LEN 8
|
||||
|
||||
struct mp_config_table {
|
||||
unsigned int signature; /* "PCMP" */
|
||||
unsigned short table_len; /* length of this structure */
|
||||
unsigned char mp_rev; /* spec supported, 1 for 1.1 or 4 for 1.4 */
|
||||
unsigned char checksum; /* checksum, all bytes add up to zero */
|
||||
char oem[8]; /* oem identification, not null-terminated */
|
||||
char product[12]; /* product name, not null-terminated */
|
||||
void *oem_table_ptr; /* addr of oem-defined table, zero if none */
|
||||
unsigned short oem_len; /* length of oem table */
|
||||
unsigned short num_entries; /* number of entries in base table */
|
||||
unsigned int apic; /* address of apic */
|
||||
unsigned short ext_len; /* length of extended section */
|
||||
unsigned char ext_checksum; /* checksum of extended table entries */
|
||||
};
|
||||
|
||||
struct mp_flt_struct {
|
||||
unsigned int signature; /* "_MP_" */
|
||||
struct mp_config_table *mpc; /* address of mp configuration table */
|
||||
unsigned char mpc_len; /* length of this structure in 16-byte units */
|
||||
unsigned char mp_rev; /* spec supported, 1 for 1.1 or 4 for 1.4 */
|
||||
unsigned char checksum; /* checksum, all bytes add up to zero */
|
||||
unsigned char mp_feature_1; /* mp system configuration type if no mpc */
|
||||
unsigned char mp_feature_2; /* imcrp */
|
||||
unsigned char mp_feature_3, mp_feature_4, mp_feature_5; /* reserved */
|
||||
};
|
||||
|
||||
struct mp_ext_pe
|
||||
{
|
||||
unsigned char type;
|
||||
unsigned char apic_id;
|
||||
unsigned char apic_version;
|
||||
unsigned char cpu_flags;
|
||||
unsigned int signature; /* stepping, model, family, each four bits */
|
||||
unsigned int feature_flags;
|
||||
unsigned int res1, res2;
|
||||
};
|
||||
|
||||
struct mp_ext_ioapic
|
||||
{
|
||||
unsigned char type;
|
||||
unsigned char ioapic_id;
|
||||
unsigned char ioapic_version;
|
||||
unsigned char ioapic_flags;
|
||||
unsigned int *addr;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _KERNEL_ARCH_x86_SMP_PRIV_H */
|
||||
|
@ -2,14 +2,13 @@
|
||||
** Copyright 2001, Travis Geiselbrecht. All rights reserved.
|
||||
** Distributed under the terms of the NewOS License.
|
||||
*/
|
||||
|
||||
#ifndef _STAGE2_PRIV_H
|
||||
#define _STAGE2_PRIV_H
|
||||
|
||||
#include <stage2.h>
|
||||
#include <ktypes.h>
|
||||
|
||||
extern void _start(unsigned int mem, int in_vesa, unsigned int vesa_ptr);
|
||||
extern void _start(uint32 mem, int in_vesa, uint32 vesa_ptr);
|
||||
extern void clearscreen(void);
|
||||
extern void kputs(const char *str);
|
||||
extern int dprintf(const char *fmt, ...);
|
||||
@ -19,8 +18,8 @@ extern void execute_n_instructions(int count);
|
||||
void system_time_setup(long a);
|
||||
uint64 rdtsc();
|
||||
unsigned int get_eflags(void);
|
||||
void set_eflags(unsigned int val);
|
||||
void cpuid(unsigned int selector, unsigned int *data);
|
||||
void set_eflags(uint32 val);
|
||||
void cpuid(uint32 selector, uint32 *data);
|
||||
|
||||
//void put_uint_dec(unsigned int a);
|
||||
//void put_uint_hex(unsigned int a);
|
||||
@ -40,155 +39,13 @@ void cpuid(unsigned int selector, unsigned int *data);
|
||||
#define ADDR_MASK 0xfffff000
|
||||
|
||||
struct gdt_idt_descr {
|
||||
unsigned short a;
|
||||
unsigned int *b;
|
||||
uint16 a;
|
||||
uint32 *b;
|
||||
} _PACKED;
|
||||
|
||||
// SMP stuff
|
||||
extern int smp_boot(kernel_args *ka, unsigned int kernel_entry);
|
||||
extern int smp_boot(kernel_args *ka, uint32 kernel_entry);
|
||||
extern void smp_trampoline(void);
|
||||
extern void smp_trampoline_end(void);
|
||||
|
||||
#define MP_FLT_SIGNATURE '_PM_'
|
||||
#define MP_CTH_SIGNATURE 'PCMP'
|
||||
|
||||
#define APIC_DM_INIT (5 << 8)
|
||||
#define APIC_DM_STARTUP (6 << 8)
|
||||
#define APIC_LEVEL_TRIG (1 << 14)
|
||||
#define APIC_ASSERT (1 << 13)
|
||||
|
||||
#define APIC_ENABLE 0x100
|
||||
#define APIC_FOCUS (~(1 << 9))
|
||||
#define APIC_SIV (0xff)
|
||||
|
||||
#define APIC_ID ((unsigned int *) ((unsigned int) ka->arch_args.apic + 0x020))
|
||||
#define APIC_VERSION ((unsigned int *) ((unsigned int) ka->arch_args.apic + 0x030))
|
||||
#define APIC_TPRI ((unsigned int *) ((unsigned int) ka->arch_args.apic + 0x080))
|
||||
#define APIC_EOI ((unsigned int *) ((unsigned int) ka->arch_args.apic + 0x0b0))
|
||||
#define APIC_LDR ((unsigned int *) ((unsigned int) ka->arch_args.apic + 0x0d0))
|
||||
#define APIC_SIVR ((unsigned int *) ((unsigned int) ka->arch_args.apic + 0x0f0))
|
||||
#define APIC_ESR ((unsigned int *) ((unsigned int) ka->arch_args.apic + 0x280))
|
||||
#define APIC_ICR1 ((unsigned int *) ((unsigned int) ka->arch_args.apic + 0x300))
|
||||
#define APIC_ICR2 ((unsigned int *) ((unsigned int) ka->arch_args.apic + 0x310))
|
||||
#define APIC_LVTT ((unsigned int *) ((unsigned int) ka->arch_args.apic + 0x320))
|
||||
#define APIC_LINT0 ((unsigned int *) ((unsigned int) ka->arch_args.apic + 0x350))
|
||||
#define APIC_LINT1 ((unsigned int *) ((unsigned int) ka->arch_args.apic + 0x360))
|
||||
#define APIC_LVT3 ((unsigned int *) ((unsigned int) ka->arch_args.apic + 0x370))
|
||||
#define APIC_ICRT ((unsigned int *) ((unsigned int) ka->arch_args.apic + 0x380))
|
||||
#define APIC_CCRT ((unsigned int *) ((unsigned int) ka->arch_args.apic + 0x390))
|
||||
#define APIC_TDCR ((unsigned int *) ((unsigned int) ka->arch_args.apic + 0x3e0))
|
||||
|
||||
#define APIC_TDCR_2 0x00
|
||||
#define APIC_TDCR_4 0x01
|
||||
#define APIC_TDCR_8 0x02
|
||||
#define APIC_TDCR_16 0x03
|
||||
#define APIC_TDCR_32 0x08
|
||||
#define APIC_TDCR_64 0x09
|
||||
#define APIC_TDCR_128 0x0a
|
||||
#define APIC_TDCR_1 0x0b
|
||||
|
||||
#define APIC_LVTT_MASK 0x000310ff
|
||||
#define APIC_LVTT_VECTOR 0x000000ff
|
||||
#define APIC_LVTT_DS 0x00001000
|
||||
#define APIC_LVTT_M 0x00010000
|
||||
#define APIC_LVTT_TM 0x00020000
|
||||
|
||||
#define APIC_LVT_DM_ExtINT 0x00000700
|
||||
#define APIC_LVT_DM_NMI 0x00000400
|
||||
#define APIC_LVT_IIPP 0x00002000
|
||||
#define APIC_LVT_TM 0x00008000
|
||||
#define APIC_LVT_M 0x00010000
|
||||
#define APIC_LVT_OS 0x00020000
|
||||
#define APIC_TPR_PRIO 0x000000ff
|
||||
#define APIC_TPR_INT 0x000000f0
|
||||
#define APIC_TPR_SUB 0x0000000f
|
||||
|
||||
#define APIC_SVR_SWEN 0x00000100
|
||||
#define APIC_SVR_FOCUS 0x00000200
|
||||
|
||||
#define APIC_DEST_STARTUP 0x00600
|
||||
|
||||
#define LOPRIO_LEVEL 0x00000010
|
||||
|
||||
#define APIC_DEST_FIELD (0)
|
||||
#define APIC_DEST_SELF (1 << 18)
|
||||
#define APIC_DEST_ALL (2 << 18)
|
||||
#define APIC_DEST_ALL_BUT_SELF (3 << 18)
|
||||
|
||||
#define IOAPIC_ID 0x0
|
||||
#define IOAPIC_VERSION 0x1
|
||||
#define IOAPIC_ARB 0x2
|
||||
#define IOAPIC_REDIR_TABLE 0x10
|
||||
|
||||
#define IPI_CACHE_FLUSH 0x40
|
||||
#define IPI_INV_TLB 0x41
|
||||
#define IPI_INV_PTE 0x42
|
||||
#define IPI_INV_RESCHED 0x43
|
||||
#define IPI_STOP 0x44
|
||||
|
||||
#define MP_EXT_PE 0
|
||||
#define MP_EXT_BUS 1
|
||||
#define MP_EXT_IO_APIC 2
|
||||
#define MP_EXT_IO_INT 3
|
||||
#define MP_EXT_LOCAL_INT 4
|
||||
|
||||
#define MP_EXT_PE_LEN 20
|
||||
#define MP_EXT_BUS_LEN 8
|
||||
#define MP_EXT_IO_APIC_LEN 8
|
||||
#define MP_EXT_IO_INT_LEN 8
|
||||
#define MP_EXT_LOCAL_INT_LEN 8
|
||||
|
||||
struct mp_config_table {
|
||||
unsigned int signature; /* "PCMP" */
|
||||
unsigned short table_len; /* length of this structure */
|
||||
unsigned char mp_rev; /* spec supported, 1 for 1.1 or 4 for 1.4 */
|
||||
unsigned char checksum; /* checksum, all bytes add up to zero */
|
||||
char oem[8]; /* oem identification, not null-terminated */
|
||||
char product[12]; /* product name, not null-terminated */
|
||||
void *oem_table_ptr; /* addr of oem-defined table, zero if none */
|
||||
unsigned short oem_len; /* length of oem table */
|
||||
unsigned short num_entries; /* number of entries in base table */
|
||||
unsigned int apic; /* address of apic */
|
||||
unsigned short ext_len; /* length of extended section */
|
||||
unsigned char ext_checksum; /* checksum of extended table entries */
|
||||
};
|
||||
|
||||
struct mp_flt_struct {
|
||||
unsigned int signature; /* "_MP_" */
|
||||
struct mp_config_table *mpc; /* address of mp configuration table */
|
||||
unsigned char mpc_len; /* length of this structure in 16-byte units */
|
||||
unsigned char mp_rev; /* spec supported, 1 for 1.1 or 4 for 1.4 */
|
||||
unsigned char checksum; /* checksum, all bytes add up to zero */
|
||||
unsigned char mp_feature_1; /* mp system configuration type if no mpc */
|
||||
unsigned char mp_feature_2; /* imcrp */
|
||||
unsigned char mp_feature_3, mp_feature_4, mp_feature_5; /* reserved */
|
||||
};
|
||||
|
||||
struct mp_ext_pe
|
||||
{
|
||||
unsigned char type;
|
||||
unsigned char apic_id;
|
||||
unsigned char apic_version;
|
||||
unsigned char cpu_flags;
|
||||
unsigned int signature; /* stepping, model, family, each four bits */
|
||||
unsigned int feature_flags;
|
||||
unsigned int res1, res2;
|
||||
};
|
||||
|
||||
struct mp_ext_ioapic
|
||||
{
|
||||
unsigned char type;
|
||||
unsigned char ioapic_id;
|
||||
unsigned char ioapic_version;
|
||||
unsigned char ioapic_flags;
|
||||
unsigned int *addr;
|
||||
};
|
||||
|
||||
struct mp_ext_bus
|
||||
{
|
||||
unsigned char type;
|
||||
unsigned char bus_id;
|
||||
char name[6];
|
||||
};
|
||||
|
||||
#endif /* _STAGE2_PRIV_H */
|
||||
|
@ -8,45 +8,37 @@
|
||||
|
||||
// this file declares stuff like addr_range, MAX_*, etc.
|
||||
#include <stage2_struct.h>
|
||||
|
||||
/* david - I renmaed arch/.../stage2.h to arch_stage2.h and so
|
||||
* as we have the arch specific include directory on the include
|
||||
* path we can just include it here. It's neater and avoids a
|
||||
* name collision that could cause us problems at some point in
|
||||
* the future.
|
||||
*/
|
||||
#include <arch_stage2.h>
|
||||
|
||||
|
||||
// kernel args
|
||||
typedef struct ka {
|
||||
unsigned int cons_line;
|
||||
char *str;
|
||||
addr_range bootdir_addr;
|
||||
addr_range kernel_seg0_addr;
|
||||
addr_range kernel_seg1_addr;
|
||||
addr_range kernel_dynamic_section_addr;
|
||||
unsigned int num_phys_mem_ranges;
|
||||
uint32 cons_line;
|
||||
char *str;
|
||||
addr_range bootdir_addr;
|
||||
addr_range kernel_seg0_addr;
|
||||
addr_range kernel_seg1_addr;
|
||||
addr_range kernel_dynamic_section_addr;
|
||||
uint32 num_phys_mem_ranges;
|
||||
|
||||
addr_range phys_mem_range[MAX_PHYS_MEM_ADDR_RANGE];
|
||||
unsigned int num_phys_alloc_ranges;
|
||||
addr_range phys_alloc_range[MAX_PHYS_ALLOC_ADDR_RANGE];
|
||||
unsigned int num_virt_alloc_ranges;
|
||||
addr_range virt_alloc_range[MAX_VIRT_ALLOC_ADDR_RANGE];
|
||||
unsigned int num_cpus;
|
||||
addr_range cpu_kstack[MAX_BOOT_CPUS];
|
||||
addr_range phys_mem_range[MAX_PHYS_MEM_ADDR_RANGE];
|
||||
uint32 num_phys_alloc_ranges;
|
||||
addr_range phys_alloc_range[MAX_PHYS_ALLOC_ADDR_RANGE];
|
||||
uint32 num_virt_alloc_ranges;
|
||||
addr_range virt_alloc_range[MAX_VIRT_ALLOC_ADDR_RANGE];
|
||||
uint32 num_cpus;
|
||||
addr_range cpu_kstack[MAX_BOOT_CPUS];
|
||||
|
||||
arch_kernel_args arch_args;
|
||||
|
||||
struct framebuffer {
|
||||
int enabled;
|
||||
int x_size;
|
||||
int y_size;
|
||||
int bit_depth;
|
||||
int already_mapped;
|
||||
addr_range mapping;
|
||||
int enabled;
|
||||
int x_size;
|
||||
int y_size;
|
||||
int bit_depth;
|
||||
int already_mapped;
|
||||
addr_range mapping;
|
||||
} fb;
|
||||
|
||||
} kernel_args;
|
||||
|
||||
#endif /* _KERNEL_STAGE2_H */
|
||||
|
@ -5,6 +5,8 @@
|
||||
#ifndef _NEWOS_BOOT_STAGE2_STRUCT_H
|
||||
#define _NEWOS_BOOT_STAGE2_STRUCT_H
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
// must match SMP_MAX_CPUS in arch_smp.h
|
||||
#define MAX_BOOT_CPUS 4
|
||||
#define MAX_PHYS_MEM_ADDR_RANGE 4
|
||||
@ -12,8 +14,8 @@
|
||||
#define MAX_PHYS_ALLOC_ADDR_RANGE 4
|
||||
|
||||
typedef struct ar {
|
||||
unsigned long start;
|
||||
unsigned long size;
|
||||
uint32 start;
|
||||
uint32 size;
|
||||
} addr_range;
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user