Linux Audio

Check our new training course

Loading...
v5.14.15
 1/* SPDX-License-Identifier: GPL-2.0 */
 2/*
 3 * Copyright © 2016 Intel Corporation
 4 *
 5 * Authors:
 6 *    Rafael Antognolli <rafael.antognolli@intel.com>
 7 *    Scott  Bauer      <scott.bauer@intel.com>
 8 */
 9
10#ifndef LINUX_OPAL_H
11#define LINUX_OPAL_H
12
13#include <uapi/linux/sed-opal.h>
14#include <linux/kernel.h>
 
15
16struct opal_dev;
17
18typedef int (sec_send_recv)(void *data, u16 spsp, u8 secp, void *buffer,
19		size_t len, bool send);
20
21#ifdef CONFIG_BLK_SED_OPAL
22void free_opal_dev(struct opal_dev *dev);
23bool opal_unlock_from_suspend(struct opal_dev *dev);
24struct opal_dev *init_opal_dev(void *data, sec_send_recv *send_recv);
25int sed_ioctl(struct opal_dev *dev, unsigned int cmd, void __user *ioctl_ptr);
26
 
 
 
27static inline bool is_sed_ioctl(unsigned int cmd)
28{
29	switch (cmd) {
30	case IOC_OPAL_SAVE:
31	case IOC_OPAL_LOCK_UNLOCK:
32	case IOC_OPAL_TAKE_OWNERSHIP:
33	case IOC_OPAL_ACTIVATE_LSP:
34	case IOC_OPAL_SET_PW:
35	case IOC_OPAL_ACTIVATE_USR:
36	case IOC_OPAL_REVERT_TPR:
37	case IOC_OPAL_LR_SETUP:
38	case IOC_OPAL_ADD_USR_TO_LR:
39	case IOC_OPAL_ENABLE_DISABLE_MBR:
40	case IOC_OPAL_ERASE_LR:
41	case IOC_OPAL_SECURE_ERASE_LR:
42	case IOC_OPAL_PSID_REVERT_TPR:
43	case IOC_OPAL_MBR_DONE:
44	case IOC_OPAL_WRITE_SHADOW_MBR:
45	case IOC_OPAL_GENERIC_TABLE_RW:
 
 
 
 
 
 
46		return true;
47	}
48	return false;
49}
50#else
51static inline void free_opal_dev(struct opal_dev *dev)
52{
53}
54
55static inline bool is_sed_ioctl(unsigned int cmd)
56{
57	return false;
58}
59
60static inline int sed_ioctl(struct opal_dev *dev, unsigned int cmd,
61			    void __user *ioctl_ptr)
62{
63	return 0;
64}
65static inline bool opal_unlock_from_suspend(struct opal_dev *dev)
66{
67	return false;
68}
69#define init_opal_dev(data, send_recv)		NULL
70#endif /* CONFIG_BLK_SED_OPAL */
71#endif /* LINUX_OPAL_H */
v6.13.7
 1/* SPDX-License-Identifier: GPL-2.0 */
 2/*
 3 * Copyright © 2016 Intel Corporation
 4 *
 5 * Authors:
 6 *    Rafael Antognolli <rafael.antognolli@intel.com>
 7 *    Scott  Bauer      <scott.bauer@intel.com>
 8 */
 9
10#ifndef LINUX_OPAL_H
11#define LINUX_OPAL_H
12
13#include <uapi/linux/sed-opal.h>
14#include <linux/compiler_types.h>
15#include <linux/types.h>
16
17struct opal_dev;
18
19typedef int (sec_send_recv)(void *data, u16 spsp, u8 secp, void *buffer,
20		size_t len, bool send);
21
22#ifdef CONFIG_BLK_SED_OPAL
23void free_opal_dev(struct opal_dev *dev);
24bool opal_unlock_from_suspend(struct opal_dev *dev);
25struct opal_dev *init_opal_dev(void *data, sec_send_recv *send_recv);
26int sed_ioctl(struct opal_dev *dev, unsigned int cmd, void __user *ioctl_ptr);
27
28#define	OPAL_AUTH_KEY           "opal-boot-pin"
29#define	OPAL_AUTH_KEY_PREV      "opal-boot-pin-prev"
30
31static inline bool is_sed_ioctl(unsigned int cmd)
32{
33	switch (cmd) {
34	case IOC_OPAL_SAVE:
35	case IOC_OPAL_LOCK_UNLOCK:
36	case IOC_OPAL_TAKE_OWNERSHIP:
37	case IOC_OPAL_ACTIVATE_LSP:
38	case IOC_OPAL_SET_PW:
39	case IOC_OPAL_ACTIVATE_USR:
40	case IOC_OPAL_REVERT_TPR:
41	case IOC_OPAL_LR_SETUP:
42	case IOC_OPAL_ADD_USR_TO_LR:
43	case IOC_OPAL_ENABLE_DISABLE_MBR:
44	case IOC_OPAL_ERASE_LR:
45	case IOC_OPAL_SECURE_ERASE_LR:
46	case IOC_OPAL_PSID_REVERT_TPR:
47	case IOC_OPAL_MBR_DONE:
48	case IOC_OPAL_WRITE_SHADOW_MBR:
49	case IOC_OPAL_GENERIC_TABLE_RW:
50	case IOC_OPAL_GET_STATUS:
51	case IOC_OPAL_GET_LR_STATUS:
52	case IOC_OPAL_GET_GEOMETRY:
53	case IOC_OPAL_DISCOVERY:
54	case IOC_OPAL_REVERT_LSP:
55	case IOC_OPAL_SET_SID_PW:
56		return true;
57	}
58	return false;
59}
60#else
61static inline void free_opal_dev(struct opal_dev *dev)
62{
63}
64
65static inline bool is_sed_ioctl(unsigned int cmd)
66{
67	return false;
68}
69
70static inline int sed_ioctl(struct opal_dev *dev, unsigned int cmd,
71			    void __user *ioctl_ptr)
72{
73	return 0;
74}
75static inline bool opal_unlock_from_suspend(struct opal_dev *dev)
76{
77	return false;
78}
79#define init_opal_dev(data, send_recv)		NULL
80#endif /* CONFIG_BLK_SED_OPAL */
81#endif /* LINUX_OPAL_H */