mirror of
https://github.com/torvalds/linux.git
synced 2024-11-26 22:21:42 +00:00
5224f79096
There is a regular need in the kernel to provide a way to declare having a dynamically sized set of trailing elements in a structure. Kernel code should always use “flexible array members”[1] for these cases. The older style of one-element or zero-length arrays should no longer be used[2]. This code was transformed with the help of Coccinelle: (next-20220214$ spatch --jobs $(getconf _NPROCESSORS_ONLN) --sp-file script.cocci --include-headers --dir . > output.patch) @@ identifier S, member, array; type T1, T2; @@ struct S { ... T1 member; T2 array[ - 0 ]; }; UAPI and wireless changes were intentionally excluded from this patch and will be sent out separately. [1] https://en.wikipedia.org/wiki/Flexible_array_member [2] https://www.kernel.org/doc/html/v5.16/process/deprecated.html#zero-length-and-one-element-arrays Link: https://github.com/KSPP/linux/issues/78 Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
121 lines
2.0 KiB
C
121 lines
2.0 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _ASM_S390_EADM_H
|
|
#define _ASM_S390_EADM_H
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/device.h>
|
|
#include <linux/blk_types.h>
|
|
|
|
struct arqb {
|
|
u64 data;
|
|
u16 fmt:4;
|
|
u16:12;
|
|
u16 cmd_code;
|
|
u16:16;
|
|
u16 msb_count;
|
|
u32 reserved[12];
|
|
} __packed;
|
|
|
|
#define ARQB_CMD_MOVE 1
|
|
|
|
struct arsb {
|
|
u16 fmt:4;
|
|
u32:28;
|
|
u8 ef;
|
|
u8:8;
|
|
u8 ecbi;
|
|
u8:8;
|
|
u8 fvf;
|
|
u16:16;
|
|
u8 eqc;
|
|
u32:32;
|
|
u64 fail_msb;
|
|
u64 fail_aidaw;
|
|
u64 fail_ms;
|
|
u64 fail_scm;
|
|
u32 reserved[4];
|
|
} __packed;
|
|
|
|
#define EQC_WR_PROHIBIT 22
|
|
|
|
struct msb {
|
|
u8 fmt:4;
|
|
u8 oc:4;
|
|
u8 flags;
|
|
u16:12;
|
|
u16 bs:4;
|
|
u32 blk_count;
|
|
u64 data_addr;
|
|
u64 scm_addr;
|
|
u64:64;
|
|
} __packed;
|
|
|
|
struct aidaw {
|
|
u8 flags;
|
|
u32 :24;
|
|
u32 :32;
|
|
u64 data_addr;
|
|
} __packed;
|
|
|
|
#define MSB_OC_CLEAR 0
|
|
#define MSB_OC_READ 1
|
|
#define MSB_OC_WRITE 2
|
|
#define MSB_OC_RELEASE 3
|
|
|
|
#define MSB_FLAG_BNM 0x80
|
|
#define MSB_FLAG_IDA 0x40
|
|
|
|
#define MSB_BS_4K 0
|
|
#define MSB_BS_1M 1
|
|
|
|
#define AOB_NR_MSB 124
|
|
|
|
struct aob {
|
|
struct arqb request;
|
|
struct arsb response;
|
|
struct msb msb[AOB_NR_MSB];
|
|
} __packed __aligned(PAGE_SIZE);
|
|
|
|
struct aob_rq_header {
|
|
struct scm_device *scmdev;
|
|
char data[];
|
|
};
|
|
|
|
struct scm_device {
|
|
u64 address;
|
|
u64 size;
|
|
unsigned int nr_max_block;
|
|
struct device dev;
|
|
struct {
|
|
unsigned int persistence:4;
|
|
unsigned int oper_state:4;
|
|
unsigned int data_state:4;
|
|
unsigned int rank:4;
|
|
unsigned int release:1;
|
|
unsigned int res_id:8;
|
|
} __packed attrs;
|
|
};
|
|
|
|
#define OP_STATE_GOOD 1
|
|
#define OP_STATE_TEMP_ERR 2
|
|
#define OP_STATE_PERM_ERR 3
|
|
|
|
enum scm_event {SCM_CHANGE, SCM_AVAIL};
|
|
|
|
struct scm_driver {
|
|
struct device_driver drv;
|
|
int (*probe) (struct scm_device *scmdev);
|
|
void (*remove) (struct scm_device *scmdev);
|
|
void (*notify) (struct scm_device *scmdev, enum scm_event event);
|
|
void (*handler) (struct scm_device *scmdev, void *data,
|
|
blk_status_t error);
|
|
};
|
|
|
|
int scm_driver_register(struct scm_driver *scmdrv);
|
|
void scm_driver_unregister(struct scm_driver *scmdrv);
|
|
|
|
int eadm_start_aob(struct aob *aob);
|
|
void scm_irq_handler(struct aob *aob, blk_status_t error);
|
|
|
|
#endif /* _ASM_S390_EADM_H */
|