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