prom.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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("prom vectors set up\n");
  51. }
  52. static struct at93c_defs at93c_defs[N_MACHTYPES] = {
  53. {(void *)AT93C_REG_100, (void *)AT93C_RDATA_REG_100, AT93C_RDATA_SHIFT_100,
  54. AT93C_WDATA_SHIFT_100, AT93C_CS_M_100, AT93C_CLK_M_100},
  55. {(void *)AT93C_REG_200, (void *)AT93C_RDATA_REG_200, AT93C_RDATA_SHIFT_200,
  56. AT93C_WDATA_SHIFT_200, AT93C_CS_M_200, AT93C_CLK_M_200},
  57. };
  58. void __init prom_init(void)
  59. {
  60. int argc = fw_arg0;
  61. char **argv = (char **) fw_arg1;
  62. setup_prom_vectors();
  63. if (current_cpu_data.cputype == CPU_R5000) {
  64. printk("LASAT 200 board\n");
  65. mips_machtype = MACH_LASAT_200;
  66. lasat_ndelay_divider = LASAT_200_DIVIDER;
  67. } else {
  68. printk("LASAT 100 board\n");
  69. mips_machtype = MACH_LASAT_100;
  70. lasat_ndelay_divider = LASAT_100_DIVIDER;
  71. }
  72. at93c = &at93c_defs[mips_machtype];
  73. lasat_init_board_info(); /* Read info from EEPROM */
  74. mips_machgroup = MACH_GROUP_LASAT;
  75. /* Get the command line */
  76. if (argc > 0) {
  77. strncpy(arcs_cmdline, argv[0], CL_SIZE-1);
  78. arcs_cmdline[CL_SIZE-1] = '\0';
  79. }
  80. /* Set the I/O base address */
  81. set_io_port_base(KSEG1);
  82. /* Set memory regions */
  83. ioport_resource.start = 0;
  84. ioport_resource.end = 0xffffffff; /* Wrong, fixme. */
  85. add_memory_region(0, lasat_board_info.li_memsize, BOOT_MEM_RAM);
  86. }
  87. void __init prom_free_prom_memory(void)
  88. {
  89. }
  90. const char *get_system_type(void)
  91. {
  92. return lasat_board_info.li_bmstr;
  93. }