Linux 5.8-rc4
[linux/fpc-iii.git] / arch / sparc / prom / p1275.c
blob889aa602f8d8600aaf2a6aa1c6b6294378ea92e4
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * p1275.c: Sun IEEE 1275 PROM low level interface routines
5 * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
6 */
8 #include <linux/kernel.h>
9 #include <linux/sched.h>
10 #include <linux/smp.h>
11 #include <linux/string.h>
12 #include <linux/spinlock.h>
13 #include <linux/irqflags.h>
15 #include <asm/openprom.h>
16 #include <asm/oplib.h>
17 #include <asm/spitfire.h>
18 #include <asm/pstate.h>
19 #include <asm/ldc.h>
21 struct {
22 long prom_callback; /* 0x00 */
23 void (*prom_cif_handler)(long *); /* 0x08 */
24 } p1275buf;
26 extern void prom_world(int);
28 extern void prom_cif_direct(unsigned long *args);
29 extern void prom_cif_callback(void);
32 * This provides SMP safety on the p1275buf.
34 DEFINE_RAW_SPINLOCK(prom_entry_lock);
36 void p1275_cmd_direct(unsigned long *args)
38 unsigned long flags;
40 local_save_flags(flags);
41 local_irq_restore((unsigned long)PIL_NMI);
42 raw_spin_lock(&prom_entry_lock);
44 prom_world(1);
45 prom_cif_direct(args);
46 prom_world(0);
48 raw_spin_unlock(&prom_entry_lock);
49 local_irq_restore(flags);
52 void prom_cif_init(void *cif_handler, void *cif_stack)
54 p1275buf.prom_cif_handler = (void (*)(long *))cif_handler;