2 * Huawei SSD device driver
3 * Copyright (c) 2016, Huawei Technologies Co., Ltd.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 #include <linux/types.h>
19 #include <linux/genhd.h>
20 #include <linux/blkdev.h>
21 #include <linux/genhd.h>
25 typedef int (*ssd_event_call
)(struct gendisk
*, int, int); /* gendisk, event id, event level */
26 extern int ssd_register_event_notifier(struct block_device
*bdev
, ssd_event_call event_call
);
27 /* unregister event notifier before module exit */
28 extern int ssd_unregister_event_notifier(struct block_device
*bdev
);
32 #define SSD_LABEL_FIELD_SZ 32
35 typedef struct ssd_label
37 char date
[SSD_LABEL_FIELD_SZ
];
38 char sn
[SSD_LABEL_FIELD_SZ
];
39 char part
[SSD_LABEL_FIELD_SZ
];
40 char desc
[SSD_LABEL_FIELD_SZ
];
41 char other
[SSD_LABEL_FIELD_SZ
];
42 char maf
[SSD_LABEL_FIELD_SZ
];
47 typedef struct ssd_version_info
49 uint32_t bridge_ver
; /* bridge fw version: hex */
50 uint32_t ctrl_ver
; /* controller fw version: hex */
51 uint32_t bm_ver
; /* battery manager fw version: hex */
52 uint8_t pcb_ver
; /* main pcb version: char */
53 uint8_t upper_pcb_ver
;
58 extern int ssd_get_label(struct block_device
*bdev
, struct ssd_label
*label
);
59 extern int ssd_get_version(struct block_device
*bdev
, struct ssd_version_info
*ver
);
60 extern int ssd_get_temperature(struct block_device
*bdev
, int *temp
);
66 SSD_BMSTATUS_CHARGING
,
69 extern int ssd_bm_status(struct block_device
*bdev
, int *status
);
73 SSD_OTPROTECT_OFF
= 0,
76 extern int ssd_set_otprotect(struct block_device
*bdev
, int otprotect
);
78 typedef struct pci_addr
85 extern int ssd_get_pciaddr(struct block_device
*bdev
, struct pci_addr
*paddr
);
87 /* submit phys bio: phys addr in iovec */
88 extern void ssd_submit_pbio(struct request_queue
*q
, struct bio
*bio
);
90 extern int ssd_reset(struct block_device
*bdev
);
101 extern int ssd_set_wmode(struct block_device
*bdev
, int wmode
);