machdep.h 3.72 KB
Newer Older
Linus Torvalds's avatar
Linus Torvalds committed
1 2 3 4 5
#ifdef __KERNEL__
#ifndef _PPC_MACHDEP_H
#define _PPC_MACHDEP_H

#include <linux/config.h>
6
#include <linux/init.h>
Linus Torvalds's avatar
Linus Torvalds committed
7 8 9 10 11 12 13

#ifdef CONFIG_APUS
#include <asm-m68k/machdep.h>
#endif

struct pt_regs;
struct pci_bus;	
Linus Torvalds's avatar
Linus Torvalds committed
14
struct pci_dev;
Linus Torvalds's avatar
Linus Torvalds committed
15
struct seq_file;
Linus Torvalds's avatar
Linus Torvalds committed
16

17 18 19 20 21
/* We export this macro for external modules like Alsa to know if
 * ppc_md.feature_call is implemented or not
 */
#define CONFIG_PPC_HAS_FEATURE_CALLS

Linus Torvalds's avatar
Linus Torvalds committed
22 23 24
struct machdep_calls {
	void		(*setup_arch)(void);
	/* Optional, may be NULL. */
Linus Torvalds's avatar
Linus Torvalds committed
25 26
	int		(*show_cpuinfo)(struct seq_file *m);
	int		(*show_percpuinfo)(struct seq_file *m, int i);
Linus Torvalds's avatar
Linus Torvalds committed
27
	/* Optional, may be NULL. */
28
	unsigned int	(*irq_canonicalize)(unsigned int irq);
Linus Torvalds's avatar
Linus Torvalds committed
29 30 31 32 33 34 35 36 37 38 39
	void		(*init_IRQ)(void);
	int		(*get_irq)(struct pt_regs *);
	
	/* A general init function, called by ppc_init in init/main.c.
	   May be NULL. */
	void		(*init)(void);

	void		(*restart)(char *cmd);
	void		(*power_off)(void);
	void		(*halt)(void);

40 41 42
	void		(*idle)(void);
	void		(*power_save)(void);

Linus Torvalds's avatar
Linus Torvalds committed
43 44 45 46 47 48 49 50 51
	long		(*time_init)(void); /* Optional, may be NULL */
	int		(*set_rtc_time)(unsigned long nowtime);
	unsigned long	(*get_rtc_time)(void);
	void		(*calibrate_decr)(void);

	void		(*heartbeat)(void);
	unsigned long	heartbeat_reset;
	unsigned long	heartbeat_count;

Linus Torvalds's avatar
Linus Torvalds committed
52
	unsigned long	(*find_end_of_memory)(void);
Linus Torvalds's avatar
Linus Torvalds committed
53 54
	void		(*setup_io_mappings)(void);

Linus Torvalds's avatar
Linus Torvalds committed
55
  	void		(*progress)(char *, unsigned short);
56
	void		(*kgdb_map_scc)(void);
Linus Torvalds's avatar
Linus Torvalds committed
57 58 59

	unsigned char 	(*nvram_read_val)(int addr);
	void		(*nvram_write_val)(int addr, unsigned char val);
60
	void		(*nvram_sync)(void);
Linus Torvalds's avatar
Linus Torvalds committed
61

Linus Torvalds's avatar
Linus Torvalds committed
62 63 64 65
	/*
	 * optional PCI "hooks"
	 */

Linus Torvalds's avatar
Linus Torvalds committed
66
	/* Called after scanning the bus, before allocating resources */
Linus Torvalds's avatar
Linus Torvalds committed
67 68
	void (*pcibios_fixup)(void);

Linus Torvalds's avatar
Linus Torvalds committed
69 70 71 72
	/* Called after PPC generic resource fixup to perform
	   machine specific fixups */
	void (*pcibios_fixup_resources)(struct pci_dev *);

Linus Torvalds's avatar
Linus Torvalds committed
73
	/* Called for each PCI bus in the system when it's probed */
Linus Torvalds's avatar
Linus Torvalds committed
74
	void (*pcibios_fixup_bus)(struct pci_bus *);
Linus Torvalds's avatar
Linus Torvalds committed
75 76 77 78

	/* Called when pci_enable_device() is called (initial=0) or
	 * when a device with no assigned resource is found (initial=1).
	 * Returns 0 to allow assignment/enabling of the device. */
Linus Torvalds's avatar
Linus Torvalds committed
79
	int  (*pcibios_enable_device_hook)(struct pci_dev *, int initial);
Linus Torvalds's avatar
Linus Torvalds committed
80

Linus Torvalds's avatar
Linus Torvalds committed
81 82 83 84 85 86 87
	/* For interrupt routing */
	unsigned char (*pci_swizzle)(struct pci_dev *, unsigned char *);
	int (*pci_map_irq)(struct pci_dev *, unsigned char, unsigned char);

	/* Called in indirect_* to avoid touching devices */
	int (*pci_exclude_device)(unsigned char, unsigned char);

Linus Torvalds's avatar
Linus Torvalds committed
88
	/* Called at then very end of pcibios_init() */
Linus Torvalds's avatar
Linus Torvalds committed
89 90
	void (*pcibios_after_init)(void);

Linus Torvalds's avatar
Linus Torvalds committed
91 92
	/* this is for modules, since _machine can be a define -- Cort */
	int ppc_machine;
Linus Torvalds's avatar
Linus Torvalds committed
93

94 95 96 97
	/* Motherboard/chipset features. This is a kind of general purpose
	 * hook used to control some machine specific features (like reset
	 * lines, chip power control, etc...).
	 */
98
	long (*feature_call)(unsigned int feature, ...);
99

Linus Torvalds's avatar
Linus Torvalds committed
100 101 102 103
#ifdef CONFIG_SMP
	/* functions for dealing with other cpus */
	struct smp_ops_t *smp_ops;
#endif /* CONFIG_SMP */
Linus Torvalds's avatar
Linus Torvalds committed
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
};

extern struct machdep_calls ppc_md;
extern char cmd_line[512];

extern void setup_pci_ptrs(void);

/*
 * Power macintoshes have either a CUDA or a PMU controlling
 * system reset, power, NVRAM, RTC.
 */
typedef enum sys_ctrler_kind {
	SYS_CTRLER_UNKNOWN = 0,
	SYS_CTRLER_CUDA = 1,
	SYS_CTRLER_PMU = 2,
} sys_ctrler_t;

extern sys_ctrler_t sys_ctrler;

Linus Torvalds's avatar
Linus Torvalds committed
123 124 125 126 127 128
#ifdef CONFIG_SMP
struct smp_ops_t {
	void  (*message_pass)(int target, int msg, unsigned long data, int wait);
	int   (*probe)(void);
	void  (*kick_cpu)(int nr);
	void  (*setup_cpu)(int nr);
129 130 131
	void  (*space_timers)(int nr);
	void  (*take_timebase)(void);
	void  (*give_timebase)(void);
Linus Torvalds's avatar
Linus Torvalds committed
132
};
133 134 135 136

/* Poor default implementations */
extern void __devinit smp_generic_give_timebase(void);
extern void __devinit smp_generic_take_timebase(void);
Linus Torvalds's avatar
Linus Torvalds committed
137 138
#endif /* CONFIG_SMP */

Linus Torvalds's avatar
Linus Torvalds committed
139 140
#endif /* _PPC_MACHDEP_H */
#endif /* __KERNEL__ */