mp.c 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * mp.c: OpenBoot Prom Multiprocessor support routines. Don't call
  4. * these on a UP or else you will halt and catch fire. ;)
  5. *
  6. * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
  7. */
  8. #include <linux/types.h>
  9. #include <linux/kernel.h>
  10. #include <linux/sched.h>
  11. #include <asm/openprom.h>
  12. #include <asm/oplib.h>
  13. extern void restore_current(void);
  14. /* Start cpu with prom-tree node 'cpunode' using context described
  15. * by 'ctable_reg' in context 'ctx' at program counter 'pc'.
  16. *
  17. * XXX Have to look into what the return values mean. XXX
  18. */
  19. int
  20. prom_startcpu(int cpunode, struct linux_prom_registers *ctable_reg, int ctx, char *pc)
  21. {
  22. int ret;
  23. unsigned long flags;
  24. spin_lock_irqsave(&prom_lock, flags);
  25. switch(prom_vers) {
  26. case PROM_V0:
  27. case PROM_V2:
  28. default:
  29. ret = -1;
  30. break;
  31. case PROM_V3:
  32. ret = (*(romvec->v3_cpustart))(cpunode, (int) ctable_reg, ctx, pc);
  33. break;
  34. }
  35. restore_current();
  36. spin_unlock_irqrestore(&prom_lock, flags);
  37. return ret;
  38. }