blob: 1384dd0964b91c117ea508aa56dd74332445213f [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * include/asm-mips/dec/prom.h
3 *
4 * DECstation PROM interface.
5 *
6 * Copyright (C) 2002 Maciej W. Rozycki
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 *
13 * Based on arch/mips/dec/prom/prom.h by the Anonymous.
14 */
15#ifndef _ASM_DEC_PROM_H
16#define _ASM_DEC_PROM_H
17
18#include <linux/config.h>
19#include <linux/types.h>
20
21#include <asm/addrspace.h>
22
23/*
24 * PMAX/3MAX PROM entry points for DS2100/3100's and DS5000/2xx's.
25 * Many of these will work for MIPSen as well!
26 */
Maciej W. Rozycki3bd4c902005-06-16 20:30:54 +000027#define VEC_RESET (u64 *)CKSEG1ADDR(0x1fc00000)
Linus Torvalds1da177e2005-04-16 15:20:36 -070028 /* Prom base address */
29
30#define PMAX_PROM_ENTRY(x) (VEC_RESET + (x)) /* Prom jump table */
31
32#define PMAX_PROM_HALT PMAX_PROM_ENTRY(2) /* valid on MIPSen */
33#define PMAX_PROM_AUTOBOOT PMAX_PROM_ENTRY(5) /* valid on MIPSen */
34#define PMAX_PROM_OPEN PMAX_PROM_ENTRY(6)
35#define PMAX_PROM_READ PMAX_PROM_ENTRY(7)
36#define PMAX_PROM_CLOSE PMAX_PROM_ENTRY(10)
37#define PMAX_PROM_LSEEK PMAX_PROM_ENTRY(11)
38#define PMAX_PROM_GETCHAR PMAX_PROM_ENTRY(12)
39#define PMAX_PROM_PUTCHAR PMAX_PROM_ENTRY(13) /* 12 on MIPSen */
40#define PMAX_PROM_GETS PMAX_PROM_ENTRY(15)
41#define PMAX_PROM_PRINTF PMAX_PROM_ENTRY(17)
42#define PMAX_PROM_GETENV PMAX_PROM_ENTRY(33) /* valid on MIPSen */
43
44
45/*
46 * Magic number indicating REX PROM available on DECstation. Found in
47 * register a2 on transfer of control to program from PROM.
48 */
49#define REX_PROM_MAGIC 0x30464354
50
Ralf Baechle875d43e2005-09-03 15:56:16 -070051#ifdef CONFIG_64BIT
Linus Torvalds1da177e2005-04-16 15:20:36 -070052
53#define prom_is_rex(magic) 1 /* KN04 and KN05 are REX PROMs. */
54
Ralf Baechle875d43e2005-09-03 15:56:16 -070055#else /* !CONFIG_64BIT */
Linus Torvalds1da177e2005-04-16 15:20:36 -070056
57#define prom_is_rex(magic) ((magic) == REX_PROM_MAGIC)
58
Ralf Baechle875d43e2005-09-03 15:56:16 -070059#endif /* !CONFIG_64BIT */
Linus Torvalds1da177e2005-04-16 15:20:36 -070060
61
62/*
63 * 3MIN/MAXINE PROM entry points for DS5000/1xx's, DS5000/xx's and
64 * DS5000/2x0.
65 */
66#define REX_PROM_GETBITMAP 0x84/4 /* get mem bitmap */
67#define REX_PROM_GETCHAR 0x24/4 /* getch() */
68#define REX_PROM_GETENV 0x64/4 /* get env. variable */
69#define REX_PROM_GETSYSID 0x80/4 /* get system id */
70#define REX_PROM_GETTCINFO 0xa4/4
71#define REX_PROM_PRINTF 0x30/4 /* printf() */
72#define REX_PROM_SLOTADDR 0x6c/4 /* slotaddr */
73#define REX_PROM_BOOTINIT 0x54/4 /* open() */
74#define REX_PROM_BOOTREAD 0x58/4 /* read() */
75#define REX_PROM_CLEARCACHE 0x7c/4
76
77
78/*
79 * Used by rex_getbitmap().
80 */
81typedef struct {
82 int pagesize;
83 unsigned char bitmap[0];
84} memmap;
85
86
87/*
88 * Function pointers as read from a PROM's callback vector.
89 */
90extern int (*__rex_bootinit)(void);
91extern int (*__rex_bootread)(void);
92extern int (*__rex_getbitmap)(memmap *);
93extern unsigned long *(*__rex_slot_address)(int);
94extern void *(*__rex_gettcinfo)(void);
95extern int (*__rex_getsysid)(void);
96extern void (*__rex_clear_cache)(void);
97
98extern int (*__prom_getchar)(void);
99extern char *(*__prom_getenv)(char *);
100extern int (*__prom_printf)(char *, ...);
101
102extern int (*__pmax_open)(char*, int);
103extern int (*__pmax_lseek)(int, long, int);
104extern int (*__pmax_read)(int, void *, int);
105extern int (*__pmax_close)(int);
106
107
Ralf Baechle875d43e2005-09-03 15:56:16 -0700108#ifdef CONFIG_64BIT
Linus Torvalds1da177e2005-04-16 15:20:36 -0700109
110/*
111 * On MIPS64 we have to call PROM functions via a helper
112 * dispatcher to accomodate ABI incompatibilities.
113 */
Maciej W. Rozyckia76f9fe2005-06-16 20:35:48 +0000114#define __DEC_PROM_O32(fun, arg) fun arg __asm__(#fun); \
115 __asm__(#fun " = call_o32")
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116
Maciej W. Rozyckia76f9fe2005-06-16 20:35:48 +0000117int __DEC_PROM_O32(_rex_bootinit, (int (*)(void)));
118int __DEC_PROM_O32(_rex_bootread, (int (*)(void)));
119int __DEC_PROM_O32(_rex_getbitmap, (int (*)(memmap *), memmap *));
120unsigned long *__DEC_PROM_O32(_rex_slot_address,
121 (unsigned long *(*)(int), int));
122void *__DEC_PROM_O32(_rex_gettcinfo, (void *(*)(void)));
123int __DEC_PROM_O32(_rex_getsysid, (int (*)(void)));
124void __DEC_PROM_O32(_rex_clear_cache, (void (*)(void)));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700125
Maciej W. Rozyckia76f9fe2005-06-16 20:35:48 +0000126int __DEC_PROM_O32(_prom_getchar, (int (*)(void)));
127char *__DEC_PROM_O32(_prom_getenv, (char *(*)(char *), char *));
128int __DEC_PROM_O32(_prom_printf, (int (*)(char *, ...), char *, ...));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700129
130
131#define rex_bootinit() _rex_bootinit(__rex_bootinit)
132#define rex_bootread() _rex_bootread(__rex_bootread)
133#define rex_getbitmap(x) _rex_getbitmap(__rex_getbitmap, x)
134#define rex_slot_address(x) _rex_slot_address(__rex_slot_address, x)
135#define rex_gettcinfo() _rex_gettcinfo(__rex_gettcinfo)
136#define rex_getsysid() _rex_getsysid(__rex_getsysid)
137#define rex_clear_cache() _rex_clear_cache(__rex_clear_cache)
138
139#define prom_getchar() _prom_getchar(__prom_getchar)
140#define prom_getenv(x) _prom_getenv(__prom_getenv, x)
141#define prom_printf(x...) _prom_printf(__prom_printf, x)
142
Ralf Baechle875d43e2005-09-03 15:56:16 -0700143#else /* !CONFIG_64BIT */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144
145/*
146 * On plain MIPS we just call PROM functions directly.
147 */
148#define rex_bootinit __rex_bootinit
149#define rex_bootread __rex_bootread
150#define rex_getbitmap __rex_getbitmap
151#define rex_slot_address __rex_slot_address
152#define rex_gettcinfo __rex_gettcinfo
153#define rex_getsysid __rex_getsysid
154#define rex_clear_cache __rex_clear_cache
155
156#define prom_getchar __prom_getchar
157#define prom_getenv __prom_getenv
158#define prom_printf __prom_printf
159
160#define pmax_open __pmax_open
161#define pmax_lseek __pmax_lseek
162#define pmax_read __pmax_read
163#define pmax_close __pmax_close
164
Ralf Baechle875d43e2005-09-03 15:56:16 -0700165#endif /* !CONFIG_64BIT */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700166
167
168extern void prom_meminit(u32);
169extern void prom_identify_arch(u32);
170extern void prom_init_cmdline(s32, s32 *, u32);
171
172extern void register_prom_console(void);
173extern void unregister_prom_console(void);
174
175#endif /* _ASM_DEC_PROM_H */