prom.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. /*
  2. * include/asm-mips/dec/prom.h
  3. *
  4. * DECstation PROM interface.
  5. *
  6. * Copyright (C) 2002 Maciej W. Rozycki
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * as published by the Free Software Foundation; either version
  11. * 2 of the License, or (at your option) any later version.
  12. *
  13. * Based on arch/mips/dec/prom/prom.h by the Anonymous.
  14. */
  15. #ifndef _ASM_DEC_PROM_H
  16. #define _ASM_DEC_PROM_H
  17. #include <linux/config.h>
  18. #include <linux/types.h>
  19. #include <asm/addrspace.h>
  20. /*
  21. * PMAX/3MAX PROM entry points for DS2100/3100's and DS5000/2xx's.
  22. * Many of these will work for MIPSen as well!
  23. */
  24. #define VEC_RESET (u64 *)CKSEG1ADDR(0x1fc00000)
  25. /* Prom base address */
  26. #define PMAX_PROM_ENTRY(x) (VEC_RESET + (x)) /* Prom jump table */
  27. #define PMAX_PROM_HALT PMAX_PROM_ENTRY(2) /* valid on MIPSen */
  28. #define PMAX_PROM_AUTOBOOT PMAX_PROM_ENTRY(5) /* valid on MIPSen */
  29. #define PMAX_PROM_OPEN PMAX_PROM_ENTRY(6)
  30. #define PMAX_PROM_READ PMAX_PROM_ENTRY(7)
  31. #define PMAX_PROM_CLOSE PMAX_PROM_ENTRY(10)
  32. #define PMAX_PROM_LSEEK PMAX_PROM_ENTRY(11)
  33. #define PMAX_PROM_GETCHAR PMAX_PROM_ENTRY(12)
  34. #define PMAX_PROM_PUTCHAR PMAX_PROM_ENTRY(13) /* 12 on MIPSen */
  35. #define PMAX_PROM_GETS PMAX_PROM_ENTRY(15)
  36. #define PMAX_PROM_PRINTF PMAX_PROM_ENTRY(17)
  37. #define PMAX_PROM_GETENV PMAX_PROM_ENTRY(33) /* valid on MIPSen */
  38. /*
  39. * Magic number indicating REX PROM available on DECstation. Found in
  40. * register a2 on transfer of control to program from PROM.
  41. */
  42. #define REX_PROM_MAGIC 0x30464354
  43. #ifdef CONFIG_64BIT
  44. #define prom_is_rex(magic) 1 /* KN04 and KN05 are REX PROMs. */
  45. #else /* !CONFIG_64BIT */
  46. #define prom_is_rex(magic) ((magic) == REX_PROM_MAGIC)
  47. #endif /* !CONFIG_64BIT */
  48. /*
  49. * 3MIN/MAXINE PROM entry points for DS5000/1xx's, DS5000/xx's and
  50. * DS5000/2x0.
  51. */
  52. #define REX_PROM_GETBITMAP 0x84/4 /* get mem bitmap */
  53. #define REX_PROM_GETCHAR 0x24/4 /* getch() */
  54. #define REX_PROM_GETENV 0x64/4 /* get env. variable */
  55. #define REX_PROM_GETSYSID 0x80/4 /* get system id */
  56. #define REX_PROM_GETTCINFO 0xa4/4
  57. #define REX_PROM_PRINTF 0x30/4 /* printf() */
  58. #define REX_PROM_SLOTADDR 0x6c/4 /* slotaddr */
  59. #define REX_PROM_BOOTINIT 0x54/4 /* open() */
  60. #define REX_PROM_BOOTREAD 0x58/4 /* read() */
  61. #define REX_PROM_CLEARCACHE 0x7c/4
  62. /*
  63. * Used by rex_getbitmap().
  64. */
  65. typedef struct {
  66. int pagesize;
  67. unsigned char bitmap[0];
  68. } memmap;
  69. /*
  70. * Function pointers as read from a PROM's callback vector.
  71. */
  72. extern int (*__rex_bootinit)(void);
  73. extern int (*__rex_bootread)(void);
  74. extern int (*__rex_getbitmap)(memmap *);
  75. extern unsigned long *(*__rex_slot_address)(int);
  76. extern void *(*__rex_gettcinfo)(void);
  77. extern int (*__rex_getsysid)(void);
  78. extern void (*__rex_clear_cache)(void);
  79. extern int (*__prom_getchar)(void);
  80. extern char *(*__prom_getenv)(char *);
  81. extern int (*__prom_printf)(char *, ...);
  82. extern int (*__pmax_open)(char*, int);
  83. extern int (*__pmax_lseek)(int, long, int);
  84. extern int (*__pmax_read)(int, void *, int);
  85. extern int (*__pmax_close)(int);
  86. #ifdef CONFIG_64BIT
  87. /*
  88. * On MIPS64 we have to call PROM functions via a helper
  89. * dispatcher to accomodate ABI incompatibilities.
  90. */
  91. #define __DEC_PROM_O32(fun, arg) fun arg __asm__(#fun); \
  92. __asm__(#fun " = call_o32")
  93. int __DEC_PROM_O32(_rex_bootinit, (int (*)(void)));
  94. int __DEC_PROM_O32(_rex_bootread, (int (*)(void)));
  95. int __DEC_PROM_O32(_rex_getbitmap, (int (*)(memmap *), memmap *));
  96. unsigned long *__DEC_PROM_O32(_rex_slot_address,
  97. (unsigned long *(*)(int), int));
  98. void *__DEC_PROM_O32(_rex_gettcinfo, (void *(*)(void)));
  99. int __DEC_PROM_O32(_rex_getsysid, (int (*)(void)));
  100. void __DEC_PROM_O32(_rex_clear_cache, (void (*)(void)));
  101. int __DEC_PROM_O32(_prom_getchar, (int (*)(void)));
  102. char *__DEC_PROM_O32(_prom_getenv, (char *(*)(char *), char *));
  103. int __DEC_PROM_O32(_prom_printf, (int (*)(char *, ...), char *, ...));
  104. #define rex_bootinit() _rex_bootinit(__rex_bootinit)
  105. #define rex_bootread() _rex_bootread(__rex_bootread)
  106. #define rex_getbitmap(x) _rex_getbitmap(__rex_getbitmap, x)
  107. #define rex_slot_address(x) _rex_slot_address(__rex_slot_address, x)
  108. #define rex_gettcinfo() _rex_gettcinfo(__rex_gettcinfo)
  109. #define rex_getsysid() _rex_getsysid(__rex_getsysid)
  110. #define rex_clear_cache() _rex_clear_cache(__rex_clear_cache)
  111. #define prom_getchar() _prom_getchar(__prom_getchar)
  112. #define prom_getenv(x) _prom_getenv(__prom_getenv, x)
  113. #define prom_printf(x...) _prom_printf(__prom_printf, x)
  114. #else /* !CONFIG_64BIT */
  115. /*
  116. * On plain MIPS we just call PROM functions directly.
  117. */
  118. #define rex_bootinit __rex_bootinit
  119. #define rex_bootread __rex_bootread
  120. #define rex_getbitmap __rex_getbitmap
  121. #define rex_slot_address __rex_slot_address
  122. #define rex_gettcinfo __rex_gettcinfo
  123. #define rex_getsysid __rex_getsysid
  124. #define rex_clear_cache __rex_clear_cache
  125. #define prom_getchar __prom_getchar
  126. #define prom_getenv __prom_getenv
  127. #define prom_printf __prom_printf
  128. #define pmax_open __pmax_open
  129. #define pmax_lseek __pmax_lseek
  130. #define pmax_read __pmax_read
  131. #define pmax_close __pmax_close
  132. #endif /* !CONFIG_64BIT */
  133. extern void prom_meminit(u32);
  134. extern void prom_identify_arch(u32);
  135. extern void prom_init_cmdline(s32, s32 *, u32);
  136. extern void register_prom_console(void);
  137. extern void unregister_prom_console(void);
  138. #endif /* _ASM_DEC_PROM_H */