Merge branch 'for-linus' of git://oss.sgi.com:8090/xfs/xfs-2.6
[pv_ops_mirror.git] / include / asm-mips / sgialib.h
blobbfce5c786f1c2772c0a5515c3e10b62b7e6d6185
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.
6 * SGI ARCS firmware interface library for the Linux kernel.
8 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
9 * Copyright (C) 2001, 2002 Ralf Baechle (ralf@gnu.org)
11 #ifndef _ASM_SGIALIB_H
12 #define _ASM_SGIALIB_H
14 #include <asm/sgiarcs.h>
16 extern struct linux_romvec *romvec;
17 extern int prom_argc;
19 extern LONG *_prom_argv, *_prom_envp;
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)])
26 extern int prom_flags;
28 #define PROM_FLAG_ARCS 1
29 #define PROM_FLAG_USE_AS_CONSOLE 2
30 #define PROM_FLAG_DONT_FREE_TEMP 4
32 /* Simple char-by-char console I/O. */
33 extern void prom_putchar(char c);
34 extern char prom_getchar(void);
36 /* Memory descriptor management. */
37 #define PROM_MAX_PMEMBLOCKS 32
38 struct prom_pmemblock {
39 LONG base; /* Within KSEG0 or XKPHYS. */
40 ULONG size; /* In bytes. */
41 ULONG type; /* free or prom memory */
44 /* Get next memory descriptor after CURR, returns first descriptor
45 * in chain is CURR is NULL.
47 extern struct linux_mdesc *prom_getmdesc(struct linux_mdesc *curr);
48 #define PROM_NULL_MDESC ((struct linux_mdesc *) 0)
50 /* Called by prom_init to setup the physical memory pmemblock
51 * array.
53 extern void prom_meminit(void);
54 extern void prom_fixup_mem_map(unsigned long start_mem, unsigned long end_mem);
56 /* PROM device tree library routines. */
57 #define PROM_NULL_COMPONENT ((pcomponent *) 0)
59 /* Get sibling component of THIS. */
60 extern pcomponent *ArcGetPeer(pcomponent *this);
62 /* Get child component of THIS. */
63 extern pcomponent *ArcGetChild(pcomponent *this);
65 /* Get parent component of CHILD. */
66 extern pcomponent *prom_getparent(pcomponent *child);
68 /* Copy component opaque data of component THIS into BUFFER
69 * if component THIS has opaque data. Returns success or
70 * failure status.
72 extern long prom_getcdata(void *buffer, pcomponent *this);
74 /* Other misc. component routines. */
75 extern pcomponent *prom_childadd(pcomponent *this, pcomponent *tmp, void *data);
76 extern long prom_delcomponent(pcomponent *this);
77 extern pcomponent *prom_componentbypath(char *path);
79 /* This is called at prom_init time to identify the
80 * ARC architecture we are running on
82 extern void prom_identify_arch(void);
84 /* Environment variable routines. */
85 extern PCHAR ArcGetEnvironmentVariable(PCHAR name);
86 extern LONG ArcSetEnvironmentVariable(PCHAR name, PCHAR value);
88 /* ARCS command line acquisition and parsing. */
89 extern char *prom_getcmdline(void);
90 extern void prom_init_cmdline(void);
92 /* Acquiring info about the current time, etc. */
93 extern struct linux_tinfo *prom_gettinfo(void);
94 extern unsigned long prom_getrtime(void);
96 /* File operations. */
97 extern long prom_getvdirent(unsigned long fd, struct linux_vdirent *ent, unsigned long num, unsigned long *cnt);
98 extern long prom_open(char *name, enum linux_omode md, unsigned long *fd);
99 extern long prom_close(unsigned long fd);
100 extern LONG ArcRead(ULONG fd, PVOID buf, ULONG num, PULONG cnt);
101 extern long prom_getrstatus(unsigned long fd);
102 extern LONG ArcWrite(ULONG fd, PVOID buf, ULONG num, PULONG cnt);
103 extern long prom_seek(unsigned long fd, struct linux_bigint *off, enum linux_seekmode sm);
104 extern long prom_mount(char *name, enum linux_mountops op);
105 extern long prom_getfinfo(unsigned long fd, struct linux_finfo *buf);
106 extern long prom_setfinfo(unsigned long fd, unsigned long flags, unsigned long msk);
108 /* Running stand-along programs. */
109 extern long prom_load(char *name, unsigned long end, unsigned long *pc, unsigned long *eaddr);
110 extern long prom_invoke(unsigned long pc, unsigned long sp, long argc, char **argv, char **envp);
111 extern long prom_exec(char *name, long argc, char **argv, char **envp);
113 /* Misc. routines. */
114 extern VOID prom_halt(VOID) __attribute__((noreturn));
115 extern VOID prom_powerdown(VOID) __attribute__((noreturn));
116 extern VOID prom_restart(VOID) __attribute__((noreturn));
117 extern VOID ArcReboot(VOID) __attribute__((noreturn));
118 extern VOID ArcEnterInteractiveMode(VOID) __attribute__((noreturn));
119 extern long prom_cfgsave(VOID);
120 extern struct linux_sysid *prom_getsysid(VOID);
121 extern VOID ArcFlushAllCaches(VOID);
122 extern DISPLAY_STATUS *ArcGetDisplayStatus(ULONG FileID);
124 #endif /* _ASM_SGIALIB_H */