sead3-cmdline.c 972 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.
  7. */
  8. #include <linux/init.h>
  9. #include <linux/string.h>
  10. #include <asm/bootinfo.h>
  11. extern int prom_argc;
  12. extern int *_prom_argv;
  13. /*
  14. * YAMON (32-bit PROM) pass arguments and environment as 32-bit pointer.
  15. * This macro take care of sign extension.
  16. */
  17. #define prom_argv(index) ((char *)(long)_prom_argv[(index)])
  18. char * __init prom_getcmdline(void)
  19. {
  20. return &(arcs_cmdline[0]);
  21. }
  22. void __init prom_init_cmdline(void)
  23. {
  24. char *cp;
  25. int actr;
  26. actr = 1; /* Always ignore argv[0] */
  27. cp = &(arcs_cmdline[0]);
  28. while (actr < prom_argc) {
  29. strcpy(cp, prom_argv(actr));
  30. cp += strlen(prom_argv(actr));
  31. *cp++ = ' ';
  32. actr++;
  33. }
  34. if (cp != &(arcs_cmdline[0])) {
  35. /* get rid of trailing space */
  36. --cp;
  37. *cp = '\0';
  38. }
  39. }