]> bbs.cooldavid.org Git - net-next-2.6.git/blame - arch/sparc/prom/p1275.c
sparc64: Get rid of indirect p1275 PROM call buffer.
[net-next-2.6.git] / arch / sparc / prom / p1275.c
CommitLineData
b00dc837 1/*
1da177e4
LT
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
7#include <linux/kernel.h>
8#include <linux/init.h>
9#include <linux/sched.h>
10#include <linux/smp.h>
11#include <linux/string.h>
12#include <linux/spinlock.h>
13
14#include <asm/openprom.h>
15#include <asm/oplib.h>
16#include <asm/system.h>
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 */
24 unsigned long prom_cif_stack; /* 0x10 */
1da177e4
LT
25} p1275buf;
26
27extern void prom_world(int);
28
25edd694 29extern void prom_cif_direct(unsigned long *args);
1da177e4
LT
30extern void prom_cif_callback(void);
31
1da177e4 32/*
8a4fd1e4 33 * This provides SMP safety on the p1275buf.
1da177e4 34 */
8a4fd1e4 35DEFINE_RAW_SPINLOCK(prom_entry_lock);
1da177e4 36
25edd694 37void p1275_cmd_direct(unsigned long *args)
1da177e4 38{
1da177e4 39 unsigned long flags;
1da177e4 40
8a4fd1e4
DM
41 raw_local_save_flags(flags);
42 raw_local_irq_restore(PIL_NMI);
43 raw_spin_lock(&prom_entry_lock);
1da177e4 44
1da177e4 45 prom_world(1);
25edd694 46 prom_cif_direct(args);
1da177e4
LT
47 prom_world(0);
48
8a4fd1e4
DM
49 raw_spin_unlock(&prom_entry_lock);
50 raw_local_irq_restore(flags);
1da177e4
LT
51}
52
53void prom_cif_init(void *cif_handler, void *cif_stack)
54{
55 p1275buf.prom_cif_handler = (void (*)(long *))cif_handler;
56 p1275buf.prom_cif_stack = (unsigned long)cif_stack;
57}