1 |
1275 |
phoenix |
/*
|
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 |
|
|
* SGI ARCS firmware interface library for the Linux kernel.
|
7 |
|
|
*
|
8 |
|
|
* Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
|
9 |
|
|
* Copyright (C) 2001, 2002 Ralf Baechle (ralf@gnu.org)
|
10 |
|
|
*/
|
11 |
|
|
#ifndef _ASM_SGIALIB_H
|
12 |
|
|
#define _ASM_SGIALIB_H
|
13 |
|
|
|
14 |
|
|
#include <asm/sgiarcs.h>
|
15 |
|
|
|
16 |
|
|
extern struct linux_romvec *romvec;
|
17 |
|
|
extern int prom_argc;
|
18 |
|
|
|
19 |
|
|
extern LONG *_prom_argv, *_prom_envp;
|
20 |
|
|
|
21 |
|
|
/* A 32-bit ARC PROM pass arguments and environment as 32-bit pointer.
|
22 |
|
|
These macros take care of sign extension. */
|
23 |
|
|
#define prom_argv(index) ((char *) (long) _prom_argv[(index)])
|
24 |
|
|
#define prom_argc(index) ((char *) (long) _prom_argc[(index)])
|
25 |
|
|
|
26 |
|
|
extern int prom_flags;
|
27 |
|
|
|
28 |
|
|
#define PROM_FLAG_ARCS 1
|
29 |
|
|
#define PROM_FLAG_USE_AS_CONSOLE 2
|
30 |
|
|
#define PROM_FLAG_DONT_FREE_TEMP 4
|
31 |
|
|
|
32 |
|
|
/* Init the PROM library and it's internal data structures. */
|
33 |
|
|
extern void prom_init(int argc, char **argv, char **envp, int *prom_vec);
|
34 |
|
|
|
35 |
|
|
/* Simple char-by-char console I/O. */
|
36 |
|
|
extern void prom_putchar(char c);
|
37 |
|
|
extern char prom_getchar(void);
|
38 |
|
|
|
39 |
|
|
/* Generic printf() using ARCS console I/O. */
|
40 |
|
|
extern void prom_printf(char *fmt, ...);
|
41 |
|
|
|
42 |
|
|
/* Memory descriptor management. */
|
43 |
|
|
#define PROM_MAX_PMEMBLOCKS 32
|
44 |
|
|
struct prom_pmemblock {
|
45 |
|
|
LONG base; /* Within KSEG0 or XKPHYS. */
|
46 |
|
|
ULONG size; /* In bytes. */
|
47 |
|
|
ULONG type; /* free or prom memory */
|
48 |
|
|
};
|
49 |
|
|
|
50 |
|
|
/* Get next memory descriptor after CURR, returns first descriptor
|
51 |
|
|
* in chain is CURR is NULL.
|
52 |
|
|
*/
|
53 |
|
|
extern struct linux_mdesc *prom_getmdesc(struct linux_mdesc *curr);
|
54 |
|
|
#define PROM_NULL_MDESC ((struct linux_mdesc *) 0)
|
55 |
|
|
|
56 |
|
|
/* Called by prom_init to setup the physical memory pmemblock
|
57 |
|
|
* array.
|
58 |
|
|
*/
|
59 |
|
|
extern void prom_meminit(void);
|
60 |
|
|
extern void prom_fixup_mem_map(unsigned long start_mem, unsigned long end_mem);
|
61 |
|
|
|
62 |
|
|
/* PROM device tree library routines. */
|
63 |
|
|
#define PROM_NULL_COMPONENT ((pcomponent *) 0)
|
64 |
|
|
|
65 |
|
|
/* Get sibling component of THIS. */
|
66 |
|
|
extern pcomponent *ArcGetPeer(pcomponent *this);
|
67 |
|
|
|
68 |
|
|
/* Get child component of THIS. */
|
69 |
|
|
extern pcomponent *ArcGetChild(pcomponent *this);
|
70 |
|
|
|
71 |
|
|
/* Get parent component of CHILD. */
|
72 |
|
|
extern pcomponent *prom_getparent(pcomponent *child);
|
73 |
|
|
|
74 |
|
|
/* Copy component opaque data of component THIS into BUFFER
|
75 |
|
|
* if component THIS has opaque data. Returns success or
|
76 |
|
|
* failure status.
|
77 |
|
|
*/
|
78 |
|
|
extern long prom_getcdata(void *buffer, pcomponent *this);
|
79 |
|
|
|
80 |
|
|
/* Other misc. component routines. */
|
81 |
|
|
extern pcomponent *prom_childadd(pcomponent *this, pcomponent *tmp, void *data);
|
82 |
|
|
extern long prom_delcomponent(pcomponent *this);
|
83 |
|
|
extern pcomponent *prom_componentbypath(char *path);
|
84 |
|
|
|
85 |
|
|
/* This is called at prom_init time to identify the
|
86 |
|
|
* ARC architecture we are running on
|
87 |
|
|
*/
|
88 |
|
|
extern void prom_identify_arch(void);
|
89 |
|
|
|
90 |
|
|
/* Environment variable routines. */
|
91 |
|
|
extern PCHAR ArcGetEnvironmentVariable(PCHAR name);
|
92 |
|
|
extern LONG ArcSetEnvironmentVariable(PCHAR name, PCHAR value);
|
93 |
|
|
|
94 |
|
|
/* ARCS command line acquisition and parsing. */
|
95 |
|
|
extern char *prom_getcmdline(void);
|
96 |
|
|
extern void prom_init_cmdline(void);
|
97 |
|
|
|
98 |
|
|
/* Acquiring info about the current time, etc. */
|
99 |
|
|
extern struct linux_tinfo *prom_gettinfo(void);
|
100 |
|
|
extern unsigned long prom_getrtime(void);
|
101 |
|
|
|
102 |
|
|
/* File operations. */
|
103 |
|
|
extern long prom_getvdirent(unsigned long fd, struct linux_vdirent *ent, unsigned long num, unsigned long *cnt);
|
104 |
|
|
extern long prom_open(char *name, enum linux_omode md, unsigned long *fd);
|
105 |
|
|
extern long prom_close(unsigned long fd);
|
106 |
|
|
extern LONG ArcRead(ULONG fd, PVOID buf, ULONG num, PULONG cnt);
|
107 |
|
|
extern long prom_getrstatus(unsigned long fd);
|
108 |
|
|
extern LONG ArcWrite(ULONG fd, PVOID buf, ULONG num, PULONG cnt);
|
109 |
|
|
extern long prom_seek(unsigned long fd, struct linux_bigint *off, enum linux_seekmode sm);
|
110 |
|
|
extern long prom_mount(char *name, enum linux_mountops op);
|
111 |
|
|
extern long prom_getfinfo(unsigned long fd, struct linux_finfo *buf);
|
112 |
|
|
extern long prom_setfinfo(unsigned long fd, unsigned long flags, unsigned long msk);
|
113 |
|
|
|
114 |
|
|
/* Running stand-along programs. */
|
115 |
|
|
extern long prom_load(char *name, unsigned long end, unsigned long *pc, unsigned long *eaddr);
|
116 |
|
|
extern long prom_invoke(unsigned long pc, unsigned long sp, long argc, char **argv, char **envp);
|
117 |
|
|
extern long prom_exec(char *name, long argc, char **argv, char **envp);
|
118 |
|
|
|
119 |
|
|
/* Misc. routines. */
|
120 |
|
|
extern VOID prom_halt(VOID) __attribute__((noreturn));
|
121 |
|
|
extern VOID prom_powerdown(VOID) __attribute__((noreturn));
|
122 |
|
|
extern VOID prom_restart(VOID) __attribute__((noreturn));
|
123 |
|
|
extern VOID ArcReboot(VOID) __attribute__((noreturn));
|
124 |
|
|
extern VOID ArcEnterInteractiveMode(VOID) __attribute__((noreturn));
|
125 |
|
|
extern long prom_cfgsave(VOID);
|
126 |
|
|
extern struct linux_sysid *prom_getsysid(VOID);
|
127 |
|
|
extern VOID ArcFlushAllCaches(VOID);
|
128 |
|
|
|
129 |
|
|
#endif /* _ASM_SGIALIB_H */
|