machdep.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. #ifdef __KERNEL__
  2. #ifndef _PPC64_MACHDEP_H
  3. #define _PPC64_MACHDEP_H
  4. /*
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License
  7. * as published by the Free Software Foundation; either version
  8. * 2 of the License, or (at your option) any later version.
  9. */
  10. #include <linux/config.h>
  11. #include <linux/seq_file.h>
  12. #include <linux/init.h>
  13. #include <linux/dma-mapping.h>
  14. #include <asm/setup.h>
  15. struct pt_regs;
  16. struct pci_bus;
  17. struct device_node;
  18. struct iommu_table;
  19. struct rtc_time;
  20. struct file;
  21. #ifdef CONFIG_SMP
  22. struct smp_ops_t {
  23. void (*message_pass)(int target, int msg);
  24. int (*probe)(void);
  25. void (*kick_cpu)(int nr);
  26. void (*setup_cpu)(int nr);
  27. void (*take_timebase)(void);
  28. void (*give_timebase)(void);
  29. int (*cpu_enable)(unsigned int nr);
  30. int (*cpu_disable)(void);
  31. void (*cpu_die)(unsigned int nr);
  32. int (*cpu_bootable)(unsigned int nr);
  33. };
  34. #endif
  35. struct machdep_calls {
  36. void (*hpte_invalidate)(unsigned long slot,
  37. unsigned long va,
  38. int large,
  39. int local);
  40. long (*hpte_updatepp)(unsigned long slot,
  41. unsigned long newpp,
  42. unsigned long va,
  43. int large,
  44. int local);
  45. void (*hpte_updateboltedpp)(unsigned long newpp,
  46. unsigned long ea);
  47. long (*hpte_insert)(unsigned long hpte_group,
  48. unsigned long va,
  49. unsigned long prpn,
  50. unsigned long vflags,
  51. unsigned long rflags);
  52. long (*hpte_remove)(unsigned long hpte_group);
  53. void (*flush_hash_range)(unsigned long context,
  54. unsigned long number,
  55. int local);
  56. /* special for kexec, to be called in real mode, linar mapping is
  57. * destroyed as well */
  58. void (*hpte_clear_all)(void);
  59. void (*tce_build)(struct iommu_table * tbl,
  60. long index,
  61. long npages,
  62. unsigned long uaddr,
  63. enum dma_data_direction direction);
  64. void (*tce_free)(struct iommu_table *tbl,
  65. long index,
  66. long npages);
  67. void (*tce_flush)(struct iommu_table *tbl);
  68. void (*iommu_dev_setup)(struct pci_dev *dev);
  69. void (*iommu_bus_setup)(struct pci_bus *bus);
  70. void (*irq_bus_setup)(struct pci_bus *bus);
  71. int (*probe)(int platform);
  72. void (*setup_arch)(void);
  73. void (*init_early)(void);
  74. /* Optional, may be NULL. */
  75. void (*get_cpuinfo)(struct seq_file *m);
  76. void (*init_IRQ)(void);
  77. int (*get_irq)(struct pt_regs *);
  78. void (*cpu_irq_down)(int secondary);
  79. /* PCI stuff */
  80. void (*pcibios_fixup)(void);
  81. void (*restart)(char *cmd);
  82. void (*power_off)(void);
  83. void (*halt)(void);
  84. void (*panic)(char *str);
  85. void (*cpu_die)(void);
  86. int (*set_rtc_time)(struct rtc_time *);
  87. void (*get_rtc_time)(struct rtc_time *);
  88. void (*get_boot_time)(struct rtc_time *);
  89. void (*calibrate_decr)(void);
  90. void (*progress)(char *, unsigned short);
  91. /* Interface for platform error logging */
  92. void (*log_error)(char *buf, unsigned int err_type, int fatal);
  93. ssize_t (*nvram_write)(char *buf, size_t count, loff_t *index);
  94. ssize_t (*nvram_read)(char *buf, size_t count, loff_t *index);
  95. ssize_t (*nvram_size)(void);
  96. int (*nvram_sync)(void);
  97. /* Exception handlers */
  98. void (*system_reset_exception)(struct pt_regs *regs);
  99. int (*machine_check_exception)(struct pt_regs *regs);
  100. /* Motherboard/chipset features. This is a kind of general purpose
  101. * hook used to control some machine specific features (like reset
  102. * lines, chip power control, etc...).
  103. */
  104. long (*feature_call)(unsigned int feature, ...);
  105. /* Check availability of legacy devices like i8042 */
  106. int (*check_legacy_ioport)(unsigned int baseport);
  107. /* Get legacy PCI/IDE interrupt mapping */
  108. int (*pci_get_legacy_ide_irq)(struct pci_dev *dev, int channel);
  109. /* Get access protection for /dev/mem */
  110. pgprot_t (*phys_mem_access_prot)(struct file *file,
  111. unsigned long offset,
  112. unsigned long size,
  113. pgprot_t vma_prot);
  114. /* Idle loop for this platform, leave empty for default idle loop */
  115. int (*idle_loop)(void);
  116. /* Function to enable pmcs for this platform, called once per cpu. */
  117. void (*enable_pmcs)(void);
  118. };
  119. extern int default_idle(void);
  120. extern int native_idle(void);
  121. extern struct machdep_calls ppc_md;
  122. extern char cmd_line[COMMAND_LINE_SIZE];
  123. #ifdef CONFIG_PPC_PMAC
  124. /*
  125. * Power macintoshes have either a CUDA, PMU or SMU controlling
  126. * system reset, power, NVRAM, RTC.
  127. */
  128. typedef enum sys_ctrler_kind {
  129. SYS_CTRLER_UNKNOWN = 0,
  130. SYS_CTRLER_CUDA = 1,
  131. SYS_CTRLER_PMU = 2,
  132. SYS_CTRLER_SMU = 3,
  133. } sys_ctrler_t;
  134. extern sys_ctrler_t sys_ctrler;
  135. #endif /* CONFIG_PPC_PMAC */
  136. /* Functions to produce codes on the leds.
  137. * The SRC code should be unique for the message category and should
  138. * be limited to the lower 24 bits (the upper 8 are set by these funcs),
  139. * and (for boot & dump) should be sorted numerically in the order
  140. * the events occur.
  141. */
  142. /* Print a boot progress message. */
  143. void ppc64_boot_msg(unsigned int src, const char *msg);
  144. /* Print a termination message (print only -- does not stop the kernel) */
  145. void ppc64_terminate_msg(unsigned int src, const char *msg);
  146. /* Print something that needs attention (device error, etc) */
  147. void ppc64_attention_msg(unsigned int src, const char *msg);
  148. /* Print a dump progress message. */
  149. void ppc64_dump_msg(unsigned int src, const char *msg);
  150. static inline void log_error(char *buf, unsigned int err_type, int fatal)
  151. {
  152. if (ppc_md.log_error)
  153. ppc_md.log_error(buf, err_type, fatal);
  154. }
  155. #endif /* _PPC64_MACHDEP_H */
  156. #endif /* __KERNEL__ */