smp.h (81334) | smp.h (89051) |
---|---|
1/*- 2 * Copyright (c) 2001 Jake Burkholder. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 2001 Jake Burkholder. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/sys/sparc64/include/smp.h 81334 2001-08-09 02:09:34Z obrien $ | 26 * $FreeBSD: head/sys/sparc64/include/smp.h 89051 2002-01-08 05:50:26Z jake $ |
27 */ 28 29#ifndef _MACHINE_SMP_H_ 30#define _MACHINE_SMP_H_ 31 | 27 */ 28 29#ifndef _MACHINE_SMP_H_ 30#define _MACHINE_SMP_H_ 31 |
32#include <machine/intr_machdep.h> 33 34#define CPU_INITING 1 35#define CPU_INITED 2 36#define CPU_REJECT 3 37#define CPU_STARTING 4 38#define CPU_STARTED 5 39#define CPU_BOOTSTRAPING 6 40#define CPU_BOOTSTRAPPED 7 41 42#ifndef LOCORE 43 44#define IDR_BUSY (1<<0) 45#define IDR_NACK (1<<1) 46 47#define IPI_AST PIL_AST 48#define IPI_RENDEZVOUS PIL_RENDEZVOUS 49#define IPI_STOP PIL_STOP 50 51#define IPI_RETRIES 100 52 53struct cpu_start_args { 54 u_int csa_mid; 55 u_int csa_state; 56 u_long csa_data; 57 vm_offset_t csa_va; 58}; 59 60struct ipi_level_args { 61 u_int ila_count; 62 u_int ila_level; 63}; 64 65struct ipi_tlb_args { 66 u_int ita_count; 67 u_long ita_tlb; 68 u_long ita_ctx; 69 u_long ita_start; 70 u_long ita_end; 71}; 72#define ita_va ita_start 73 74struct pcpu; 75 76void cpu_mp_bootstrap(struct pcpu *pc); 77 78void cpu_ipi_selected(u_int cpus, u_long d0, u_long d1, u_long d2); 79void cpu_ipi_send(u_int mid, u_long d0, u_long d1, u_long d2); 80 81void ipi_selected(u_int cpus, u_int ipi); 82void ipi_all(u_int ipi); 83void ipi_all_but_self(u_int ipi); 84 85struct ipi_level_args ipi_level_args; 86struct ipi_tlb_args ipi_tlb_args; 87 88extern int mp_ncpus; 89 90extern char tl_ipi_level[]; 91extern char tl_ipi_test[]; 92extern char tl_ipi_tlb_context_demap[]; 93extern char tl_ipi_tlb_page_demap[]; 94extern char tl_ipi_tlb_range_demap[]; 95 96#ifdef SMP 97 98static __inline void * 99ipi_tlb_context_demap(u_int ctx) 100{ 101 struct ipi_tlb_args *ita; 102 103 if (mp_ncpus == 1) 104 return (NULL); 105 ita = &ipi_tlb_args; 106 ita->ita_count = mp_ncpus; 107 ita->ita_ctx = ctx; 108 cpu_ipi_selected(PCPU_GET(other_cpus), 0, 109 (u_long)tl_ipi_tlb_context_demap, (u_long)ita); 110 return (&ita->ita_count); 111} 112 113static __inline void * 114ipi_tlb_page_demap(u_int tlb, u_int ctx, vm_offset_t va) 115{ 116 struct ipi_tlb_args *ita; 117 118 if (mp_ncpus == 1) 119 return (NULL); 120 ita = &ipi_tlb_args; 121 ita->ita_count = mp_ncpus; 122 ita->ita_tlb = tlb; 123 ita->ita_ctx = ctx; 124 ita->ita_va = va; 125 cpu_ipi_selected(PCPU_GET(other_cpus), 0, 126 (u_long)tl_ipi_tlb_page_demap, (u_long)ita); 127 return (&ita->ita_count); 128} 129 130static __inline void * 131ipi_tlb_range_demap(u_int ctx, vm_offset_t start, vm_offset_t end) 132{ 133 struct ipi_tlb_args *ita; 134 135 if (mp_ncpus == 1) 136 return (NULL); 137 ita = &ipi_tlb_args; 138 ita->ita_count = mp_ncpus; 139 ita->ita_ctx = ctx; 140 ita->ita_start = start; 141 ita->ita_end = end; 142 cpu_ipi_selected(PCPU_GET(other_cpus), 0, 143 (u_long)tl_ipi_tlb_range_demap, (u_long)ita); 144 return (&ita->ita_count); 145} 146 147static __inline void 148ipi_wait(void *cookie) 149{ 150 u_int *count; 151 152 if ((count = cookie) != NULL) { 153 atomic_subtract_int(count, 1); 154 while (*count != 0) 155 membar(LoadStore); 156 } 157} 158 159#else 160 161static __inline void * 162ipi_tlb_context_demap(u_int ctx) 163{ 164 return (NULL); 165} 166 167static __inline void * 168ipi_tlb_page_demap(u_int tlb, u_int ctx, vm_offset_t va) 169{ 170 return (NULL); 171} 172 173static __inline void * 174ipi_tlb_range_demap(u_int ctx, vm_offset_t start, vm_offset_t end) 175{ 176 return (NULL); 177} 178 179static __inline void 180ipi_wait(void *cookie) 181{ 182} 183 184#endif /* SMP */ 185 186#endif /* !LOCORE */ 187 |
|
32#endif /* !_MACHINE_SMP_H_ */ | 188#endif /* !_MACHINE_SMP_H_ */ |