machdep.h 4.9 KB

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