/* SPDX-License-Identifier: GPL-2.0-only */1/*2* Copyright (C) 2012 Samsung Electronics.3* Kyungmin Park <[email protected]>4* Tomasz Figa <[email protected]>5*/67#ifndef __ASM_ARM_FIRMWARE_H8#define __ASM_ARM_FIRMWARE_H910#include <linux/bug.h>1112/*13* struct firmware_ops14*15* A structure to specify available firmware operations.16*17* A filled up structure can be registered with register_firmware_ops().18*/19struct firmware_ops {20/*21* Inform the firmware we intend to enter CPU idle mode22*/23int (*prepare_idle)(unsigned long mode);24/*25* Enters CPU idle mode26*/27int (*do_idle)(unsigned long mode);28/*29* Sets boot address of specified physical CPU30*/31int (*set_cpu_boot_addr)(int cpu, unsigned long boot_addr);32/*33* Gets boot address of specified physical CPU34*/35int (*get_cpu_boot_addr)(int cpu, unsigned long *boot_addr);36/*37* Boots specified physical CPU38*/39int (*cpu_boot)(int cpu);40/*41* Initializes L2 cache42*/43int (*l2x0_init)(void);44/*45* Enter system-wide suspend.46*/47int (*suspend)(void);48/*49* Restore state of privileged hardware after system-wide suspend.50*/51int (*resume)(void);52};5354/* Global pointer for current firmware_ops structure, can't be NULL. */55extern const struct firmware_ops *firmware_ops;5657/*58* call_firmware_op(op, ...)59*60* Checks if firmware operation is present and calls it,61* otherwise returns -ENOSYS62*/63#define call_firmware_op(op, ...) \64((firmware_ops->op) ? firmware_ops->op(__VA_ARGS__) : (-ENOSYS))6566/*67* register_firmware_ops(ops)68*69* A function to register platform firmware_ops struct.70*/71static inline void register_firmware_ops(const struct firmware_ops *ops)72{73BUG_ON(!ops);7475firmware_ops = ops;76}7778#endif798081