2012-08-28 21:50:38 +07:00
|
|
|
#ifndef SCM_BLK_H
|
|
|
|
#define SCM_BLK_H
|
|
|
|
|
|
|
|
#include <linux/interrupt.h>
|
|
|
|
#include <linux/spinlock.h>
|
|
|
|
#include <linux/blkdev.h>
|
2017-01-25 22:18:53 +07:00
|
|
|
#include <linux/blk-mq.h>
|
2012-08-28 21:50:38 +07:00
|
|
|
#include <linux/genhd.h>
|
|
|
|
#include <linux/list.h>
|
|
|
|
|
|
|
|
#include <asm/debug.h>
|
|
|
|
#include <asm/eadm.h>
|
|
|
|
|
|
|
|
#define SCM_NR_PARTS 8
|
|
|
|
#define SCM_QUEUE_DELAY 5
|
|
|
|
|
|
|
|
struct scm_blk_dev {
|
|
|
|
struct request_queue *rq;
|
|
|
|
struct gendisk *gendisk;
|
2017-01-25 22:18:53 +07:00
|
|
|
struct blk_mq_tag_set tag_set;
|
2012-08-28 21:50:38 +07:00
|
|
|
struct scm_device *scmdev;
|
2017-02-24 23:50:17 +07:00
|
|
|
spinlock_t lock;
|
2012-08-28 21:50:38 +07:00
|
|
|
atomic_t queued_reqs;
|
2013-02-28 18:07:48 +07:00
|
|
|
enum {SCM_OPER, SCM_WR_PROHIBIT} state;
|
2012-08-28 21:50:38 +07:00
|
|
|
struct list_head finished_requests;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct scm_request {
|
|
|
|
struct scm_blk_dev *bdev;
|
2014-12-05 22:41:47 +07:00
|
|
|
struct aidaw *next_aidaw;
|
2014-12-05 22:47:17 +07:00
|
|
|
struct request **request;
|
2012-08-28 21:50:38 +07:00
|
|
|
struct aob *aob;
|
|
|
|
struct list_head list;
|
|
|
|
u8 retries;
|
2017-06-03 14:38:04 +07:00
|
|
|
blk_status_t error;
|
2012-08-28 21:50:38 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
#define to_aobrq(rq) container_of((void *) rq, struct aob_rq_header, data)
|
|
|
|
|
|
|
|
int scm_blk_dev_setup(struct scm_blk_dev *, struct scm_device *);
|
|
|
|
void scm_blk_dev_cleanup(struct scm_blk_dev *);
|
2013-02-28 18:07:48 +07:00
|
|
|
void scm_blk_set_available(struct scm_blk_dev *);
|
2017-06-03 14:38:04 +07:00
|
|
|
void scm_blk_irq(struct scm_device *, void *, blk_status_t);
|
2012-08-28 21:50:38 +07:00
|
|
|
|
2014-12-05 22:41:47 +07:00
|
|
|
struct aidaw *scm_aidaw_fetch(struct scm_request *scmrq, unsigned int bytes);
|
2014-12-05 22:32:13 +07:00
|
|
|
|
2012-08-28 21:50:38 +07:00
|
|
|
int scm_drv_init(void);
|
|
|
|
void scm_drv_cleanup(void);
|
|
|
|
|
|
|
|
extern debug_info_t *scm_debug;
|
|
|
|
|
|
|
|
#define SCM_LOG(imp, txt) do { \
|
|
|
|
debug_text_event(scm_debug, imp, txt); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
static inline void SCM_LOG_HEX(int level, void *data, int length)
|
|
|
|
{
|
2017-10-09 22:49:38 +07:00
|
|
|
debug_event(scm_debug, level, data, length);
|
2012-08-28 21:50:38 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void SCM_LOG_STATE(int level, struct scm_device *scmdev)
|
|
|
|
{
|
|
|
|
struct {
|
|
|
|
u64 address;
|
|
|
|
u8 oper_state;
|
|
|
|
u8 rank;
|
|
|
|
} __packed data = {
|
|
|
|
.address = scmdev->address,
|
|
|
|
.oper_state = scmdev->attrs.oper_state,
|
|
|
|
.rank = scmdev->attrs.rank,
|
|
|
|
};
|
|
|
|
|
|
|
|
SCM_LOG_HEX(level, &data, sizeof(data));
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* SCM_BLK_H */
|