HardenedBSD src tree https://hardenedbsd.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

117 lines
3.5 KiB

  1. /*-
  2. * SPDX-License-Identifier: Beerware
  3. *
  4. * ----------------------------------------------------------------------------
  5. * "THE BEER-WARE LICENSE" (Revision 42):
  6. * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you
  7. * can do whatever you want with this stuff. If we meet some day, and you think
  8. * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
  9. * ----------------------------------------------------------------------------
  10. *
  11. * $FreeBSD$
  12. *
  13. */
  14. #ifndef _X86_X86_SMP_H_
  15. #define _X86_X86_SMP_H_
  16. #include <sys/bus.h>
  17. #include <machine/frame.h>
  18. #include <machine/intr_machdep.h>
  19. #include <x86/apicvar.h>
  20. #include <machine/pcb.h>
  21. struct pmap;
  22. /* global data in mp_x86.c */
  23. extern int mp_naps;
  24. extern int boot_cpu_id;
  25. extern struct pcb stoppcbs[];
  26. extern int cpu_apic_ids[];
  27. extern int bootAP;
  28. extern void *dpcpu;
  29. extern char *bootSTK;
  30. extern void *bootstacks[];
  31. extern unsigned int boot_address;
  32. extern unsigned int bootMP_size;
  33. extern volatile u_int cpu_ipi_pending[];
  34. extern volatile int aps_ready;
  35. extern struct mtx ap_boot_mtx;
  36. extern int cpu_logical;
  37. extern int cpu_cores;
  38. extern volatile uint32_t smp_tlb_generation;
  39. extern struct pmap *smp_tlb_pmap;
  40. extern vm_offset_t smp_tlb_addr1, smp_tlb_addr2;
  41. extern u_int xhits_gbl[];
  42. extern u_int xhits_pg[];
  43. extern u_int xhits_rng[];
  44. extern u_int ipi_global;
  45. extern u_int ipi_page;
  46. extern u_int ipi_range;
  47. extern u_int ipi_range_size;
  48. extern int nmi_kdb_lock;
  49. extern int nmi_is_broadcast;
  50. struct cpu_info {
  51. int cpu_present:1;
  52. int cpu_bsp:1;
  53. int cpu_disabled:1;
  54. int cpu_hyperthread:1;
  55. };
  56. extern struct cpu_info *cpu_info;
  57. #ifdef COUNT_IPIS
  58. extern u_long *ipi_invltlb_counts[MAXCPU];
  59. extern u_long *ipi_invlrng_counts[MAXCPU];
  60. extern u_long *ipi_invlpg_counts[MAXCPU];
  61. extern u_long *ipi_invlcache_counts[MAXCPU];
  62. extern u_long *ipi_rendezvous_counts[MAXCPU];
  63. #endif
  64. /* IPI handlers */
  65. inthand_t
  66. IDTVEC(invltlb), /* TLB shootdowns - global */
  67. IDTVEC(invlpg), /* TLB shootdowns - 1 page */
  68. IDTVEC(invlrng), /* TLB shootdowns - page range */
  69. IDTVEC(invlcache), /* Write back and invalidate cache */
  70. IDTVEC(ipi_intr_bitmap_handler), /* Bitmap based IPIs */
  71. IDTVEC(cpustop), /* CPU stops & waits to be restarted */
  72. IDTVEC(cpususpend), /* CPU suspends & waits to be resumed */
  73. IDTVEC(rendezvous); /* handle CPU rendezvous */
  74. typedef void (*smp_invl_cb_t)(struct pmap *, vm_offset_t addr1,
  75. vm_offset_t addr2);
  76. /* functions in x86_mp.c */
  77. void assign_cpu_ids(void);
  78. void cpu_add(u_int apic_id, char boot_cpu);
  79. void cpustop_handler(void);
  80. void cpususpend_handler(void);
  81. void alloc_ap_trampoline(vm_paddr_t *physmap, unsigned int *physmap_idx);
  82. void init_secondary_tail(void);
  83. void invltlb_handler(void);
  84. void invlpg_handler(void);
  85. void invlrng_handler(void);
  86. void invlcache_handler(void);
  87. void init_secondary(void);
  88. void ipi_startup(int apic_id, int vector);
  89. void ipi_all_but_self(u_int ipi);
  90. void ipi_bitmap_handler(struct trapframe frame);
  91. void ipi_cpu(int cpu, u_int ipi);
  92. int ipi_nmi_handler(void);
  93. void ipi_selected(cpuset_t cpus, u_int ipi);
  94. void set_interrupt_apic_ids(void);
  95. void smp_cache_flush(smp_invl_cb_t curcpu_cb);
  96. void smp_masked_invlpg(cpuset_t mask, vm_offset_t addr, struct pmap *pmap,
  97. smp_invl_cb_t curcpu_cb);
  98. void smp_masked_invlpg_range(cpuset_t mask, vm_offset_t startva,
  99. vm_offset_t endva, struct pmap *pmap, smp_invl_cb_t curcpu_cb);
  100. void smp_masked_invltlb(cpuset_t mask, struct pmap *pmap,
  101. smp_invl_cb_t curcpu_cb);
  102. void mem_range_AP_init(void);
  103. void topo_probe(void);
  104. void ipi_send_cpu(int cpu, u_int ipi);
  105. #endif