diff --git a/sys/conf/files.mips b/sys/conf/files.mips index 025556b4de65..ded5db8fdf67 100644 --- a/sys/conf/files.mips +++ b/sys/conf/files.mips @@ -45,7 +45,6 @@ mips/mips/vm_machdep.c standard # ---------------------------------------------------------------------- # Phase 4 # ---------------------------------------------------------------------- -mips/mips/tick.c standard # ---------------------------------------------------------------------- # Phase 5 # ---------------------------------------------------------------------- diff --git a/sys/conf/options.mips b/sys/conf/options.mips index d533bfffd02e..409175983126 100644 --- a/sys/conf/options.mips +++ b/sys/conf/options.mips @@ -51,9 +51,11 @@ CFE_ENV_SIZE opt_global.h KERNPHYSADDR opt_global.h KERNVIRTADDR opt_global.h PHYSADDR opt_global.h - +PHYS_ADDR_64BIT opt_global.h +NOFPU opt_global.h TARGET_OCTEON opt_global.h TARGET_EMULATOR opt_ddb.h +TARGET_XLR_XLS opt_global.h TICK_USE_YAMON_FREQ opt_global.h TICK_USE_MALTA_RTC opt_global.h diff --git a/sys/mips/adm5120/adm5120_machdep.c b/sys/mips/adm5120/adm5120_machdep.c index ef188d301d68..c30be2fc6ecd 100644 --- a/sys/mips/adm5120/adm5120_machdep.c +++ b/sys/mips/adm5120/adm5120_machdep.c @@ -73,6 +73,12 @@ __FBSDID("$FreeBSD$"); extern int *edata; extern int *end; +void +platform_cpu_init() +{ + /* Nothing special */ +} + static void mips_init(void) { diff --git a/sys/mips/adm5120/files.adm5120 b/sys/mips/adm5120/files.adm5120 index 0645f406a25b..c8b60ce88b5f 100644 --- a/sys/mips/adm5120/files.adm5120 +++ b/sys/mips/adm5120/files.adm5120 @@ -10,3 +10,4 @@ mips/adm5120/uart_bus_adm5120.c optional uart mips/adm5120/uart_cpu_adm5120.c optional uart mips/adm5120/uart_dev_adm5120.c optional uart mips/mips/intr_machdep.c standard +mips/mips/tick.c standard diff --git a/sys/mips/alchemy/alchemy_machdep.c b/sys/mips/alchemy/alchemy_machdep.c index eca9b18ae0da..2f4f1f6ca3d7 100644 --- a/sys/mips/alchemy/alchemy_machdep.c +++ b/sys/mips/alchemy/alchemy_machdep.c @@ -73,6 +73,12 @@ __FBSDID("$FreeBSD$"); extern int *edata; extern int *end; +void +platform_cpu_init() +{ + /* Nothing special */ +} + static void mips_init(void) { diff --git a/sys/mips/alchemy/files.alchemy b/sys/mips/alchemy/files.alchemy index 2e0f0e748535..240869cdcbb4 100644 --- a/sys/mips/alchemy/files.alchemy +++ b/sys/mips/alchemy/files.alchemy @@ -6,3 +6,4 @@ mips/alchemy/obio.c standard mips/alchemy/uart_bus_alchemy.c optional uart mips/alchemy/uart_cpu_alchemy.c optional uart mips/mips/intr_machdep.c standard +mips/mips/tick.c standard diff --git a/sys/mips/atheros/ar71xx_machdep.c b/sys/mips/atheros/ar71xx_machdep.c index a4139c30af11..0791e687bbe2 100644 --- a/sys/mips/atheros/ar71xx_machdep.c +++ b/sys/mips/atheros/ar71xx_machdep.c @@ -97,6 +97,12 @@ parse_argv(char *str) } } +void +platform_cpu_init() +{ + /* Nothing special */ +} + void platform_halt(void) { diff --git a/sys/mips/atheros/files.ar71xx b/sys/mips/atheros/files.ar71xx index ccad05751ea4..29add2e06f02 100644 --- a/sys/mips/atheros/files.ar71xx +++ b/sys/mips/atheros/files.ar71xx @@ -13,3 +13,4 @@ mips/atheros/uart_bus_ar71xx.c optional uart mips/atheros/uart_cpu_ar71xx.c optional uart mips/atheros/ar71xx_bus_space_reversed.c standard mips/mips/intr_machdep.c standard +mips/mips/tick.c standard diff --git a/sys/mips/idt/files.idt b/sys/mips/idt/files.idt index b8920a7d30cf..09b9959c1226 100644 --- a/sys/mips/idt/files.idt +++ b/sys/mips/idt/files.idt @@ -7,3 +7,4 @@ mips/idt/obio.c standard mips/idt/uart_cpu_rc32434.c optional uart mips/idt/uart_bus_rc32434.c optional uart mips/mips/intr_machdep.c standard +mips/mips/tick.c standard diff --git a/sys/mips/idt/idt_machdep.c b/sys/mips/idt/idt_machdep.c index 040c3f90a042..776bc502d422 100644 --- a/sys/mips/idt/idt_machdep.c +++ b/sys/mips/idt/idt_machdep.c @@ -75,6 +75,12 @@ __FBSDID("$FreeBSD$"); extern int *edata; extern int *end; +void +platform_cpu_init() +{ + /* Nothing special */ +} + void platform_halt(void) { diff --git a/sys/mips/include/fls64.h b/sys/mips/include/fls64.h new file mode 100644 index 000000000000..e49c087c995d --- /dev/null +++ b/sys/mips/include/fls64.h @@ -0,0 +1,47 @@ +/*- + * Copyright (c) 2003-2009 RMI Corporation + * 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. + * 3. Neither the name of RMI Corporation, nor the names of its contributors, + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * 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. + * + * RMI_BSD */ +#ifndef _MIPS_FLS64_H_ +#define _MIPS_FLS64_H_ + +/* + * Find Last Set bit (64 bit) + */ +static inline int +fls64(__uint64_t mask) +{ + int bit; + + if (mask == 0) + return (0); + for (bit = 1; ((mask & 0x1ULL) == 0); bit++) + mask = mask >> 1; + return (bit); +} +#endif diff --git a/sys/mips/include/hwfunc.h b/sys/mips/include/hwfunc.h index ef5088cb8d8a..16b1439a81dd 100644 --- a/sys/mips/include/hwfunc.h +++ b/sys/mips/include/hwfunc.h @@ -29,7 +29,7 @@ #define _MACHINE_HWFUNC_H_ struct trapframe; - +struct timecounter; /* * Hooks downward into hardware functionality. */ @@ -39,4 +39,12 @@ void platform_intr(struct trapframe *); void platform_reset(void); void platform_start(__register_t, __register_t, __register_t, __register_t); +/* For clocks and ticks and such */ +void platform_initclocks(void); +uint64_t platform_get_frequency(void); +unsigned platform_get_timecount(struct timecounter *); + +/* For hardware specific CPU initialization */ +void platform_cpu_init(void); +void platform_secondary_init(void); #endif /* !_MACHINE_HWFUNC_H_ */ diff --git a/sys/mips/include/intr_machdep.h b/sys/mips/include/intr_machdep.h index 1e3e075b1893..79cdf9e041c7 100644 --- a/sys/mips/include/intr_machdep.h +++ b/sys/mips/include/intr_machdep.h @@ -52,9 +52,9 @@ extern struct mips_intrhand mips_intr_handlers[]; struct trapframe; -void cpu_establish_hardintr(const char *, int (*)(void*), void (*)(void*), +void cpu_establish_hardintr(const char *, driver_filter_t *, driver_intr_t *, void *, int, int, void **); -void cpu_establish_softintr(const char *, int (*)(void*), void (*)(void*), +void cpu_establish_softintr(const char *, driver_filter_t *, void (*)(void*), void *, int, int, void **); void cpu_intr(struct trapframe *); diff --git a/sys/mips/include/kdb.h b/sys/mips/include/kdb.h index 7be4ecb5ef36..cd8c61858556 100644 --- a/sys/mips/include/kdb.h +++ b/sys/mips/include/kdb.h @@ -47,4 +47,8 @@ kdb_cpu_trap(int vector, int _) { } +static __inline void +kdb_cpu_sync_icache(unsigned char *addr, size_t size) +{ +} #endif /* _MACHINE_KDB_H_ */ diff --git a/sys/mips/malta/files.malta b/sys/mips/malta/files.malta index fe805461cdd6..82d9ca49b982 100644 --- a/sys/mips/malta/files.malta +++ b/sys/mips/malta/files.malta @@ -8,3 +8,4 @@ dev/uart/uart_dev_ns8250.c optional uart mips/malta/malta_machdep.c standard mips/malta/yamon.c standard mips/mips/intr_machdep.c standard +mips/mips/tick.c standard diff --git a/sys/mips/malta/malta_machdep.c b/sys/mips/malta/malta_machdep.c index 0f53f13fb473..d67f2492fb72 100644 --- a/sys/mips/malta/malta_machdep.c +++ b/sys/mips/malta/malta_machdep.c @@ -97,6 +97,12 @@ static int malta_lcd_offs[] = { MALTA_ASCIIPOS7 }; +void +platform_cpu_init() +{ + /* Nothing special */ +} + /* * Put character to Malta LCD at given position. */ diff --git a/sys/mips/mips/cpu.c b/sys/mips/mips/cpu.c index 177ec4854ba0..0f3d8ad43f47 100644 --- a/sys/mips/mips/cpu.c +++ b/sys/mips/mips/cpu.c @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include static struct mips_cpuinfo cpuinfo; @@ -129,6 +130,7 @@ mips_get_identity(struct mips_cpuinfo *cpuinfo) void mips_cpu_init(void) { + platform_cpu_init(); mips_get_identity(&cpuinfo); num_tlbentries = cpuinfo.tlb_nentries; Mips_SetWIRED(0); diff --git a/sys/mips/mips/machdep.c b/sys/mips/mips/machdep.c index a746b24c812b..b06898dbbcdb 100644 --- a/sys/mips/mips/machdep.c +++ b/sys/mips/mips/machdep.c @@ -112,8 +112,8 @@ int clocks_running = 0; vm_offset_t kstack0; #ifdef SMP -struct pcpu __pcpu[32]; -char pcpu_boot_stack[KSTACK_PAGES * PAGE_SIZE * (MAXCPU-1)]; +struct pcpu __pcpu[MAXCPU]; +char pcpu_boot_stack[KSTACK_PAGES * PAGE_SIZE * MAXCPU]; #else struct pcpu pcpu; struct pcpu *pcpup = &pcpu; @@ -288,6 +288,12 @@ mips_proc0_init(void) PCPU_SET(curpcb, thread0.td_pcb); } +void +cpu_initclocks(void) +{ + platform_initclocks(); +} + struct msgbuf *msgbufp=0; /* diff --git a/sys/mips/mips/tick.c b/sys/mips/mips/tick.c index 42f34a7e9bad..c91b1abf68db 100644 --- a/sys/mips/mips/tick.c +++ b/sys/mips/mips/tick.c @@ -59,6 +59,8 @@ u_int32_t counter_upper = 0; u_int32_t counter_lower_last = 0; int tick_started = 0; +void platform_initclocks(void); + struct clk_ticks { u_long hard_ticks; @@ -97,9 +99,8 @@ mips_timer_early_init(uint64_t clock_hz) } void -cpu_initclocks(void) +platform_initclocks(void) { - if (!tick_started) { tc_init(&counter_timecounter); tick_started++; diff --git a/sys/mips/octeon1/files.octeon1 b/sys/mips/octeon1/files.octeon1 index 8415a47563ce..190d3b8c2097 100644 --- a/sys/mips/octeon1/files.octeon1 +++ b/sys/mips/octeon1/files.octeon1 @@ -14,3 +14,4 @@ mips/octeon1/uart_bus_octeonusart.c optional uart mips/octeon1/uart_cpu_octeonusart.c optional uart mips/octeon1/uart_dev_oct16550.c optional uart mips/mips/intr_machdep.c standard +mips/mips/tick.c standard diff --git a/sys/mips/octeon1/octeon_machdep.c b/sys/mips/octeon1/octeon_machdep.c index e3e9e838463b..140187407a9f 100644 --- a/sys/mips/octeon1/octeon_machdep.c +++ b/sys/mips/octeon1/octeon_machdep.c @@ -80,6 +80,11 @@ __FBSDID("$FreeBSD$"); extern int *edata; extern int *end; +void +platform_cpu_init() +{ + /* Nothing special yet */ +} /* * Perform a board-level soft-reset. diff --git a/sys/mips/sentry5/files.sentry5 b/sys/mips/sentry5/files.sentry5 index 07043d557fd8..73907f4219d8 100644 --- a/sys/mips/sentry5/files.sentry5 +++ b/sys/mips/sentry5/files.sentry5 @@ -6,3 +6,4 @@ # which just need to be tweaked for attachment to an SSB system bus. mips/sentry5/s5_machdep.c standard mips/mips/intr_machdep.c standard +mips/mips/tick.c standard diff --git a/sys/mips/sentry5/s5_machdep.c b/sys/mips/sentry5/s5_machdep.c index 0923402d6792..d326f73ee3ea 100644 --- a/sys/mips/sentry5/s5_machdep.c +++ b/sys/mips/sentry5/s5_machdep.c @@ -87,6 +87,12 @@ extern uint32_t cfe_vector; extern int *edata; extern int *end; +void +platform_cpu_init() +{ + /* Nothing special */ +} + static void mips_init(void) { diff --git a/sys/mips/sibyte/files.sibyte b/sys/mips/sibyte/files.sibyte index 677796c1c78b..4c5c9c030830 100644 --- a/sys/mips/sibyte/files.sibyte +++ b/sys/mips/sibyte/files.sibyte @@ -7,3 +7,4 @@ mips/sibyte/sb_scd.c standard mips/sibyte/ata_zbbus.c standard mips/mips/intr_machdep.c standard mips/sibyte/sb_asm.S standard +mips/mips/tick.c standard diff --git a/sys/mips/sibyte/sb_machdep.c b/sys/mips/sibyte/sb_machdep.c index 79a1b8975cc8..d6bee7692a8c 100644 --- a/sys/mips/sibyte/sb_machdep.c +++ b/sys/mips/sibyte/sb_machdep.c @@ -98,6 +98,12 @@ extern void cfe_env_init(void); extern int *edata; extern int *end; +void +platform_cpu_init() +{ + /* Nothing special */ +} + static void mips_init(void) {