x86_init.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. #ifndef _ASM_X86_PLATFORM_H
  2. #define _ASM_X86_PLATFORM_H
  3. #include <asm/pgtable_types.h>
  4. #include <asm/bootparam.h>
  5. struct mpc_bus;
  6. struct mpc_cpu;
  7. struct mpc_table;
  8. struct cpuinfo_x86;
  9. /**
  10. * struct x86_init_mpparse - platform specific mpparse ops
  11. * @mpc_record: platform specific mpc record accounting
  12. * @setup_ioapic_ids: platform specific ioapic id override
  13. * @mpc_apic_id: platform specific mpc apic id assignment
  14. * @smp_read_mpc_oem: platform specific oem mpc table setup
  15. * @mpc_oem_pci_bus: platform specific pci bus setup (default NULL)
  16. * @mpc_oem_bus_info: platform specific mpc bus info
  17. * @find_smp_config: find the smp configuration
  18. * @get_smp_config: get the smp configuration
  19. */
  20. struct x86_init_mpparse {
  21. void (*mpc_record)(unsigned int mode);
  22. void (*setup_ioapic_ids)(void);
  23. int (*mpc_apic_id)(struct mpc_cpu *m);
  24. void (*smp_read_mpc_oem)(struct mpc_table *mpc);
  25. void (*mpc_oem_pci_bus)(struct mpc_bus *m);
  26. void (*mpc_oem_bus_info)(struct mpc_bus *m, char *name);
  27. void (*find_smp_config)(void);
  28. void (*get_smp_config)(unsigned int early);
  29. };
  30. /**
  31. * struct x86_init_resources - platform specific resource related ops
  32. * @probe_roms: probe BIOS roms
  33. * @reserve_resources: reserve the standard resources for the
  34. * platform
  35. * @memory_setup: platform specific memory setup
  36. *
  37. */
  38. struct x86_init_resources {
  39. void (*probe_roms)(void);
  40. void (*reserve_resources)(void);
  41. char *(*memory_setup)(void);
  42. };
  43. /**
  44. * struct x86_init_irqs - platform specific interrupt setup
  45. * @pre_vector_init: init code to run before interrupt vectors
  46. * are set up.
  47. * @intr_init: interrupt init code
  48. * @trap_init: platform specific trap setup
  49. */
  50. struct x86_init_irqs {
  51. void (*pre_vector_init)(void);
  52. void (*intr_init)(void);
  53. void (*trap_init)(void);
  54. };
  55. /**
  56. * struct x86_init_oem - oem platform specific customizing functions
  57. * @arch_setup: platform specific architecure setup
  58. * @banner: print a platform specific banner
  59. */
  60. struct x86_init_oem {
  61. void (*arch_setup)(void);
  62. void (*banner)(void);
  63. };
  64. /**
  65. * struct x86_init_paging - platform specific paging functions
  66. * @pagetable_init: platform specific paging initialization call to setup
  67. * the kernel pagetables and prepare accessors functions.
  68. * Callback must call paging_init(). Called once after the
  69. * direct mapping for phys memory is available.
  70. */
  71. struct x86_init_paging {
  72. void (*pagetable_init)(void);
  73. };
  74. /**
  75. * struct x86_init_timers - platform specific timer setup
  76. * @setup_perpcu_clockev: set up the per cpu clock event device for the
  77. * boot cpu
  78. * @tsc_pre_init: platform function called before TSC init
  79. * @timer_init: initialize the platform timer (default PIT/HPET)
  80. * @wallclock_init: init the wallclock device
  81. */
  82. struct x86_init_timers {
  83. void (*setup_percpu_clockev)(void);
  84. void (*tsc_pre_init)(void);
  85. void (*timer_init)(void);
  86. void (*wallclock_init)(void);
  87. };
  88. /**
  89. * struct x86_init_iommu - platform specific iommu setup
  90. * @iommu_init: platform specific iommu setup
  91. */
  92. struct x86_init_iommu {
  93. int (*iommu_init)(void);
  94. };
  95. /**
  96. * struct x86_init_pci - platform specific pci init functions
  97. * @arch_init: platform specific pci arch init call
  98. * @init: platform specific pci subsystem init
  99. * @init_irq: platform specific pci irq init
  100. * @fixup_irqs: platform specific pci irq fixup
  101. */
  102. struct x86_init_pci {
  103. int (*arch_init)(void);
  104. int (*init)(void);
  105. void (*init_irq)(void);
  106. void (*fixup_irqs)(void);
  107. };
  108. /**
  109. * struct x86_init_ops - functions for platform specific setup
  110. *
  111. */
  112. struct x86_init_ops {
  113. struct x86_init_resources resources;
  114. struct x86_init_mpparse mpparse;
  115. struct x86_init_irqs irqs;
  116. struct x86_init_oem oem;
  117. struct x86_init_paging paging;
  118. struct x86_init_timers timers;
  119. struct x86_init_iommu iommu;
  120. struct x86_init_pci pci;
  121. };
  122. /**
  123. * struct x86_cpuinit_ops - platform specific cpu hotplug setups
  124. * @setup_percpu_clockev: set up the per cpu clock event device
  125. * @early_percpu_clock_init: early init of the per cpu clock event device
  126. */
  127. struct x86_cpuinit_ops {
  128. void (*setup_percpu_clockev)(void);
  129. void (*early_percpu_clock_init)(void);
  130. void (*fixup_cpu_id)(struct cpuinfo_x86 *c, int node);
  131. };
  132. /**
  133. * struct x86_platform_ops - platform specific runtime functions
  134. * @calibrate_tsc: calibrate TSC
  135. * @get_wallclock: get time from HW clock like RTC etc.
  136. * @set_wallclock: set time back to HW clock
  137. * @is_untracked_pat_range exclude from PAT logic
  138. * @nmi_init enable NMI on cpus
  139. * @i8042_detect pre-detect if i8042 controller exists
  140. * @save_sched_clock_state: save state for sched_clock() on suspend
  141. * @restore_sched_clock_state: restore state for sched_clock() on resume
  142. * @apic_post_init: adjust apic if neeeded
  143. */
  144. struct x86_platform_ops {
  145. unsigned long (*calibrate_tsc)(void);
  146. unsigned long (*get_wallclock)(void);
  147. int (*set_wallclock)(unsigned long nowtime);
  148. void (*iommu_shutdown)(void);
  149. bool (*is_untracked_pat_range)(u64 start, u64 end);
  150. void (*nmi_init)(void);
  151. unsigned char (*get_nmi_reason)(void);
  152. int (*i8042_detect)(void);
  153. void (*save_sched_clock_state)(void);
  154. void (*restore_sched_clock_state)(void);
  155. void (*apic_post_init)(void);
  156. };
  157. struct pci_dev;
  158. struct msi_msg;
  159. struct x86_msi_ops {
  160. int (*setup_msi_irqs)(struct pci_dev *dev, int nvec, int type);
  161. void (*compose_msi_msg)(struct pci_dev *dev, unsigned int irq,
  162. unsigned int dest, struct msi_msg *msg,
  163. u8 hpet_id);
  164. void (*teardown_msi_irq)(unsigned int irq);
  165. void (*teardown_msi_irqs)(struct pci_dev *dev);
  166. void (*restore_msi_irqs)(struct pci_dev *dev, int irq);
  167. int (*setup_hpet_msi)(unsigned int irq, unsigned int id);
  168. };
  169. struct IO_APIC_route_entry;
  170. struct io_apic_irq_attr;
  171. struct irq_data;
  172. struct cpumask;
  173. struct x86_io_apic_ops {
  174. void (*init) (void);
  175. unsigned int (*read) (unsigned int apic, unsigned int reg);
  176. void (*write) (unsigned int apic, unsigned int reg, unsigned int value);
  177. void (*modify) (unsigned int apic, unsigned int reg, unsigned int value);
  178. void (*disable)(void);
  179. void (*print_entries)(unsigned int apic, unsigned int nr_entries);
  180. int (*set_affinity)(struct irq_data *data,
  181. const struct cpumask *mask,
  182. bool force);
  183. int (*setup_entry)(int irq, struct IO_APIC_route_entry *entry,
  184. unsigned int destination, int vector,
  185. struct io_apic_irq_attr *attr);
  186. void (*eoi_ioapic_pin)(int apic, int pin, int vector);
  187. };
  188. extern struct x86_init_ops x86_init;
  189. extern struct x86_cpuinit_ops x86_cpuinit;
  190. extern struct x86_platform_ops x86_platform;
  191. extern struct x86_msi_ops x86_msi;
  192. extern struct x86_io_apic_ops x86_io_apic_ops;
  193. extern void x86_init_noop(void);
  194. extern void x86_init_uint_noop(unsigned int unused);
  195. #endif