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$ 26178172Simp */ 27178172Simp 28178172Simp#ifndef _MACHINE_HWFUNC_H_ 29178172Simp#define _MACHINE_HWFUNC_H_ 30178172Simp 31222813Sattilio#include <sys/_cpuset.h> 32222813Sattilio 33202031Simpstruct timecounter; 34232853Sjmallett 35178172Simp/* 36232853Sjmallett * Hooks downward into platform functionality. 37178172Simp */ 38178172Simpvoid platform_reset(void); 39178172Simpvoid platform_start(__register_t, __register_t, __register_t, __register_t); 40178172Simp 41202031Simp/* For clocks and ticks and such */ 42202031Simpvoid platform_initclocks(void); 43202031Simpuint64_t platform_get_frequency(void); 44202031Simpunsigned platform_get_timecount(struct timecounter *); 45202031Simp 46202031Simp/* For hardware specific CPU initialization */ 47202031Simpvoid platform_cpu_init(void); 48203697Sneel 49203697Sneel#ifdef SMP 50203697Sneel 51203697Sneel/* 52203697Sneel * Spin up the AP so that it starts executing MP bootstrap entry point: mpentry 53203697Sneel * 54203697Sneel * Returns 0 on sucess and non-zero on failure. 55203697Sneel */ 56203697Sneelint platform_start_ap(int processor_id); 57203697Sneel 58203697Sneel/* 59203697Sneel * Platform-specific initialization that needs to be done when an AP starts 60203697Sneel * running. This function is called from the MP bootstrap code in mpboot.S 61203697Sneel */ 62203697Sneelvoid platform_init_ap(int processor_id); 63203697Sneel 64203697Sneel/* 65203697Sneel * Return a plaform-specific interrrupt number that is used to deliver IPIs. 66203697Sneel * 67203697Sneel * This hardware interrupt is used to deliver IPIs exclusively and must 68203697Sneel * not be used for any other interrupt source. 69203697Sneel */ 70203697Sneelint platform_ipi_intrnum(void); 71203697Sneel 72203697Sneel/* 73203697Sneel * Trigger a IPI interrupt on 'cpuid'. 74203697Sneel */ 75203697Sneelvoid platform_ipi_send(int cpuid); 76203697Sneel 77203697Sneel/* 78203697Sneel * Quiesce the IPI interrupt source on the current cpu. 79203697Sneel */ 80203697Sneelvoid platform_ipi_clear(void); 81203697Sneel 82203697Sneel/* 83203697Sneel * Return the processor id. 84203697Sneel * 85203697Sneel * Note that this function is called in early boot when stack is not available. 86203697Sneel */ 87203697Sneelextern int platform_processor_id(void); 88203697Sneel 89203697Sneel/* 90218591Sjmallett * Return the cpumask of available processors. 91203697Sneel */ 92222813Sattilioextern void platform_cpu_mask(cpuset_t *mask); 93203697Sneel 94208249Srrs/* 95208249Srrs * Return the topology of processors on this platform 96208249Srrs */ 97208249Srrsstruct cpu_group *platform_smp_topo(void); 98208249Srrs 99232853Sjmallett#endif /* SMP */ 100208249Srrs 101178172Simp#endif /* !_MACHINE_HWFUNC_H_ */ 102