bnxt_en: Fix NULL ptr dereference crash in bnxt_fw_reset_task()
[linux/fpc-iii.git] / drivers / s390 / block / scm_blk.h
bloba05a4297cfae20ab126b03acf10b4089a96d8e36
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef SCM_BLK_H
3 #define SCM_BLK_H
5 #include <linux/interrupt.h>
6 #include <linux/spinlock.h>
7 #include <linux/blkdev.h>
8 #include <linux/blk-mq.h>
9 #include <linux/genhd.h>
10 #include <linux/list.h>
12 #include <asm/debug.h>
13 #include <asm/eadm.h>
15 #define SCM_NR_PARTS 8
16 #define SCM_QUEUE_DELAY 5
18 struct scm_blk_dev {
19 struct request_queue *rq;
20 struct gendisk *gendisk;
21 struct blk_mq_tag_set tag_set;
22 struct scm_device *scmdev;
23 spinlock_t lock;
24 atomic_t queued_reqs;
25 enum {SCM_OPER, SCM_WR_PROHIBIT} state;
26 struct list_head finished_requests;
29 struct scm_request {
30 struct scm_blk_dev *bdev;
31 struct aidaw *next_aidaw;
32 struct request **request;
33 struct aob *aob;
34 struct list_head list;
35 u8 retries;
36 blk_status_t error;
39 #define to_aobrq(rq) container_of((void *) rq, struct aob_rq_header, data)
41 int scm_blk_dev_setup(struct scm_blk_dev *, struct scm_device *);
42 void scm_blk_dev_cleanup(struct scm_blk_dev *);
43 void scm_blk_set_available(struct scm_blk_dev *);
44 void scm_blk_irq(struct scm_device *, void *, blk_status_t);
46 struct aidaw *scm_aidaw_fetch(struct scm_request *scmrq, unsigned int bytes);
48 int scm_drv_init(void);
49 void scm_drv_cleanup(void);
51 extern debug_info_t *scm_debug;
53 #define SCM_LOG(imp, txt) do { \
54 debug_text_event(scm_debug, imp, txt); \
55 } while (0)
57 static inline void SCM_LOG_HEX(int level, void *data, int length)
59 debug_event(scm_debug, level, data, length);
62 static inline void SCM_LOG_STATE(int level, struct scm_device *scmdev)
64 struct {
65 u64 address;
66 u8 oper_state;
67 u8 rank;
68 } __packed data = {
69 .address = scmdev->address,
70 .oper_state = scmdev->attrs.oper_state,
71 .rank = scmdev->attrs.rank,
74 SCM_LOG_HEX(level, &data, sizeof(data));
77 #endif /* SCM_BLK_H */