Subversion Repositories Kolibri OS

Rev

Rev 6934 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

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