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