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