prom.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /*
  2. * PROM interface routines.
  3. */
  4. #include <linux/types.h>
  5. #include <linux/init.h>
  6. #include <linux/string.h>
  7. #include <linux/ctype.h>
  8. #include <linux/kernel.h>
  9. #include <linux/mm.h>
  10. #include <linux/bootmem.h>
  11. #include <linux/ioport.h>
  12. #include <asm/bootinfo.h>
  13. #include <asm/lasat/lasat.h>
  14. #include <asm/cpu.h>
  15. #include "at93c.h"
  16. #include <asm/lasat/eeprom.h>
  17. #include "prom.h"
  18. #define RESET_VECTOR 0xbfc00000
  19. #define PROM_JUMP_TABLE_ENTRY(n) (*((u32 *)(RESET_VECTOR + 0x20) + n))
  20. #define PROM_DISPLAY_ADDR PROM_JUMP_TABLE_ENTRY(0)
  21. #define PROM_PUTC_ADDR PROM_JUMP_TABLE_ENTRY(1)
  22. #define PROM_MONITOR_ADDR PROM_JUMP_TABLE_ENTRY(2)
  23. static void null_prom_display(const char *string, int pos, int clear)
  24. {
  25. }
  26. static void null_prom_monitor(void)
  27. {
  28. }
  29. static void null_prom_putc(char c)
  30. {
  31. }
  32. /* these are functions provided by the bootloader */
  33. static void (*__prom_putc)(char c) = null_prom_putc;
  34. void prom_putchar(char c)
  35. {
  36. __prom_putc(c);
  37. }
  38. void (*prom_display)(const char *string, int pos, int clear) =
  39. null_prom_display;
  40. void (*prom_monitor)(void) = null_prom_monitor;
  41. unsigned int lasat_ndelay_divider;
  42. static void setup_prom_vectors(void)
  43. {
  44. u32 version = *(u32 *)(RESET_VECTOR + 0x90);
  45. if (version >= 307) {
  46. prom_display = (void *)PROM_DISPLAY_ADDR;
  47. __prom_putc = (void *)PROM_PUTC_ADDR;
  48. prom_monitor = (void *)PROM_MONITOR_ADDR;
  49. }
  50. printk(KERN_DEBUG "prom vectors set up\n");
  51. }
  52. static struct at93c_defs at93c_defs[N_MACHTYPES] = {
  53. {
  54. .reg = (void *)AT93C_REG_100,
  55. .rdata_reg = (void *)AT93C_RDATA_REG_100,
  56. .rdata_shift = AT93C_RDATA_SHIFT_100,
  57. .wdata_shift = AT93C_WDATA_SHIFT_100,
  58. .cs = AT93C_CS_M_100,
  59. .clk = AT93C_CLK_M_100
  60. }, {
  61. .reg = (void *)AT93C_REG_200,
  62. .rdata_reg = (void *)AT93C_RDATA_REG_200,
  63. .rdata_shift = AT93C_RDATA_SHIFT_200,
  64. .wdata_shift = AT93C_WDATA_SHIFT_200,
  65. .cs = AT93C_CS_M_200,
  66. .clk = AT93C_CLK_M_200
  67. },
  68. };
  69. void __init prom_init(void)
  70. {
  71. int argc = fw_arg0;
  72. char **argv = (char **) fw_arg1;
  73. setup_prom_vectors();
  74. if (IS_LASAT_200()) {
  75. printk(KERN_INFO "LASAT 200 board\n");
  76. lasat_ndelay_divider = LASAT_200_DIVIDER;
  77. at93c = &at93c_defs[1];
  78. } else {
  79. printk(KERN_INFO "LASAT 100 board\n");
  80. lasat_ndelay_divider = LASAT_100_DIVIDER;
  81. at93c = &at93c_defs[0];
  82. }
  83. lasat_init_board_info(); /* Read info from EEPROM */
  84. /* Get the command line */
  85. if (argc > 0) {
  86. strncpy(arcs_cmdline, argv[0], COMMAND_LINE_SIZE-1);
  87. arcs_cmdline[COMMAND_LINE_SIZE-1] = '\0';
  88. }
  89. /* Set the I/O base address */
  90. set_io_port_base(KSEG1);
  91. /* Set memory regions */
  92. ioport_resource.start = 0;
  93. ioport_resource.end = 0xffffffff; /* Wrong, fixme. */
  94. add_memory_region(0, lasat_board_info.li_memsize, BOOT_MEM_RAM);
  95. }
  96. void __init prom_free_prom_memory(void)
  97. {
  98. }
  99. const char *get_system_type(void)
  100. {
  101. return lasat_board_info.li_bmstr;
  102. }