machdep.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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 <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. /* We export this macro for external modules like Alsa to know if
  17. * ppc_md.feature_call is implemented or not
  18. */
  19. #define CONFIG_PPC_HAS_FEATURE_CALLS
  20. struct machdep_calls {
  21. void (*setup_arch)(void);
  22. /* Optional, may be NULL. */
  23. int (*show_cpuinfo)(struct seq_file *m);
  24. int (*show_percpuinfo)(struct seq_file *m, int i);
  25. /* Optional, may be NULL. */
  26. unsigned int (*irq_canonicalize)(unsigned int irq);
  27. void (*init_IRQ)(void);
  28. int (*get_irq)(struct pt_regs *);
  29. /* A general init function, called by ppc_init in init/main.c.
  30. May be NULL. */
  31. void (*init)(void);
  32. void (*restart)(char *cmd);
  33. void (*power_off)(void);
  34. void (*halt)(void);
  35. void (*idle)(void);
  36. void (*power_save)(void);
  37. long (*time_init)(void); /* Optional, may be NULL */
  38. int (*set_rtc_time)(unsigned long nowtime);
  39. unsigned long (*get_rtc_time)(void);
  40. unsigned char (*rtc_read_val)(int addr);
  41. void (*rtc_write_val)(int addr, unsigned char val);
  42. void (*calibrate_decr)(void);
  43. void (*heartbeat)(void);
  44. unsigned long heartbeat_reset;
  45. unsigned long heartbeat_count;
  46. unsigned long (*find_end_of_memory)(void);
  47. void (*setup_io_mappings)(void);
  48. void (*early_serial_map)(void);
  49. void (*progress)(char *, unsigned short);
  50. void (*kgdb_map_scc)(void);
  51. unsigned char (*nvram_read_val)(int addr);
  52. void (*nvram_write_val)(int addr, unsigned char val);
  53. void (*nvram_sync)(void);
  54. /*
  55. * optional PCI "hooks"
  56. */
  57. /* Called after scanning the bus, before allocating resources */
  58. void (*pcibios_fixup)(void);
  59. /* Called after PPC generic resource fixup to perform
  60. machine specific fixups */
  61. void (*pcibios_fixup_resources)(struct pci_dev *);
  62. /* Called for each PCI bus in the system when it's probed */
  63. void (*pcibios_fixup_bus)(struct pci_bus *);
  64. /* Called when pci_enable_device() is called (initial=0) or
  65. * when a device with no assigned resource is found (initial=1).
  66. * Returns 0 to allow assignment/enabling of the device. */
  67. int (*pcibios_enable_device_hook)(struct pci_dev *, int initial);
  68. /* For interrupt routing */
  69. unsigned char (*pci_swizzle)(struct pci_dev *, unsigned char *);
  70. int (*pci_map_irq)(struct pci_dev *, unsigned char, unsigned char);
  71. /* Called in indirect_* to avoid touching devices */
  72. int (*pci_exclude_device)(unsigned char, unsigned char);
  73. /* Called at then very end of pcibios_init() */
  74. void (*pcibios_after_init)(void);
  75. /* Get access protection for /dev/mem */
  76. pgprot_t (*phys_mem_access_prot)(struct file *file,
  77. unsigned long offset,
  78. unsigned long size,
  79. pgprot_t vma_prot);
  80. /* this is for modules, since _machine can be a define -- Cort */
  81. int ppc_machine;
  82. /* Motherboard/chipset features. This is a kind of general purpose
  83. * hook used to control some machine specific features (like reset
  84. * lines, chip power control, etc...).
  85. */
  86. long (*feature_call)(unsigned int feature, ...);
  87. #ifdef CONFIG_SMP
  88. /* functions for dealing with other cpus */
  89. struct smp_ops_t *smp_ops;
  90. #endif /* CONFIG_SMP */
  91. };
  92. extern struct machdep_calls ppc_md;
  93. extern char cmd_line[COMMAND_LINE_SIZE];
  94. extern void setup_pci_ptrs(void);
  95. /*
  96. * Power macintoshes have either a CUDA or a PMU controlling
  97. * system reset, power, NVRAM, RTC.
  98. */
  99. typedef enum sys_ctrler_kind {
  100. SYS_CTRLER_UNKNOWN = 0,
  101. SYS_CTRLER_CUDA = 1,
  102. SYS_CTRLER_PMU = 2,
  103. SYS_CTRLER_SMU = 3,
  104. } sys_ctrler_t;
  105. extern sys_ctrler_t sys_ctrler;
  106. #ifdef CONFIG_SMP
  107. struct smp_ops_t {
  108. void (*message_pass)(int target, int msg, unsigned long data, int wait);
  109. int (*probe)(void);
  110. void (*kick_cpu)(int nr);
  111. void (*setup_cpu)(int nr);
  112. void (*space_timers)(int nr);
  113. void (*take_timebase)(void);
  114. void (*give_timebase)(void);
  115. };
  116. /* Poor default implementations */
  117. extern void __devinit smp_generic_give_timebase(void);
  118. extern void __devinit smp_generic_take_timebase(void);
  119. #endif /* CONFIG_SMP */
  120. #endif /* _PPC_MACHDEP_H */
  121. #endif /* __KERNEL__ */