xref: /openbmc/linux/arch/mips/include/asm/fw/fw.h (revision 8c0b9ee8)
1 /*
2  * This file is subject to the terms and conditions of the GNU General Public
3  * License.  See the file "COPYING" in the main directory of this archive
4  * for more details.
5  *
6  * Copyright (C) 2012 MIPS Technologies, Inc.
7  */
8 #ifndef __ASM_FW_H_
9 #define __ASM_FW_H_
10 
11 #include <asm/bootinfo.h>	/* For cleaner code... */
12 
13 enum fw_memtypes {
14 	fw_dontuse,
15 	fw_code,
16 	fw_free,
17 };
18 
19 typedef struct {
20 	unsigned long base;	/* Within KSEG0 */
21 	unsigned int size;	/* bytes */
22 	enum fw_memtypes type;	/* fw_memtypes */
23 } fw_memblock_t;
24 
25 /* Maximum number of memory block descriptors. */
26 #define FW_MAX_MEMBLOCKS	32
27 
28 extern int fw_argc;
29 extern int *_fw_argv;
30 extern int *_fw_envp;
31 
32 /*
33  * Most firmware like YAMON, PMON, etc. pass arguments and environment
34  * variables as 32-bit pointers. These take care of sign extension.
35  */
36 #define fw_argv(index)		((char *)(long)_fw_argv[(index)])
37 #define fw_envp(index)		((char *)(long)_fw_envp[(index)])
38 
39 extern void fw_init_cmdline(void);
40 extern char *fw_getcmdline(void);
41 extern fw_memblock_t *fw_getmdesc(int);
42 extern void fw_meminit(void);
43 extern char *fw_getenv(char *name);
44 extern unsigned long fw_getenvl(char *name);
45 extern void fw_init_early_console(char port);
46 
47 #endif /* __ASM_FW_H_ */
48