prom.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Copyright 2001 MontaVista Software Inc.
  3. * Author: jsun@mvista.com or jsun@junsun.net
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of the GNU General Public License as published by the
  7. * Free Software Foundation; either version 2 of the License, or (at your
  8. * option) any later version.
  9. */
  10. #include <linux/init.h>
  11. #include <linux/mm.h>
  12. #include <linux/sched.h>
  13. #include <linux/bootmem.h>
  14. #include <asm/addrspace.h>
  15. #include <asm/bootinfo.h>
  16. #include <asm/pmon.h>
  17. struct callvectors* debug_vectors;
  18. extern unsigned long gt64120_base;
  19. const char *get_system_type(void)
  20. {
  21. return "Momentum Ocelot";
  22. }
  23. /* [jsun@junsun.net] PMON passes arguments in C main() style */
  24. void __init prom_init(void)
  25. {
  26. int argc = fw_arg0;
  27. char **arg = (char **) fw_arg1;
  28. char **env = (char **) fw_arg2;
  29. struct callvectors *cv = (struct callvectors *) fw_arg3;
  30. int i;
  31. /* save the PROM vectors for debugging use */
  32. debug_vectors = cv;
  33. /* arg[0] is "g", the rest is boot parameters */
  34. arcs_cmdline[0] = '\0';
  35. for (i = 1; i < argc; i++) {
  36. if (strlen(arcs_cmdline) + strlen(arg[i] + 1)
  37. >= sizeof(arcs_cmdline))
  38. break;
  39. strcat(arcs_cmdline, arg[i]);
  40. strcat(arcs_cmdline, " ");
  41. }
  42. mips_machgroup = MACH_GROUP_MOMENCO;
  43. mips_machtype = MACH_MOMENCO_OCELOT;
  44. while (*env) {
  45. if (strncmp("gtbase", *env, 6) == 0) {
  46. gt64120_base = simple_strtol(*env + strlen("gtbase="),
  47. NULL, 16);
  48. break;
  49. }
  50. *env++;
  51. }
  52. debug_vectors->printf("Booting Linux kernel...\n");
  53. /* All the boards have at least 64MiB. If there's more, we
  54. detect and register it later */
  55. add_memory_region(0, 64 << 20, BOOT_MEM_RAM);
  56. }
  57. void __init prom_free_prom_memory(void)
  58. {
  59. }