1#ifdef __KERNEL__ 2#ifndef _PPC_MACHDEP_H 3#define _PPC_MACHDEP_H 4 5#include <linux/init.h> 6#include <linux/kexec.h> 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 15struct pt_regs; 16struct pci_bus; 17struct pci_dev; 18struct seq_file; 19struct file; 20 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 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 38struct 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)(void); 47 48 /* A general init function, called by ppc_init in init/main.c. 49 May be NULL. DEPRECATED ! */ 50 void (*init)(void); 51 /* For compatibility with merged platforms */ 52 void (*init_early)(void); 53 54 void (*restart)(char *cmd); 55 void (*power_off)(void); 56 void (*halt)(void); 57 58 void (*idle_loop)(void); 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, 114 unsigned long pfn, 115 unsigned long size, 116 pgprot_t vma_prot); 117 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 */ 128 129#ifdef CONFIG_KEXEC 130 void (*machine_shutdown)(void); 131 132 void (*machine_crash_shutdown)(void); 133 134 /* Called to do what every setup is needed on image and the 135 * reboot code buffer. Returns 0 on success. 136 * Provide your own (maybe dummy) implementation if your platform 137 * claims to support kexec. 138 */ 139 int (*machine_kexec_prepare)(struct kimage *image); 140 141 /* Called to handle any machine specific cleanup on image */ 142 void (*machine_kexec_cleanup)(struct kimage *image); 143 144 /* Called to perform the _real_ kexec. 145 * Do NOT allocate memory or fail here. We are past the point of 146 * no return. 147 */ 148 void (*machine_kexec)(struct kimage *image); 149#endif /* CONFIG_KEXEC */ 150}; 151 152extern struct machdep_calls ppc_md; 153extern char cmd_line[COMMAND_LINE_SIZE]; 154 155extern void setup_pci_ptrs(void); 156 157#ifdef CONFIG_SMP 158struct smp_ops_t { 159 void (*message_pass)(int target, int msg); 160 int (*probe)(void); 161 void (*kick_cpu)(int nr); 162 void (*setup_cpu)(int nr); 163 void (*space_timers)(int nr); 164 void (*take_timebase)(void); 165 void (*give_timebase)(void); 166}; 167 168/* Poor default implementations */ 169extern void __devinit smp_generic_give_timebase(void); 170extern void __devinit smp_generic_take_timebase(void); 171#endif /* CONFIG_SMP */ 172 173#endif /* _PPC_MACHDEP_H */ 174#endif /* __KERNEL__ */ 175