]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blame - arch/sparc/prom/p1275.c
Merge tag 'drm-misc-next-2017-11-30' of git://anongit.freedesktop.org/drm/drm-misc...
[mirror_ubuntu-hirsute-kernel.git] / arch / sparc / prom / p1275.c
CommitLineData
b2441318 1// SPDX-License-Identifier: GPL-2.0
b00dc837 2/*
1da177e4
LT
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
8#include <linux/kernel.h>
1da177e4
LT
9#include <linux/sched.h>
10#include <linux/smp.h>
11#include <linux/string.h>
12#include <linux/spinlock.h>
bdcf81b6 13#include <linux/irqflags.h>
1da177e4
LT
14
15#include <asm/openprom.h>
16#include <asm/oplib.h>
1da177e4
LT
17#include <asm/spitfire.h>
18#include <asm/pstate.h>
4f0234f4 19#include <asm/ldc.h>
1da177e4
LT
20
21struct {
22 long prom_callback; /* 0x00 */
23 void (*prom_cif_handler)(long *); /* 0x08 */
1da177e4
LT
24} p1275buf;
25
26extern void prom_world(int);
27
25edd694 28extern void prom_cif_direct(unsigned long *args);
1da177e4
LT
29extern void prom_cif_callback(void);
30
1da177e4 31/*
8a4fd1e4 32 * This provides SMP safety on the p1275buf.
1da177e4 33 */
8a4fd1e4 34DEFINE_RAW_SPINLOCK(prom_entry_lock);
1da177e4 35
25edd694 36void p1275_cmd_direct(unsigned long *args)
1da177e4 37{
1da177e4 38 unsigned long flags;
1da177e4 39
bdcf81b6
DM
40 local_save_flags(flags);
41 local_irq_restore((unsigned long)PIL_NMI);
8a4fd1e4 42 raw_spin_lock(&prom_entry_lock);
1da177e4 43
1da177e4 44 prom_world(1);
25edd694 45 prom_cif_direct(args);
1da177e4
LT
46 prom_world(0);
47
8a4fd1e4 48 raw_spin_unlock(&prom_entry_lock);
bdcf81b6 49 local_irq_restore(flags);
1da177e4
LT
50}
51
52void prom_cif_init(void *cif_handler, void *cif_stack)
53{
54 p1275buf.prom_cif_handler = (void (*)(long *))cif_handler;
1da177e4 55}