Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifdef __KERNEL__ |
| 2 | #ifndef _PPC64_MACHDEP_H |
| 3 | #define _PPC64_MACHDEP_H |
| 4 | |
| 5 | /* |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License |
| 8 | * as published by the Free Software Foundation; either version |
| 9 | * 2 of the License, or (at your option) any later version. |
| 10 | */ |
| 11 | |
| 12 | #include <linux/config.h> |
| 13 | #include <linux/seq_file.h> |
| 14 | #include <linux/init.h> |
| 15 | #include <linux/dma-mapping.h> |
| 16 | |
| 17 | #include <asm/setup.h> |
| 18 | |
| 19 | struct pt_regs; |
| 20 | struct pci_bus; |
| 21 | struct device_node; |
| 22 | struct iommu_table; |
| 23 | struct rtc_time; |
| 24 | struct file; |
| 25 | |
| 26 | #ifdef CONFIG_SMP |
| 27 | struct smp_ops_t { |
| 28 | void (*message_pass)(int target, int msg); |
| 29 | int (*probe)(void); |
| 30 | void (*kick_cpu)(int nr); |
| 31 | void (*setup_cpu)(int nr); |
| 32 | void (*take_timebase)(void); |
| 33 | void (*give_timebase)(void); |
| 34 | int (*cpu_enable)(unsigned int nr); |
| 35 | int (*cpu_disable)(void); |
| 36 | void (*cpu_die)(unsigned int nr); |
| 37 | int (*cpu_bootable)(unsigned int nr); |
| 38 | }; |
| 39 | #endif |
| 40 | |
| 41 | struct machdep_calls { |
| 42 | void (*hpte_invalidate)(unsigned long slot, |
| 43 | unsigned long va, |
| 44 | int large, |
| 45 | int local); |
| 46 | long (*hpte_updatepp)(unsigned long slot, |
| 47 | unsigned long newpp, |
| 48 | unsigned long va, |
| 49 | int large, |
| 50 | int local); |
| 51 | void (*hpte_updateboltedpp)(unsigned long newpp, |
| 52 | unsigned long ea); |
| 53 | long (*hpte_insert)(unsigned long hpte_group, |
| 54 | unsigned long va, |
| 55 | unsigned long prpn, |
David Gibson | 96e2844 | 2005-07-13 01:11:42 -0700 | [diff] [blame] | 56 | unsigned long vflags, |
| 57 | unsigned long rflags); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | long (*hpte_remove)(unsigned long hpte_group); |
| 59 | void (*flush_hash_range)(unsigned long context, |
| 60 | unsigned long number, |
| 61 | int local); |
| 62 | /* special for kexec, to be called in real mode, linar mapping is |
| 63 | * destroyed as well */ |
| 64 | void (*hpte_clear_all)(void); |
| 65 | |
| 66 | void (*tce_build)(struct iommu_table * tbl, |
| 67 | long index, |
| 68 | long npages, |
| 69 | unsigned long uaddr, |
| 70 | enum dma_data_direction direction); |
| 71 | void (*tce_free)(struct iommu_table *tbl, |
| 72 | long index, |
| 73 | long npages); |
| 74 | void (*tce_flush)(struct iommu_table *tbl); |
| 75 | void (*iommu_dev_setup)(struct pci_dev *dev); |
| 76 | void (*iommu_bus_setup)(struct pci_bus *bus); |
John Rose | dad32bb | 2005-06-23 17:09:54 +1000 | [diff] [blame] | 77 | void (*irq_bus_setup)(struct pci_bus *bus); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | |
| 79 | int (*probe)(int platform); |
| 80 | void (*setup_arch)(void); |
| 81 | void (*init_early)(void); |
| 82 | /* Optional, may be NULL. */ |
| 83 | void (*get_cpuinfo)(struct seq_file *m); |
| 84 | |
| 85 | void (*init_IRQ)(void); |
| 86 | int (*get_irq)(struct pt_regs *); |
Paul Mackerras | 6d22d85 | 2005-08-04 12:53:37 -0700 | [diff] [blame] | 87 | void (*cpu_irq_down)(int secondary); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | |
| 89 | /* PCI stuff */ |
| 90 | void (*pcibios_fixup)(void); |
| 91 | |
| 92 | void (*restart)(char *cmd); |
| 93 | void (*power_off)(void); |
| 94 | void (*halt)(void); |
| 95 | void (*panic)(char *str); |
| 96 | void (*cpu_die)(void); |
| 97 | |
| 98 | int (*set_rtc_time)(struct rtc_time *); |
| 99 | void (*get_rtc_time)(struct rtc_time *); |
| 100 | void (*get_boot_time)(struct rtc_time *); |
| 101 | |
| 102 | void (*calibrate_decr)(void); |
| 103 | |
| 104 | void (*progress)(char *, unsigned short); |
| 105 | |
| 106 | /* Debug interface. Low level I/O to some terminal device */ |
| 107 | void (*udbg_putc)(unsigned char c); |
| 108 | unsigned char (*udbg_getc)(void); |
| 109 | int (*udbg_getc_poll)(void); |
| 110 | |
| 111 | /* Interface for platform error logging */ |
| 112 | void (*log_error)(char *buf, unsigned int err_type, int fatal); |
| 113 | |
| 114 | ssize_t (*nvram_write)(char *buf, size_t count, loff_t *index); |
| 115 | ssize_t (*nvram_read)(char *buf, size_t count, loff_t *index); |
| 116 | ssize_t (*nvram_size)(void); |
| 117 | int (*nvram_sync)(void); |
| 118 | |
| 119 | /* Exception handlers */ |
| 120 | void (*system_reset_exception)(struct pt_regs *regs); |
| 121 | int (*machine_check_exception)(struct pt_regs *regs); |
| 122 | |
| 123 | /* Motherboard/chipset features. This is a kind of general purpose |
| 124 | * hook used to control some machine specific features (like reset |
| 125 | * lines, chip power control, etc...). |
| 126 | */ |
| 127 | long (*feature_call)(unsigned int feature, ...); |
| 128 | |
| 129 | /* Check availability of legacy devices like i8042 */ |
| 130 | int (*check_legacy_ioport)(unsigned int baseport); |
| 131 | |
| 132 | /* Get legacy PCI/IDE interrupt mapping */ |
| 133 | int (*pci_get_legacy_ide_irq)(struct pci_dev *dev, int channel); |
| 134 | |
| 135 | /* Get access protection for /dev/mem */ |
| 136 | pgprot_t (*phys_mem_access_prot)(struct file *file, |
| 137 | unsigned long offset, |
| 138 | unsigned long size, |
| 139 | pgprot_t vma_prot); |
| 140 | |
Michael Ellerman | fd899c0 | 2005-07-07 17:56:28 -0700 | [diff] [blame] | 141 | /* Idle loop for this platform, leave empty for default idle loop */ |
| 142 | int (*idle_loop)(void); |
Michael Ellerman | 180a336 | 2005-08-09 11:13:36 +1000 | [diff] [blame] | 143 | |
| 144 | /* Function to enable pmcs for this platform, called once per cpu. */ |
| 145 | void (*enable_pmcs)(void); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 146 | }; |
| 147 | |
Michael Ellerman | fd899c0 | 2005-07-07 17:56:28 -0700 | [diff] [blame] | 148 | extern int default_idle(void); |
| 149 | extern int native_idle(void); |
| 150 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 151 | extern struct machdep_calls ppc_md; |
| 152 | extern char cmd_line[COMMAND_LINE_SIZE]; |
| 153 | |
| 154 | #ifdef CONFIG_PPC_PMAC |
| 155 | /* |
| 156 | * Power macintoshes have either a CUDA, PMU or SMU controlling |
| 157 | * system reset, power, NVRAM, RTC. |
| 158 | */ |
| 159 | typedef enum sys_ctrler_kind { |
| 160 | SYS_CTRLER_UNKNOWN = 0, |
| 161 | SYS_CTRLER_CUDA = 1, |
| 162 | SYS_CTRLER_PMU = 2, |
| 163 | SYS_CTRLER_SMU = 3, |
| 164 | } sys_ctrler_t; |
| 165 | extern sys_ctrler_t sys_ctrler; |
| 166 | |
| 167 | #endif /* CONFIG_PPC_PMAC */ |
| 168 | |
| 169 | |
| 170 | |
| 171 | /* Functions to produce codes on the leds. |
| 172 | * The SRC code should be unique for the message category and should |
| 173 | * be limited to the lower 24 bits (the upper 8 are set by these funcs), |
| 174 | * and (for boot & dump) should be sorted numerically in the order |
| 175 | * the events occur. |
| 176 | */ |
| 177 | /* Print a boot progress message. */ |
| 178 | void ppc64_boot_msg(unsigned int src, const char *msg); |
| 179 | /* Print a termination message (print only -- does not stop the kernel) */ |
| 180 | void ppc64_terminate_msg(unsigned int src, const char *msg); |
| 181 | /* Print something that needs attention (device error, etc) */ |
| 182 | void ppc64_attention_msg(unsigned int src, const char *msg); |
| 183 | /* Print a dump progress message. */ |
| 184 | void ppc64_dump_msg(unsigned int src, const char *msg); |
| 185 | |
| 186 | static inline void log_error(char *buf, unsigned int err_type, int fatal) |
| 187 | { |
| 188 | if (ppc_md.log_error) |
| 189 | ppc_md.log_error(buf, err_type, fatal); |
| 190 | } |
| 191 | |
| 192 | #endif /* _PPC64_MACHDEP_H */ |
| 193 | #endif /* __KERNEL__ */ |