p1275.c 1.1 KB

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