machdep.h 5.0 KB

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