// SPDX-License-Identifier: GPL-2.0-or-later/* * * Procedures for interfacing to the RTAS on CHRP machines. * * Peter Bergner, IBM March 2001. * Copyright (C) 2001 IBM. */#include<stdarg.h>#include<linux/kernel.h>#include<linux/types.h>#include<linux/spinlock.h>#include<linux/export.h>#include<linux/init.h>#include<linux/capability.h>#include<linux/delay.h>#include<linux/cpu.h>#include<linux/sched.h>#include<linux/smp.h>#include<linux/completion.h>#include<linux/cpumask.h>#include<linux/memblock.h>#include<linux/slab.h>#include<linux/reboot.h>#include<linux/syscalls.h>#include<asm/prom.h>#include<asm/rtas.h>#include<asm/hvcall.h>#include<asm/machdep.h>#include<asm/firmware.h>#include<asm/page.h>#include<asm/param.h>#include<asm/delay.h>#include<linux/uaccess.h>#include<asm/udbg.h>#include<asm/syscalls.h>#include<asm/smp.h>#include<linux/atomic.h>#include<asm/time.h>#include<asm/mmu.h>#include<asm/topology.h>#include<asm/paca.h>/* This is here deliberately so it's only used in this file */voidenter_rtas(unsignedlong);structrtas_trtas={.lock=__ARCH_SPIN_LOCK_UNLOCKED};EXPORT_SYMBOL(rtas);DEFINE_SPINLOCK(rtas_data_buf_lock);EXPORT_SYMBOL(rtas_data_buf_lock);charrtas_data_buf[RTAS_DATA_BUF_SIZE]__cacheline_aligned;EXPORT_SYMBOL(rtas_data_buf);unsignedlongrtas_rmo_buf;/* * If non-NULL, this gets called when the kernel terminates. * This is done like this so rtas_flash can be a module. */void(*rtas_flash_term_hook)(int);EXPORT_SYMBOL(rtas_flash_term_hook);/* RTAS use home made raw locking instead of spin_lock_irqsave * because those can be called from within really nasty contexts * such as having the timebase stopped which would lockup with * normal locks and spinlock debugging enabled */staticunsignedlonglock_rtas(void){unsignedlongflags;local_irq_save(flags);preempt_disable();arch_spin_lock(&rtas.lock);returnflags;}staticvoidunlock_rtas(