1#ifdef __KERNEL__
2#ifndef _PPC_MACHDEP_H
3#define _PPC_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
14struct pt_regs;
15struct pci_bus;
16struct pci_dev;
17struct kbd_repeat;
18struct device_node;
19struct TceTable;
20struct rtc_time;
21
22struct machdep_calls {
23	void            (*hpte_invalidate)(unsigned long slot,
24					   unsigned long secondary,
25					   unsigned long va,
26					   int large, int local);
27	long            (*hpte_updatepp)(unsigned long slot,
28					 unsigned long secondary,
29					 unsigned long newpp,
30					 unsigned long va,
31					 int large);
32	void            (*hpte_updateboltedpp)(unsigned long newpp,
33					       unsigned long ea);
34	long		(*hpte_insert)(unsigned long vpn,
35				       unsigned long prpn,
36				       unsigned long hpteflags,
37				       int bolted,
38				       int large);
39	long		(*hpte_remove)(unsigned long hpte_group);
40
41	void		(*tce_build)(struct TceTable * tbl,
42				     long tcenum,
43				     unsigned long uaddr,
44				     int direction);
45	void		(*tce_free_one)(struct TceTable *tbl,
46				        long tcenum);
47
48	void		(*smp_message_pass)(int target,
49					    int msg,
50					    unsigned long data,
51					    int wait);
52	int		(*smp_probe)(void);
53	void		(*smp_kick_cpu)(int nr);
54	void		(*smp_setup_cpu)(int nr);
55
56	void		(*setup_arch)(void);
57	/* Optional, may be NULL. */
58	void		(*setup_residual)(struct seq_file *m, int cpu_id);
59	/* Optional, may be NULL. */
60	void		(*get_cpuinfo)(struct seq_file *m);
61	/* Optional, may be NULL. */
62	unsigned int	(*irq_cannonicalize)(unsigned int irq);
63	void		(*init_IRQ)(void);
64	void		(*init_ras_IRQ)(void);
65	int		(*get_irq)(struct pt_regs *);
66
67	/* A general init function, called by ppc_init in init/main.c.
68	   May be NULL. */
69	void		(*init)(void);
70
71	void		(*restart)(char *cmd);
72	void		(*power_off)(void);
73	void		(*halt)(void);
74
75	long		(*time_init)(void); /* Optional, may be NULL */
76	int		(*set_rtc_time)(struct rtc_time *);
77	void		(*get_rtc_time)(struct rtc_time *);
78	void		(*get_boot_time)(struct rtc_time *);
79	void		(*calibrate_decr)(void);
80
81  	void		(*progress)(char *, unsigned short);
82
83
84	unsigned char 	(*nvram_read_val)(int addr);
85	void		(*nvram_write_val)(int addr, unsigned char val);
86
87/* Tons of keyboard stuff. */
88	int		(*kbd_setkeycode)(unsigned int scancode,
89				unsigned int keycode);
90	int		(*kbd_getkeycode)(unsigned int scancode);
91	int		(*kbd_translate)(unsigned char scancode,
92				unsigned char *keycode,
93				char raw_mode);
94	char		(*kbd_unexpected_up)(unsigned char keycode);
95	void		(*kbd_leds)(unsigned char leds);
96	void		(*kbd_init_hw)(void);
97#ifdef CONFIG_MAGIC_SYSRQ
98	unsigned char 	*ppc_kbd_sysrq_xlate;
99#endif
100
101	/* Debug interface.  Low level I/O to some terminal device */
102	void		(*udbg_putc)(unsigned char c);
103	unsigned char	(*udbg_getc)(void);
104	int		(*udbg_getc_poll)(void);
105
106	/* PCI interfaces */
107	int (*pcibios_read_config_byte)(struct device_node *dn, int offset, u8 *val);
108	int (*pcibios_read_config_word)(struct device_node *dn, int offset, u16 *val);
109	int (*pcibios_read_config_dword)(struct device_node *dn, int offset, u32 *val);
110	int (*pcibios_write_config_byte)(struct device_node *dn, int offset, u8 val);
111	int (*pcibios_write_config_word)(struct device_node *dn, int offset, u16 val);
112	int (*pcibios_write_config_dword)(struct device_node *dn, int offset, u32 val);
113
114	/* Called after scanning the bus, before allocating
115	 * resources
116	 */
117	void (*pcibios_fixup)(void);
118
119       /* Called for each PCI bus in the system
120        * when it's probed
121        */
122	void (*pcibios_fixup_bus)(struct pci_bus *);
123
124       /* Called when pci_enable_device() is called (initial=0) or
125        * when a device with no assigned resource is found (initial=1).
126        * Returns 0 to allow assignement/enabling of the device
127        */
128        int  (*pcibios_enable_device_hook)(struct pci_dev *, int initial);
129
130	void* (*pci_dev_io_base)(unsigned char bus, unsigned char devfn, int physical);
131	void* (*pci_dev_mem_base)(unsigned char bus, unsigned char devfn);
132	int (*pci_dev_root_bridge)(unsigned char bus, unsigned char devfn);
133
134	/* this is for modules, since _machine can be a define -- Cort */
135	int ppc_machine;
136};
137
138extern struct machdep_calls ppc_md;
139extern char cmd_line[512];
140
141extern void setup_pci_ptrs(void);
142
143
144/* Functions to produce codes on the leds.
145 * The SRC code should be unique for the message category and should
146 * be limited to the lower 24 bits (the upper 8 are set by these funcs),
147 * and (for boot & dump) should be sorted numerically in the order
148 * the events occur.
149 */
150/* Print a boot progress message. */
151void ppc64_boot_msg(unsigned int src, const char *msg);
152/* Print a termination message (print only -- does not stop the kernel) */
153void ppc64_terminate_msg(unsigned int src, const char *msg);
154/* Print something that needs attention (device error, etc) */
155void ppc64_attention_msg(unsigned int src, const char *msg);
156/* Print a dump progress message. */
157void ppc64_dump_msg(unsigned int src, const char *msg);
158
159
160#endif /* _PPC_MACHDEP_H */
161#endif /* __KERNEL__ */
162