sgialib.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:5k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

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