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