hwfunc.h revision 208249
1178172Simp/*- 2178172Simp * Copyright (c) 2003-2004 Juli Mallett. All rights reserved. 3178172Simp * 4178172Simp * Redistribution and use in source and binary forms, with or without 5178172Simp * modification, are permitted provided that the following conditions 6178172Simp * are met: 7178172Simp * 1. Redistributions of source code must retain the above copyright 8178172Simp * notice, this list of conditions and the following disclaimer. 9178172Simp * 2. Redistributions in binary form must reproduce the above copyright 10178172Simp * notice, this list of conditions and the following disclaimer in the 11178172Simp * documentation and/or other materials provided with the distribution. 12178172Simp * 13178172Simp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14178172Simp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15178172Simp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16178172Simp * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17178172Simp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18178172Simp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19178172Simp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20178172Simp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21178172Simp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22178172Simp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23178172Simp * SUCH DAMAGE. 24178172Simp * 25178172Simp * $FreeBSD: head/sys/mips/include/hwfunc.h 208249 2010-05-18 04:02:34Z rrs $ 26178172Simp */ 27178172Simp 28178172Simp#ifndef _MACHINE_HWFUNC_H_ 29178172Simp#define _MACHINE_HWFUNC_H_ 30178172Simp 31178172Simpstruct trapframe; 32202031Simpstruct timecounter; 33178172Simp/* 34178172Simp * Hooks downward into hardware functionality. 35178172Simp */ 36178172Simp 37178172Simpvoid platform_halt(void); 38178172Simpvoid platform_intr(struct trapframe *); 39178172Simpvoid platform_reset(void); 40178172Simpvoid platform_start(__register_t, __register_t, __register_t, __register_t); 41178172Simp 42202031Simp/* For clocks and ticks and such */ 43202031Simpvoid platform_initclocks(void); 44202031Simpuint64_t platform_get_frequency(void); 45202031Simpunsigned platform_get_timecount(struct timecounter *); 46202031Simp 47202031Simp/* For hardware specific CPU initialization */ 48202031Simpvoid platform_cpu_init(void); 49202031Simpvoid platform_secondary_init(void); 50203697Sneel 51203697Sneel#ifdef SMP 52203697Sneel 53203697Sneel/* 54203697Sneel * Spin up the AP so that it starts executing MP bootstrap entry point: mpentry 55203697Sneel * 56203697Sneel * Returns 0 on sucess and non-zero on failure. 57203697Sneel */ 58203697Sneelint platform_start_ap(int processor_id); 59203697Sneel 60203697Sneel/* 61203697Sneel * Platform-specific initialization that needs to be done when an AP starts 62203697Sneel * running. This function is called from the MP bootstrap code in mpboot.S 63203697Sneel */ 64203697Sneelvoid platform_init_ap(int processor_id); 65203697Sneel 66203697Sneel/* 67203697Sneel * Return a plaform-specific interrrupt number that is used to deliver IPIs. 68203697Sneel * 69203697Sneel * This hardware interrupt is used to deliver IPIs exclusively and must 70203697Sneel * not be used for any other interrupt source. 71203697Sneel */ 72203697Sneelint platform_ipi_intrnum(void); 73203697Sneel 74203697Sneel/* 75203697Sneel * Trigger a IPI interrupt on 'cpuid'. 76203697Sneel */ 77203697Sneelvoid platform_ipi_send(int cpuid); 78203697Sneel 79203697Sneel/* 80203697Sneel * Quiesce the IPI interrupt source on the current cpu. 81203697Sneel */ 82203697Sneelvoid platform_ipi_clear(void); 83203697Sneel 84203697Sneel/* 85203697Sneel * Return the processor id. 86203697Sneel * 87203697Sneel * Note that this function is called in early boot when stack is not available. 88203697Sneel */ 89203697Sneelextern int platform_processor_id(void); 90203697Sneel 91203697Sneel/* 92203697Sneel * Return the number of processors available on this platform. 93203697Sneel */ 94203697Sneelextern int platform_num_processors(void); 95203697Sneel 96208249Srrs/* 97208249Srrs * Return the topology of processors on this platform 98208249Srrs */ 99208249Srrsstruct cpu_group *platform_smp_topo(void); 100208249Srrs 101208249Srrs 102203697Sneel#endif /* SMP */ 103178172Simp#endif /* !_MACHINE_HWFUNC_H_ */ 104