1 /* $Id: sgialib.h,v 1.3 1999/12/04 03:59:12 ralf Exp $
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
7 * SGI ARCS firmware interface library for the Linux kernel.
9 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
11 #ifndef _ASM_SGIALIB_H
12 #define _ASM_SGIALIB_H
14 #include <asm/sgiarcs.h>
16 extern PSYSTEM_PARAMETER_BLOCK sgi_pblock
;
17 extern struct linux_romvec
*romvec
;
20 extern LONG
*_prom_argv
, *_prom_envp
;
22 /* A 32-bit ARC PROM pass arguments and environment as 32-bit pointer.
23 These macros take care of sign extension. */
24 #define prom_argv(index) ((char *) (long) _prom_argv[(index)])
25 #define prom_argc(index) ((char *) (long) _prom_argc[(index)])
27 extern int prom_flags
;
28 #define PROM_FLAG_ARCS 1
30 /* Init the PROM library and it's internal data structures. Called
31 * at boot time from head.S before start_kernel is invoked.
33 extern int prom_init(int argc
, char **argv
, char **envp
);
35 /* Simple char-by-char console I/O. */
36 extern void prom_putchar(char c
);
37 extern char prom_getchar(void);
39 /* Generic printf() using ARCS console I/O. */
40 extern void prom_printf(char *fmt
, ...);
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 */
50 /* Get next memory descriptor after CURR, returns first descriptor
51 * in chain is CURR is NULL.
53 extern struct linux_mdesc
*prom_getmdesc(struct linux_mdesc
*curr
);
54 #define PROM_NULL_MDESC ((struct linux_mdesc *) 0)
56 /* Called by prom_init to setup the physical memory pmemblock
59 extern void prom_meminit(void);
60 extern void prom_fixup_mem_map(unsigned long start_mem
, unsigned long end_mem
);
62 /* Returns pointer to PROM physical memory block array. */
63 extern struct prom_pmemblock
*prom_getpblock_array(void);
65 /* PROM device tree library routines. */
66 #define PROM_NULL_COMPONENT ((pcomponent *) 0)
68 /* Get sibling component of THIS. */
69 extern pcomponent
*ArcGetPeer(pcomponent
*this);
71 /* Get child component of THIS. */
72 extern pcomponent
*ArcGetChild(pcomponent
*this);
74 /* Get parent component of CHILD. */
75 extern pcomponent
*prom_getparent(pcomponent
*child
);
77 /* Copy component opaque data of component THIS into BUFFER
78 * if component THIS has opaque data. Returns success or
81 extern long prom_getcdata(void *buffer
, pcomponent
*this);
83 /* Other misc. component routines. */
84 extern pcomponent
*prom_childadd(pcomponent
*this, pcomponent
*tmp
, void *data
);
85 extern long prom_delcomponent(pcomponent
*this);
86 extern pcomponent
*prom_componentbypath(char *path
);
88 /* This is called at prom_init time to identify the
89 * ARC architecture we are running on
91 extern void prom_identify_arch(void);
93 /* Environemt variable routines. */
94 extern PCHAR
ArcGetEnvironmentVariable(PCHAR name
);
95 extern LONG
SetEnvironmentVariable(PCHAR name
, PCHAR value
);
97 /* ARCS command line acquisition and parsing. */
98 extern char *prom_getcmdline(void);
99 extern void prom_init_cmdline(void);
101 /* Acquiring info about the current time, etc. */
102 extern struct linux_tinfo
*prom_gettinfo(void);
103 extern unsigned long prom_getrtime(void);
105 /* File operations. */
106 extern long prom_getvdirent(unsigned long fd
, struct linux_vdirent
*ent
, unsigned long num
, unsigned long *cnt
);
107 extern long prom_open(char *name
, enum linux_omode md
, unsigned long *fd
);
108 extern long prom_close(unsigned long fd
);
109 extern LONG
ArcRead(ULONG fd
, PVOID buf
, ULONG num
, PULONG cnt
);
110 extern long prom_getrstatus(unsigned long fd
);
111 extern LONG
ArcWrite(ULONG fd
, PVOID buf
, ULONG num
, PULONG cnt
);
112 extern long prom_seek(unsigned long fd
, struct linux_bigint
*off
, enum linux_seekmode sm
);
113 extern long prom_mount(char *name
, enum linux_mountops op
);
114 extern long prom_getfinfo(unsigned long fd
, struct linux_finfo
*buf
);
115 extern long prom_setfinfo(unsigned long fd
, unsigned long flags
, unsigned long msk
);
117 /* Running stand-along programs. */
118 extern long prom_load(char *name
, unsigned long end
, unsigned long *pc
, unsigned long *eaddr
);
119 extern long prom_invoke(unsigned long pc
, unsigned long sp
, long argc
, char **argv
, char **envp
);
120 extern long prom_exec(char *name
, long argc
, char **argv
, char **envp
);
122 /* Misc. routines. */
123 extern void prom_halt(VOID
) __attribute__((noreturn
));
124 extern void prom_powerdown(VOID
) __attribute__((noreturn
));
125 extern void prom_restart(VOID
) __attribute__((noreturn
));
126 extern VOID
ArcReboot(VOID
) __attribute__((noreturn
));
127 extern VOID
ArcEnterInteractiveMode(void) __attribute__((noreturn
));
128 extern long prom_cfgsave(VOID
);
129 extern struct linux_sysid
*prom_getsysid(VOID
);
130 extern VOID
ArcFlushAllCaches(VOID
);
132 #endif /* _ASM_SGIALIB_H */