machdep.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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 number, int local);
  54. /* special for kexec, to be called in real mode, linar mapping is
  55. * destroyed as well */
  56. void (*hpte_clear_all)(void);
  57. void (*tce_build)(struct iommu_table * tbl,
  58. long index,
  59. long npages,
  60. unsigned long uaddr,
  61. enum dma_data_direction direction);
  62. void (*tce_free)(struct iommu_table *tbl,
  63. long index,
  64. long npages);
  65. void (*tce_flush)(struct iommu_table *tbl);
  66. void (*iommu_dev_setup)(struct pci_dev *dev);
  67. void (*iommu_bus_setup)(struct pci_bus *bus);
  68. void (*irq_bus_setup)(struct pci_bus *bus);
  69. int (*probe)(int platform);
  70. void (*setup_arch)(void);
  71. void (*init_early)(void);
  72. /* Optional, may be NULL. */
  73. void (*get_cpuinfo)(struct seq_file *m);
  74. void (*init_IRQ)(void);
  75. int (*get_irq)(struct pt_regs *);
  76. void (*cpu_irq_down)(int secondary);
  77. /* PCI stuff */
  78. void (*pcibios_fixup)(void);
  79. int (*pci_probe_mode)(struct pci_bus *);
  80. void (*restart)(char *cmd);
  81. void (*power_off)(void);
  82. void (*halt)(void);
  83. void (*panic)(char *str);
  84. void (*cpu_die)(void);
  85. int (*set_rtc_time)(struct rtc_time *);
  86. void (*get_rtc_time)(struct rtc_time *);
  87. void (*get_boot_time)(struct rtc_time *);
  88. void (*calibrate_decr)(void);
  89. void (*progress)(char *, unsigned short);
  90. /* Interface for platform error logging */
  91. void (*log_error)(char *buf, unsigned int err_type, int fatal);
  92. ssize_t (*nvram_write)(char *buf, size_t count, loff_t *index);
  93. ssize_t (*nvram_read)(char *buf, size_t count, loff_t *index);
  94. ssize_t (*nvram_size)(void);
  95. int (*nvram_sync)(void);
  96. /* Exception handlers */
  97. void (*system_reset_exception)(struct pt_regs *regs);
  98. int (*machine_check_exception)(struct pt_regs *regs);
  99. /* Motherboard/chipset features. This is a kind of general purpose
  100. * hook used to control some machine specific features (like reset
  101. * lines, chip power control, etc...).
  102. */
  103. long (*feature_call)(unsigned int feature, ...);
  104. /* Check availability of legacy devices like i8042 */
  105. int (*check_legacy_ioport)(unsigned int baseport);
  106. /* Get legacy PCI/IDE interrupt mapping */
  107. int (*pci_get_legacy_ide_irq)(struct pci_dev *dev, int channel);
  108. /* Get access protection for /dev/mem */
  109. pgprot_t (*phys_mem_access_prot)(struct file *file,
  110. unsigned long offset,
  111. unsigned long size,
  112. pgprot_t vma_prot);
  113. /* Idle loop for this platform, leave empty for default idle loop */
  114. int (*idle_loop)(void);
  115. /* Function to enable pmcs for this platform, called once per cpu. */
  116. void (*enable_pmcs)(void);
  117. };
  118. extern int default_idle(void);
  119. extern int native_idle(void);
  120. extern struct machdep_calls ppc_md;
  121. extern char cmd_line[COMMAND_LINE_SIZE];
  122. #ifdef CONFIG_PPC_PMAC
  123. /*
  124. * Power macintoshes have either a CUDA, PMU or SMU 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. #endif /* CONFIG_PPC_PMAC */
  135. /* Functions to produce codes on the leds.
  136. * The SRC code should be unique for the message category and should
  137. * be limited to the lower 24 bits (the upper 8 are set by these funcs),
  138. * and (for boot & dump) should be sorted numerically in the order
  139. * the events occur.
  140. */
  141. /* Print a boot progress message. */
  142. void ppc64_boot_msg(unsigned int src, const char *msg);
  143. /* Print a termination message (print only -- does not stop the kernel) */
  144. void ppc64_terminate_msg(unsigned int src, const char *msg);
  145. static inline void log_error(char *buf, unsigned int err_type, int fatal)
  146. {
  147. if (ppc_md.log_error)
  148. ppc_md.log_error(buf, err_type, fatal);
  149. }
  150. #endif /* _PPC64_MACHDEP_H */
  151. #endif /* __KERNEL__ */