]>
Commit | Line | Data |
---|---|---|
a6a796ca HSDT |
1 | /* |
2 | * Huawei SSD device driver | |
3 | * Copyright (c) 2016, Huawei Technologies Co., Ltd. | |
4 | * | |
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. | |
8 | * | |
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 | |
12 | * more details. | |
13 | */ | |
14 | ||
15 | #ifndef _HIO_H | |
16 | #define _HIO_H | |
17 | ||
18 | #include <linux/types.h> | |
19 | #include <linux/genhd.h> | |
20 | #include <linux/blkdev.h> | |
21 | #include <linux/genhd.h> | |
22 | ||
23 | ||
24 | ||
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); | |
29 | ||
30 | ||
31 | /* label */ | |
32 | #define SSD_LABEL_FIELD_SZ 32 | |
33 | #define SSD_SN_SZ 16 | |
34 | ||
35 | typedef struct ssd_label | |
36 | { | |
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]; | |
43 | } ssd_label_t; | |
44 | ||
45 | ||
46 | /* version */ | |
47 | typedef struct ssd_version_info | |
48 | { | |
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; | |
54 | uint8_t pad0; | |
55 | uint8_t pad1; | |
56 | } ssd_version_info_t; | |
57 | ||
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); | |
61 | ||
62 | ||
63 | enum ssd_bmstatus | |
64 | { | |
65 | SSD_BMSTATUS_OK = 0, | |
66 | SSD_BMSTATUS_CHARGING, | |
67 | SSD_BMSTATUS_WARNING | |
68 | }; | |
69 | extern int ssd_bm_status(struct block_device *bdev, int *status); | |
70 | ||
71 | enum ssd_otprotect | |
72 | { | |
73 | SSD_OTPROTECT_OFF = 0, | |
74 | SSD_OTPROTECT_ON | |
75 | }; | |
76 | extern int ssd_set_otprotect(struct block_device *bdev, int otprotect); | |
77 | ||
78 | typedef struct pci_addr | |
79 | { | |
80 | uint16_t domain; | |
81 | uint8_t bus; | |
82 | uint8_t slot; | |
83 | uint8_t func; | |
84 | } pci_addr_t; | |
85 | extern int ssd_get_pciaddr(struct block_device *bdev, struct pci_addr *paddr); | |
86 | ||
87 | /* submit phys bio: phys addr in iovec */ | |
88 | extern void ssd_submit_pbio(struct request_queue *q, struct bio *bio); | |
89 | ||
90 | extern int ssd_reset(struct block_device *bdev); | |
91 | ||
92 | enum ssd_write_mode | |
93 | { | |
94 | SSD_WMODE_BUFFER = 0, | |
95 | SSD_WMODE_BUFFER_EX, | |
96 | SSD_WMODE_FUA, | |
97 | /* dummy */ | |
98 | SSD_WMODE_AUTO, | |
99 | SSD_WMODE_DEFAULT | |
100 | }; | |
101 | extern int ssd_set_wmode(struct block_device *bdev, int wmode); | |
102 | ||
103 | #endif | |
104 |