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