p1275.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * p1275.c: Sun IEEE 1275 PROM low level interface routines
  4. *
  5. * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
  6. */
  7. #include <linux/kernel.h>
  8. #include <linux/sched.h>
  9. #include <linux/smp.h>
  10. #include <linux/string.h>
  11. #include <linux/spinlock.h>
  12. #include <linux/irqflags.h>
  13. #include <asm/openprom.h>
  14. #include <asm/oplib.h>
  15. #include <asm/spitfire.h>
  16. #include <asm/pstate.h>
  17. #include <asm/ldc.h>
  18. struct {
  19. long prom_callback; /* 0x00 */
  20. void (*prom_cif_handler)(long *); /* 0x08 */
  21. } p1275buf;
  22. extern void prom_world(int);
  23. extern void prom_cif_direct(unsigned long *args);
  24. extern void prom_cif_callback(void);
  25. /*
  26. * This provides SMP safety on the p1275buf.
  27. */
  28. DEFINE_RAW_SPINLOCK(prom_entry_lock);
  29. void p1275_cmd_direct(unsigned long *args)
  30. {
  31. unsigned long flags;
  32. local_save_flags(flags);
  33. local_irq_restore((unsigned long)PIL_NMI);
  34. raw_spin_lock(&prom_entry_lock);
  35. prom_world(1);
  36. prom_cif_direct(args);
  37. prom_world(0);
  38. raw_spin_unlock(&prom_entry_lock);
  39. local_irq_restore(flags);
  40. }
  41. void prom_cif_init(void *cif_handler, void *cif_stack)
  42. {
  43. p1275buf.prom_cif_handler = (void (*)(long *))cif_handler;
  44. }