sgialib.h 4.4 KB

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