machdep.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. #ifdef __KERNEL__
  2. #ifndef _PPC_MACHDEP_H
  3. #define _PPC_MACHDEP_H
  4. #include <linux/config.h>
  5. #include <linux/init.h>
  6. #include <linux/kexec.h>
  7. #include <asm/setup.h>
  8. #include <asm/page.h>
  9. #ifdef CONFIG_APUS
  10. #include <asm-m68k/machdep.h>
  11. #endif
  12. struct pt_regs;
  13. struct pci_bus;
  14. struct pci_dev;
  15. struct seq_file;
  16. struct file;
  17. /* We export this macro for external modules like Alsa to know if
  18. * ppc_md.feature_call is implemented or not
  19. */
  20. #define CONFIG_PPC_HAS_FEATURE_CALLS
  21. struct machdep_calls {
  22. void (*setup_arch)(void);
  23. /* Optional, may be NULL. */
  24. int (*show_cpuinfo)(struct seq_file *m);
  25. int (*show_percpuinfo)(struct seq_file *m, int i);
  26. /* Optional, may be NULL. */
  27. unsigned int (*irq_canonicalize)(unsigned int irq);
  28. void (*init_IRQ)(void);
  29. int (*get_irq)(struct pt_regs *);
  30. /* A general init function, called by ppc_init in init/main.c.
  31. May be NULL. DEPRECATED ! */
  32. void (*init)(void);
  33. /* For compatibility with merged platforms */
  34. void (*init_early)(void);
  35. void (*restart)(char *cmd);
  36. void (*power_off)(void);
  37. void (*halt)(void);
  38. void (*idle)(void);
  39. void (*power_save)(void);
  40. long (*time_init)(void); /* Optional, may be NULL */
  41. int (*set_rtc_time)(unsigned long nowtime);
  42. unsigned long (*get_rtc_time)(void);
  43. unsigned char (*rtc_read_val)(int addr);
  44. void (*rtc_write_val)(int addr, unsigned char val);
  45. void (*calibrate_decr)(void);
  46. void (*heartbeat)(void);
  47. unsigned long heartbeat_reset;
  48. unsigned long heartbeat_count;
  49. unsigned long (*find_end_of_memory)(void);
  50. void (*setup_io_mappings)(void);
  51. void (*early_serial_map)(void);
  52. void (*progress)(char *, unsigned short);
  53. void (*kgdb_map_scc)(void);
  54. unsigned char (*nvram_read_val)(int addr);
  55. void (*nvram_write_val)(int addr, unsigned char val);
  56. void (*nvram_sync)(void);
  57. /*
  58. * optional PCI "hooks"
  59. */
  60. /* Called after scanning the bus, before allocating resources */
  61. void (*pcibios_fixup)(void);
  62. /* Called after PPC generic resource fixup to perform
  63. machine specific fixups */
  64. void (*pcibios_fixup_resources)(struct pci_dev *);
  65. /* Called for each PCI bus in the system when it's probed */
  66. void (*pcibios_fixup_bus)(struct pci_bus *);
  67. /* Called when pci_enable_device() is called (initial=0) or
  68. * when a device with no assigned resource is found (initial=1).
  69. * Returns 0 to allow assignment/enabling of the device. */
  70. int (*pcibios_enable_device_hook)(struct pci_dev *, int initial);
  71. /* For interrupt routing */
  72. unsigned char (*pci_swizzle)(struct pci_dev *, unsigned char *);
  73. int (*pci_map_irq)(struct pci_dev *, unsigned char, unsigned char);
  74. /* Called in indirect_* to avoid touching devices */
  75. int (*pci_exclude_device)(unsigned char, unsigned char);
  76. /* Called at then very end of pcibios_init() */
  77. void (*pcibios_after_init)(void);
  78. /* Get access protection for /dev/mem */
  79. pgprot_t (*phys_mem_access_prot)(struct file *file,
  80. unsigned long pfn,
  81. unsigned long size,
  82. pgprot_t vma_prot);
  83. /* this is for modules, since _machine can be a define -- Cort */
  84. int ppc_machine;
  85. /* Motherboard/chipset features. This is a kind of general purpose
  86. * hook used to control some machine specific features (like reset
  87. * lines, chip power control, etc...).
  88. */
  89. long (*feature_call)(unsigned int feature, ...);
  90. #ifdef CONFIG_SMP
  91. /* functions for dealing with other cpus */
  92. struct smp_ops_t *smp_ops;
  93. #endif /* CONFIG_SMP */
  94. #ifdef CONFIG_KEXEC
  95. /* Called to shutdown machine specific hardware not already controlled
  96. * by other drivers.
  97. * XXX Should we move this one out of kexec scope?
  98. */
  99. void (*machine_shutdown)(void);
  100. /* Called to do the minimal shutdown needed to run a kexec'd kernel
  101. * to run successfully.
  102. * XXX Should we move this one out of kexec scope?
  103. */
  104. void (*machine_crash_shutdown)(void);
  105. /* Called to do what every setup is needed on image and the
  106. * reboot code buffer. Returns 0 on success.
  107. * Provide your own (maybe dummy) implementation if your platform
  108. * claims to support kexec.
  109. */
  110. int (*machine_kexec_prepare)(struct kimage *image);
  111. /* Called to handle any machine specific cleanup on image */
  112. void (*machine_kexec_cleanup)(struct kimage *image);
  113. /* Called to perform the _real_ kexec.
  114. * Do NOT allocate memory or fail here. We are past the point of
  115. * no return.
  116. */
  117. void (*machine_kexec)(struct kimage *image);
  118. #endif /* CONFIG_KEXEC */
  119. };
  120. extern struct machdep_calls ppc_md;
  121. extern char cmd_line[COMMAND_LINE_SIZE];
  122. extern void setup_pci_ptrs(void);
  123. /*
  124. * Power macintoshes have either a CUDA or a PMU controlling
  125. * system reset, power, NVRAM, RTC.
  126. */
  127. typedef enum sys_ctrler_kind {
  128. SYS_CTRLER_UNKNOWN = 0,
  129. SYS_CTRLER_CUDA = 1,
  130. SYS_CTRLER_PMU = 2,
  131. SYS_CTRLER_SMU = 3,
  132. } sys_ctrler_t;
  133. extern sys_ctrler_t sys_ctrler;
  134. #ifdef CONFIG_SMP
  135. struct smp_ops_t {
  136. void (*message_pass)(int target, int msg);
  137. int (*probe)(void);
  138. void (*kick_cpu)(int nr);
  139. void (*setup_cpu)(int nr);
  140. void (*space_timers)(int nr);
  141. void (*take_timebase)(void);
  142. void (*give_timebase)(void);
  143. };
  144. /* Poor default implementations */
  145. extern void __devinit smp_generic_give_timebase(void);
  146. extern void __devinit smp_generic_take_timebase(void);
  147. #endif /* CONFIG_SMP */
  148. #endif /* _PPC_MACHDEP_H */
  149. #endif /* __KERNEL__ */