Start of merge from work on the AMD760MP platform.
This is the safe part just additions to files, and comment changes
This commit is contained in:
parent
ad44ad6bc8
commit
228148aa23
63 changed files with 6591 additions and 3 deletions
17
src/include/cpu/cpufixup.h
Normal file
17
src/include/cpu/cpufixup.h
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#ifndef CPU_CPUFIXUP_H
|
||||
#define CPU_CPUFIXUP_H
|
||||
|
||||
#include <cpu/k7/cpufixup.h>
|
||||
#include <cpu/p6/cpufixup.h>
|
||||
|
||||
#ifdef CPU_FIXUP
|
||||
# if defined(k7)
|
||||
# define cpufixup(totalram) k7_cpufixup(totalram)
|
||||
# elif defined(i686)
|
||||
# define cpufixup(totalram) p6_cpufixup(totalram)
|
||||
# endif
|
||||
#else
|
||||
# define cpu_fixup(totalram) do {} while(0)
|
||||
#endif
|
||||
|
||||
#endif /* CPU_CPUFIXUP_H */
|
||||
6
src/include/cpu/k7/cpufixup.h
Normal file
6
src/include/cpu/k7/cpufixup.h
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#ifndef CPU_K7_CPUFIXUP_H
|
||||
#define CPU_K7_CPUFIXUP_H
|
||||
|
||||
void k7_cpufixup(unsigned long totalram);
|
||||
|
||||
#endif /* CPU_K7_CPUFIXUP_H */
|
||||
9
src/include/cpu/k7/mtrr.h
Normal file
9
src/include/cpu/k7/mtrr.h
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#ifndef CPU_K7_MTRR_H
|
||||
#define CPU_K7_MTRR_H
|
||||
|
||||
#include <cpu/p6/mtrr.h>
|
||||
|
||||
# if USE_AMD_NDA_CODE
|
||||
# endif /* USE_AMD_NDA_CODE */
|
||||
|
||||
#endif /* CPU_K7_MTRR_H */
|
||||
14
src/include/cpu/l2_cache.h
Normal file
14
src/include/cpu/l2_cache.h
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#ifndef CPU_L2_CACHE_H
|
||||
#define CPU_L2_CACHE_H
|
||||
|
||||
#include <cpu/p6/l2_cache.h>
|
||||
|
||||
#ifdef CONFIGURE_L2_CACHE
|
||||
# if defined(i686)
|
||||
# define configure_l2_cache() p6_configure_l2_cache()
|
||||
# endif
|
||||
#else
|
||||
# define configure_l2_cache() do {} while(0)
|
||||
#endif
|
||||
|
||||
#endif /* CPU_L2_CACHE_H */
|
||||
176
src/include/cpu/p6/apic.h
Normal file
176
src/include/cpu/p6/apic.h
Normal file
|
|
@ -0,0 +1,176 @@
|
|||
#ifndef APIC_H
|
||||
#define APIC_H
|
||||
|
||||
#define APIC_BASE_MSR 0x1B
|
||||
#define APIC_BASE_MSR_BOOTSTRAP_PROCESSOR (1 << 8)
|
||||
#define APIC_BASE_MSR_ENABLE (1 << 11)
|
||||
#define APIC_BASE_MSR_ADDR_MASK 0xFFFFF000
|
||||
|
||||
#define APIC_DEFAULT_BASE 0xfee00000
|
||||
|
||||
#define APIC_ID 0x020
|
||||
#define APIC_LVR 0x030
|
||||
#define APIC_ARBID 0x090
|
||||
#define APIC_RRR 0x0C0
|
||||
#define APIC_SVR 0x0f0
|
||||
#define APIC_SPIV 0x0f0
|
||||
#define APIC_SPIV_ENABLE 0x100
|
||||
#define APIC_ESR 0x280
|
||||
#define APIC_ESR_SEND_CS 0x00001
|
||||
#define APIC_ESR_RECV_CS 0x00002
|
||||
#define APIC_ESR_SEND_ACC 0x00004
|
||||
#define APIC_ESR_RECV_ACC 0x00008
|
||||
#define APIC_ESR_SENDILL 0x00020
|
||||
#define APIC_ESR_RECVILL 0x00040
|
||||
#define APIC_ESR_ILLREGA 0x00080
|
||||
#define APIC_ICR 0x300
|
||||
#define APIC_DEST_SELF 0x40000
|
||||
#define APIC_DEST_ALLINC 0x80000
|
||||
#define APIC_DEST_ALLBUT 0xC0000
|
||||
#define APIC_ICR_RR_MASK 0x30000
|
||||
#define APIC_ICR_RR_INVALID 0x00000
|
||||
#define APIC_ICR_RR_INPROG 0x10000
|
||||
#define APIC_ICR_RR_VALID 0x20000
|
||||
#define APIC_INT_LEVELTRIG 0x08000
|
||||
#define APIC_INT_ASSERT 0x04000
|
||||
#define APIC_ICR_BUSY 0x01000
|
||||
#define APIC_DEST_LOGICAL 0x00800
|
||||
#define APIC_DM_FIXED 0x00000
|
||||
#define APIC_DM_LOWEST 0x00100
|
||||
#define APIC_DM_SMI 0x00200
|
||||
#define APIC_DM_REMRD 0x00300
|
||||
#define APIC_DM_NMI 0x00400
|
||||
#define APIC_DM_INIT 0x00500
|
||||
#define APIC_DM_STARTUP 0x00600
|
||||
#define APIC_DM_EXTINT 0x00700
|
||||
#define APIC_VECTOR_MASK 0x000FF
|
||||
#define APIC_ICR2 0x310
|
||||
#define GET_APIC_DEST_FIELD(x) (((x)>>24)&0xFF)
|
||||
#define SET_APIC_DEST_FIELD(x) ((x)<<24)
|
||||
#define APIC_LVTT 0x320
|
||||
#define APIC_LVTPC 0x340
|
||||
#define APIC_LVT0 0x350
|
||||
#define APIC_LVT_TIMER_BASE_MASK (0x3<<18)
|
||||
#define GET_APIC_TIMER_BASE(x) (((x)>>18)&0x3)
|
||||
#define SET_APIC_TIMER_BASE(x) (((x)<<18))
|
||||
#define APIC_TIMER_BASE_CLKIN 0x0
|
||||
#define APIC_TIMER_BASE_TMBASE 0x1
|
||||
#define APIC_TIMER_BASE_DIV 0x2
|
||||
#define APIC_LVT_TIMER_PERIODIC (1<<17)
|
||||
#define APIC_LVT_MASKED (1<<16)
|
||||
#define APIC_LVT_LEVEL_TRIGGER (1<<15)
|
||||
#define APIC_LVT_REMOTE_IRR (1<<14)
|
||||
#define APIC_INPUT_POLARITY (1<<13)
|
||||
#define APIC_SEND_PENDING (1<<12)
|
||||
#define APIC_LVT_RESERVED_1 (1<<11)
|
||||
#define APIC_DELIVERY_MODE_MASK (7<<8)
|
||||
#define APIC_DELIVERY_MODE_FIXED (0<<8)
|
||||
#define APIC_DELIVERY_MODE_NMI (4<<8)
|
||||
#define APIC_DELIVERY_MODE_EXTINT (7<<8)
|
||||
#define GET_APIC_DELIVERY_MODE(x) (((x)>>8)&0x7)
|
||||
#define SET_APIC_DELIVERY_MODE(x,y) (((x)&~0x700)|((y)<<8))
|
||||
#define APIC_MODE_FIXED 0x0
|
||||
#define APIC_MODE_NMI 0x4
|
||||
#define APIC_MODE_EXINT 0x7
|
||||
#define APIC_LVT1 0x360
|
||||
#define APIC_LVTERR 0x370
|
||||
|
||||
|
||||
#if !defined(ASSEMBLY)
|
||||
|
||||
#include <printk.h>
|
||||
|
||||
|
||||
#define xchg(ptr,v) ((__typeof__(*(ptr)))__xchg((unsigned long)(v),(ptr),sizeof(*(ptr))))
|
||||
|
||||
struct __xchg_dummy { unsigned long a[100]; };
|
||||
#define __xg(x) ((struct __xchg_dummy *)(x))
|
||||
|
||||
/*
|
||||
* Note: no "lock" prefix even on SMP: xchg always implies lock anyway
|
||||
* Note 2: xchg has side effect, so that attribute volatile is necessary,
|
||||
* but generally the primitive is invalid, *ptr is output argument. --ANK
|
||||
*/
|
||||
static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size)
|
||||
{
|
||||
switch (size) {
|
||||
case 1:
|
||||
__asm__ __volatile__("xchgb %b0,%1"
|
||||
:"=q" (x)
|
||||
:"m" (*__xg(ptr)), "0" (x)
|
||||
:"memory");
|
||||
break;
|
||||
case 2:
|
||||
__asm__ __volatile__("xchgw %w0,%1"
|
||||
:"=r" (x)
|
||||
:"m" (*__xg(ptr)), "0" (x)
|
||||
:"memory");
|
||||
break;
|
||||
case 4:
|
||||
__asm__ __volatile__("xchgl %0,%1"
|
||||
:"=r" (x)
|
||||
:"m" (*__xg(ptr)), "0" (x)
|
||||
:"memory");
|
||||
break;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
static inline unsigned long apic_read(unsigned long reg)
|
||||
{
|
||||
return *((volatile unsigned long *)(APIC_DEFAULT_BASE+reg));
|
||||
}
|
||||
|
||||
extern inline void apic_write_atomic(unsigned long reg, unsigned long v)
|
||||
{
|
||||
xchg((volatile unsigned long *)(APIC_DEFAULT_BASE+reg), v);
|
||||
}
|
||||
|
||||
static inline void apic_write(unsigned long reg, unsigned long v)
|
||||
{
|
||||
*((volatile unsigned long *)(APIC_DEFAULT_BASE+reg)) = v;
|
||||
}
|
||||
|
||||
static inline void apic_wait_icr_idle(void)
|
||||
{
|
||||
do { } while ( apic_read( APIC_ICR ) & APIC_ICR_BUSY );
|
||||
}
|
||||
|
||||
#ifdef CONFIG_X86_GOOD_APIC
|
||||
# define FORCE_READ_AROUND_WRITE 0
|
||||
# define apic_read_around(x)
|
||||
# define apic_write_around(x,y) apic_write((x),(y))
|
||||
#else
|
||||
# define FORCE_READ_AROUND_WRITE 1
|
||||
# define apic_read_around(x) apic_read(x)
|
||||
# define apic_write_around(x,y) apic_write_atomic((x),(y))
|
||||
#endif
|
||||
|
||||
static inline unsigned long apic_remote_read(int apicid, int reg)
|
||||
{
|
||||
int timeout;
|
||||
unsigned long status, result;
|
||||
apic_wait_icr_idle();
|
||||
apic_write_around(APIC_ICR2, SET_APIC_DEST_FIELD(apicid));
|
||||
apic_write_around(APIC_ICR, APIC_DM_REMRD | (reg >> 4));
|
||||
timeout = 0;
|
||||
do {
|
||||
#if 0
|
||||
udelay(100);
|
||||
#endif
|
||||
status = apic_read(APIC_ICR) & APIC_ICR_RR_MASK;
|
||||
} while (status == APIC_ICR_RR_INPROG && timeout++ < 1000);
|
||||
|
||||
result = -1;
|
||||
if (status == APIC_ICR_RR_VALID) {
|
||||
result = apic_read(APIC_RRR);
|
||||
}
|
||||
else {
|
||||
printk_err("remote apic read failed\n");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif /* ASSEMBLY */
|
||||
|
||||
#endif /* APIC_H */
|
||||
10
src/include/cpu/p6/cpufixup.h
Normal file
10
src/include/cpu/p6/cpufixup.h
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#ifndef CPU_P6_CPUFIXUP_H
|
||||
#define CPU_P6_CPUFIXUP_H
|
||||
|
||||
#ifdef UPDATE_MICROCODE
|
||||
#define CPU_FIXUP
|
||||
#endif
|
||||
|
||||
void p6_cpufixup(unsigned long totalram);
|
||||
|
||||
#endif /* CPU_P6_CPUFIXUP_H */
|
||||
7
src/include/delay.h
Normal file
7
src/include/delay.h
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#ifndef DELAY_H
|
||||
#define DELAY_H
|
||||
|
||||
void udelay(int usecs);
|
||||
void mdelay(int msecs);
|
||||
|
||||
#endif /* DELAY_H */
|
||||
10
src/include/part/floppy.h
Normal file
10
src/include/part/floppy.h
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#ifndef PART_FLOPPY_H
|
||||
#define PART_FLOPPY_H
|
||||
|
||||
#ifdef MUST_ENABLE_FLOPPY
|
||||
void enable_floppy(void);
|
||||
#else
|
||||
# define enable_floppy() do {} while(0)
|
||||
#endif
|
||||
|
||||
#endif /* PART_FLOPPY_H */
|
||||
10
src/include/part/framebuffer.h
Normal file
10
src/include/part/framebuffer.h
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#ifndef PART_FRAMEBUFFER_H
|
||||
#define PART_FRAMEBUFFER_H
|
||||
|
||||
#ifdef HAVE_FRAMEBUFFER
|
||||
void framebuffer_on(void)
|
||||
#else
|
||||
# define framebuffer_on() do {} while(0)
|
||||
#endif /* HAVE_FRAMEBUFFER */
|
||||
|
||||
#endif /* PART_FRAMEBUFFER_H */
|
||||
11
src/include/part/hard_reset.h
Normal file
11
src/include/part/hard_reset.h
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#ifndef PART_HARD_RESET_H
|
||||
#define PART_HARD_RESET_H
|
||||
|
||||
#ifdef HAVE_HARD_RESET
|
||||
void hard_reset(void);
|
||||
#else
|
||||
#define hard_reset() do {} while(0)
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
10
src/include/part/keyboard.h
Normal file
10
src/include/part/keyboard.h
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#ifndef PART_KEYBOARD_H
|
||||
#define KEYBOARD_H
|
||||
|
||||
#ifndef NO_KEYBOARD
|
||||
void keyboard_on(void);
|
||||
#else
|
||||
# define keyboard_on() do {} while(0)
|
||||
#endif
|
||||
|
||||
#endif /* PART_KEYBOARD_H */
|
||||
12
src/include/part/mainboard.h
Normal file
12
src/include/part/mainboard.h
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef PART_MAINBOARD_H
|
||||
#define PART_MAINBOARD_H
|
||||
|
||||
void mainboard_fixup(void);
|
||||
|
||||
#ifdef FINAL_MAINBOARD_FIXUP
|
||||
void final_mainboard_fixup(void);
|
||||
#else
|
||||
# define final_mainboard_fixup() do {} while(0)
|
||||
#endif /* FINAL_MAINBOARD_FIXUP */
|
||||
|
||||
#endif /* PART_MAINBOARD_H */
|
||||
7
src/include/part/nvram.h
Normal file
7
src/include/part/nvram.h
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#ifndef PART_NVRAM_H
|
||||
#define PART_NVRAM_H
|
||||
|
||||
/* Turn on full access to the flash chip */
|
||||
void nvram_on(void);
|
||||
|
||||
#endif /* PART_NVRAM_H */
|
||||
6
src/include/part/sizeram.h
Normal file
6
src/include/part/sizeram.h
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#ifndef PART_SIZERAM_H
|
||||
#define PART_SIZERAM_H
|
||||
|
||||
unsigned long sizeram(void);
|
||||
|
||||
#endif /* PART_SIZERAM_H */
|
||||
11
src/include/pc80/i8259.h
Normal file
11
src/include/pc80/i8259.h
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#ifndef PC80_I8259
|
||||
#define PC80_I8259
|
||||
|
||||
|
||||
#ifdef I8259
|
||||
void setup_i8259(void);
|
||||
#else
|
||||
#define setup_i8259() do {} while(0)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -1 +1,6 @@
|
|||
#ifndef PC80_KEYBOARD_H
|
||||
#define PC80_KEYBOARD_H
|
||||
|
||||
void pc_keyboard_init(void);
|
||||
|
||||
#endif /* PC80_KEYBOARD_H */
|
||||
|
|
|
|||
53
src/include/smp/atomic.h
Normal file
53
src/include/smp/atomic.h
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
#ifndef SMP_ATOMIC_H
|
||||
#define SMP_ATOMIC_H
|
||||
|
||||
#ifdef SMP
|
||||
#include <arch/smp/atomic.h>
|
||||
#else
|
||||
|
||||
typedef struct { int counter } atomic_t;
|
||||
#define ATOMIC_INIT(i) { (i) }
|
||||
|
||||
/**
|
||||
* atomic_read - read atomic variable
|
||||
* @v: pointer of type atomic_t
|
||||
*
|
||||
* Atomically reads the value of @v. Note that the guaranteed
|
||||
* useful range of an atomic_t is only 24 bits.
|
||||
*/
|
||||
#define atomic_read(v) ((v)->counter)
|
||||
|
||||
/**
|
||||
* atomic_set - set atomic variable
|
||||
* @v: pointer of type atomic_t
|
||||
* @i: required value
|
||||
*
|
||||
* Atomically sets the value of @v to @i. Note that the guaranteed
|
||||
* useful range of an atomic_t is only 24 bits.
|
||||
*/
|
||||
#define atomic_set(v,i) (((v)->counter) = (i))
|
||||
|
||||
|
||||
/**
|
||||
* atomic_inc - increment atomic variable
|
||||
* @v: pointer of type atomic_t
|
||||
*
|
||||
* Atomically increments @v by 1. Note that the guaranteed
|
||||
* useful range of an atomic_t is only 24 bits.
|
||||
*/
|
||||
#define atomic_inc(v) (((v)->counter)++)
|
||||
|
||||
|
||||
/**
|
||||
* atomic_dec - decrement atomic variable
|
||||
* @v: pointer of type atomic_t
|
||||
*
|
||||
* Atomically decrements @v by 1. Note that the guaranteed
|
||||
* useful range of an atomic_t is only 24 bits.
|
||||
*/
|
||||
#define atomic_inc(v) (((v)->counter)--)
|
||||
|
||||
|
||||
#endif /* SMP */
|
||||
|
||||
#endif /* SMP_ATOMIC_H */
|
||||
24
src/include/smp/spinlock.h
Normal file
24
src/include/smp/spinlock.h
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#ifndef SMP_SPINLOCK_H
|
||||
#define SMP_SPINLOCK_H
|
||||
|
||||
#ifdef SMP
|
||||
#include <arch/smp/spinlock.h>
|
||||
#else /* !SMP */
|
||||
|
||||
/* Most GCC versions have a nasty bug with empty initializers */
|
||||
#if (__GNUC__ > 2)
|
||||
typedef struct { } spinlock_t;
|
||||
#define SPIN_LOCK_UNLOCKED (spinlock_t) { }
|
||||
#else
|
||||
typedef struct { int gcc_is_buggy; } spinlock_t;
|
||||
#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
|
||||
#endif
|
||||
|
||||
#define barrier() do {} while(0)
|
||||
#define spin_is_locked(lock) 0
|
||||
#define spin_unlock_wait(lock) do {} while(0)
|
||||
#define spin_lock(lock) do {} while(0)
|
||||
#define spin_unlock(lock) do {} while(0)
|
||||
#endif
|
||||
|
||||
#endif /* SMP_SPINLOCK_H */
|
||||
15
src/include/smp/start_stop.h
Normal file
15
src/include/smp/start_stop.h
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef SMP_START_STOP_H
|
||||
#define SMP_START_STOP_H
|
||||
|
||||
#ifdef SMP
|
||||
#include <smp/atomic.h>
|
||||
int this_processors_id(void);
|
||||
void stop_cpu(int processor_id);
|
||||
void start_cpu(int processor_id);
|
||||
void startup_other_cpus(void);
|
||||
#else
|
||||
#define this_processors_id() 0
|
||||
#define startup_other_cpus() do {} while(0)
|
||||
#endif
|
||||
|
||||
#endif /* SMP_START_STOP_H */
|
||||
Loading…
Add table
Add a link
Reference in a new issue