diff options
Diffstat (limited to 'sys/powerpc/include')
| -rw-r--r-- | sys/powerpc/include/cpufunc.h | 38 | ||||
| -rw-r--r-- | sys/powerpc/include/md_var.h | 4 | ||||
| -rw-r--r-- | sys/powerpc/include/mutex.h | 2 | ||||
| -rw-r--r-- | sys/powerpc/include/ofw_machdep.h | 6 | ||||
| -rw-r--r-- | sys/powerpc/include/pcpu.h | 2 | ||||
| -rw-r--r-- | sys/powerpc/include/platform.h (renamed from sys/powerpc/include/powerpc.h) | 33 | ||||
| -rw-r--r-- | sys/powerpc/include/platformvar.h | 88 | ||||
| -rw-r--r-- | sys/powerpc/include/pmap.h | 1 | ||||
| -rw-r--r-- | sys/powerpc/include/smp.h | 5 | ||||
| -rw-r--r-- | sys/powerpc/include/spr.h | 6 |
10 files changed, 151 insertions, 34 deletions
diff --git a/sys/powerpc/include/cpufunc.h b/sys/powerpc/include/cpufunc.h index 66b5df38ad6f..2bf1161a29f9 100644 --- a/sys/powerpc/include/cpufunc.h +++ b/sys/powerpc/include/cpufunc.h @@ -71,7 +71,7 @@ mtmsr(register_t value) static __inline register_t mfmsr(void) { - register_t value; + register_t value; __asm __volatile ("mfmsr %0" : "=r"(value)); @@ -88,7 +88,7 @@ mtsrin(vm_offset_t va, register_t value) static __inline register_t mfsrin(vm_offset_t va) { - register_t value; + register_t value; __asm __volatile ("mfsrin %0,%1" : "=r"(value) : "r"(va)); @@ -105,7 +105,7 @@ mtdec(register_t value) static __inline register_t mfdec(void) { - register_t value; + register_t value; __asm __volatile ("mfdec %0" : "=r"(value)); @@ -115,13 +115,37 @@ mfdec(void) static __inline register_t mfpvr(void) { - register_t value; + register_t value; __asm __volatile ("mfpvr %0" : "=r"(value)); return (value); } +static __inline u_quad_t +mftb(void) +{ + u_quad_t tb; + uint32_t *tbup = (uint32_t *)&tb; + uint32_t *tblp = tbup + 1; + + do { + *tbup = mfspr(TBR_TBU); + *tblp = mfspr(TBR_TBL); + } while (*tbup != mfspr(TBR_TBU)); + + return (tb); +} + +static __inline void +mttb(u_quad_t time) +{ + + mtspr(TBR_TBWL, 0); + mtspr(TBR_TBWU, (uint32_t)(time >> 32)); + mtspr(TBR_TBWL, (uint32_t)(time & 0xffffffff)); +} + static __inline void eieio(void) { @@ -146,7 +170,7 @@ powerpc_sync(void) static __inline register_t intr_disable(void) { - register_t msr; + register_t msr; msr = mfmsr(); mtmsr(msr & ~PSL_EE); @@ -163,11 +187,11 @@ intr_restore(register_t msr) static __inline struct pcpu * powerpc_get_pcpup(void) { - struct pcpu *ret; + struct pcpu *ret; __asm __volatile("mfsprg %0, 0" : "=r"(ret)); - return(ret); + return (ret); } #endif /* _KERNEL */ diff --git a/sys/powerpc/include/md_var.h b/sys/powerpc/include/md_var.h index 709e4a9a0c0e..d1785adfbe0f 100644 --- a/sys/powerpc/include/md_var.h +++ b/sys/powerpc/include/md_var.h @@ -55,13 +55,13 @@ void busdma_swi(void); int is_physical_memory(vm_offset_t addr); int mem_valid(vm_offset_t addr, int len); -void decr_config(unsigned long); void decr_init(void); +void decr_ap_init(void); void decr_tc_init(void); void cpu_setup(u_int); -struct trapframe; +struct trapframe; void powerpc_interrupt(struct trapframe *); #endif /* !_MACHINE_MD_VAR_H_ */ diff --git a/sys/powerpc/include/mutex.h b/sys/powerpc/include/mutex.h index 0b7fe2633e26..b6f80fbddd15 100644 --- a/sys/powerpc/include/mutex.h +++ b/sys/powerpc/include/mutex.h @@ -32,6 +32,7 @@ #ifndef _MACHINE_MUTEX_H_ #define _MACHINE_MUTEX_H_ +#if 0 #ifdef LOCORE /* @@ -62,4 +63,5 @@ #endif /* !LOCORE */ +#endif #endif /* __MACHINE_MUTEX_H */ diff --git a/sys/powerpc/include/ofw_machdep.h b/sys/powerpc/include/ofw_machdep.h index 1dd2027d077f..bf79224795c5 100644 --- a/sys/powerpc/include/ofw_machdep.h +++ b/sys/powerpc/include/ofw_machdep.h @@ -33,6 +33,7 @@ #include <sys/rman.h> #include <sys/bus.h> #include <dev/ofw/openfirm.h> +#include <machine/platform.h> typedef uint32_t cell_t; @@ -42,4 +43,9 @@ void OF_getetheraddr(device_t dev, u_char *addr); void OF_initial_setup(void *fdt_ptr, void *junk, int (*openfirm)(void *)); boolean_t OF_bootstrap(void); +void OF_halt(void); +void OF_reboot(void); + +void ofw_mem_regions(struct mem_region **, int *, struct mem_region **, int *); + #endif /* _MACHINE_OFW_MACHDEP_H_ */ diff --git a/sys/powerpc/include/pcpu.h b/sys/powerpc/include/pcpu.h index a0a3e517d5ed..51422daac70b 100644 --- a/sys/powerpc/include/pcpu.h +++ b/sys/powerpc/include/pcpu.h @@ -31,6 +31,7 @@ #define _MACHINE_PCPU_H_ #include <machine/cpufunc.h> +#include <machine/tlb.h> struct pmap; #define CPUSAVE_LEN 8 @@ -61,6 +62,7 @@ struct pmap; register_t pc_booke_mchksave[CPUSAVE_LEN]; \ register_t pc_booke_tlbsave[BOOKE_TLBSAVE_LEN]; \ register_t pc_booke_tlb_level; \ + uint32_t *pc_booke_tlb_lock; \ int pc_tid_next; /* Definitions for register offsets within the exception tmp save areas */ diff --git a/sys/powerpc/include/powerpc.h b/sys/powerpc/include/platform.h index 3de078899dd3..cfa7a0d0890c 100644 --- a/sys/powerpc/include/powerpc.h +++ b/sys/powerpc/include/platform.h @@ -32,8 +32,11 @@ * $FreeBSD$ */ -#ifndef _MACHINE_POWERPC_H_ -#define _MACHINE_POWERPC_H_ +#ifndef _MACHINE_PLATFORM_H_ +#define _MACHINE_PLATFORM_H_ + +#include <machine/smp.h> +#include <machine/pcpu.h> struct mem_region { vm_offset_t mr_start; @@ -42,18 +45,14 @@ struct mem_region { void mem_regions(struct mem_region **, int *, struct mem_region **, int *); -/* - * These two functions get used solely in boot() in machdep.c. - * - * Not sure whether boot itself should be implementation dependent instead. XXX - */ -void OF_halt(void); -void OF_reboot(void); - -int dk_match(char *name); - -void ofrootfound(void); - -extern int booted_partition; - -#endif /* _MACHINE_POWERPC_H_ */ +u_long platform_timebase_freq(struct cpuref *); + +int platform_smp_first_cpu(struct cpuref *); +int platform_smp_next_cpu(struct cpuref *); +int platform_smp_get_bsp(struct cpuref *); +int platform_smp_start_cpu(struct pcpu *); + +const char *installed_platform(void); +void platform_probe_and_attach(void); + +#endif /* _MACHINE_PLATFORM_H_ */ diff --git a/sys/powerpc/include/platformvar.h b/sys/powerpc/include/platformvar.h new file mode 100644 index 000000000000..b7c011d39850 --- /dev/null +++ b/sys/powerpc/include/platformvar.h @@ -0,0 +1,88 @@ +/*- + * Copyright (c) 2005 Peter Grehan + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _MACHINE_PLATFORMVAR_H_ +#define _MACHINE_PLATFORMVAR_H_ + +/* + * A PowerPC platform implementation is declared with a kernel object and + * an associated method table, similar to a device driver. + * + * e.g. + * + * static platform_method_t chrp_methods[] = { + * PLATFORMMETHOD(platform_probe, chrp_probe), + * PLATFORMMETHOD(platform_mem_regions, ofw_mem_regions), + * ... + * PLATFORMMETHOD(platform_smp_first_cpu, chrp_smp_first_cpu), + * { 0, 0 } + * }; + * + * static platform_def_t chrp_platform = { + * "chrp", + * chrp_methods, + * sizeof(chrp_platform_softc), // or 0 if no softc + * }; + * + * PLATFORM_DEF(chrp_platform); + */ + +#include <sys/kobj.h> + +struct platform_kobj { + /* + * A platform instance is a kernel object + */ + KOBJ_FIELDS; + + /* + * Utility elements that an instance may use + */ + struct mtx platform_mtx; /* available for instance use */ + void *platform_iptr; /* instance data pointer */ + + /* + * Opaque data that can be overlaid with an instance-private + * structure. Platform code can test that this is large enough at + * compile time with a sizeof() test againt it's softc. There + * is also a run-time test when the platform kernel object is + * registered. + */ +#define PLATFORM_OPAQUESZ 64 + u_int platform_opaque[PLATFORM_OPAQUESZ]; +}; + +typedef struct platform_kobj *platform_t; +typedef struct kobj_class platform_def_t; +#define platform_method_t kobj_method_t + +#define PLATFORMMETHOD KOBJMETHOD + +#define PLATFORM_DEF(name) DATA_SET(platform_set, name) + +#endif /* _MACHINE_PLATFORMVAR_H_ */ diff --git a/sys/powerpc/include/pmap.h b/sys/powerpc/include/pmap.h index 5e6d9c649820..42bc4099526e 100644 --- a/sys/powerpc/include/pmap.h +++ b/sys/powerpc/include/pmap.h @@ -143,7 +143,6 @@ struct md_page { TAILQ_HEAD(, pv_entry) pv_list; }; -#define MEM_REGIONS 8 #define pmap_page_is_mapped(m) (!TAILQ_EMPTY(&(m)->md.pv_list)) #endif /* AIM */ diff --git a/sys/powerpc/include/smp.h b/sys/powerpc/include/smp.h index 2b054c5fde53..3929b8c7e7e5 100644 --- a/sys/powerpc/include/smp.h +++ b/sys/powerpc/include/smp.h @@ -46,11 +46,6 @@ struct cpuref { u_int cr_cpuid; }; -int powerpc_smp_first_cpu(struct cpuref *); -int powerpc_smp_get_bsp(struct cpuref *); -int powerpc_smp_next_cpu(struct cpuref *); -int powerpc_smp_start_cpu(struct pcpu *); - void pmap_cpu_bootstrap(int); uint32_t cpudep_ap_bootstrap(void); void machdep_ap_bootstrap(void); diff --git a/sys/powerpc/include/spr.h b/sys/powerpc/include/spr.h index 84fab0dcbcba..870e989bfd42 100644 --- a/sys/powerpc/include/spr.h +++ b/sys/powerpc/include/spr.h @@ -129,8 +129,6 @@ #define SPR_SPRG7 0x117 /* 4.. SPR General 7 */ #define SPR_ASR 0x118 /* ... Address Space Register (PPC64) */ #define SPR_EAR 0x11a /* .68 External Access Register */ -#define SPR_TBL 0x11c /* 468 Time Base Lower */ -#define SPR_TBU 0x11d /* 468 Time Base Upper */ #define SPR_PVR 0x11f /* 468 Processor Version Register */ #define MPC601 0x0001 #define MPC603 0x0003 @@ -419,6 +417,7 @@ #define SPR_DAC2 0x3f7 /* 4.. Data Address Compare 2 */ #define SPR_PIR 0x3ff /* .6. Processor Identification Register */ #elif defined(E500) +#define SPR_PIR 0x11e /* ..8 Processor Identification Register */ #define SPR_DBSR 0x130 /* ..8 Debug Status Register */ #define DBSR_IDE 0x80000000 /* Imprecise debug event. */ #define DBSR_UDE 0x40000000 /* Unconditional debug event. */ @@ -668,6 +667,9 @@ #define L1CSR1_ICFI 0x00000002 /* Instruction Cache Flash Invalidate */ #define L1CSR1_ICE 0x00000001 /* Instruction Cache Enable */ +#define SPR_BUCSR 0x3F5 /* ..8 Branch Unit Control and Status Register */ +#define BUCSR_BPEN 0x00000001 /* Branch Prediction Enable */ + #endif /* #elif defined(E500) */ #endif /* !_POWERPC_SPR_H_ */ |
