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