machdep.h 5.0 KB

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