]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - ubuntu/hio/hio.h
x86/bugs: Expose x86_spec_ctrl_base directly
[mirror_ubuntu-artful-kernel.git] / ubuntu / hio / hio.h
CommitLineData
e7bfc654
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
25typedef int (*ssd_event_call)(struct gendisk *, int, int); /* gendisk, event id, event level */
26extern int ssd_register_event_notifier(struct block_device *bdev, ssd_event_call event_call);
27/* unregister event notifier before module exit */
28extern 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
35typedef 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 */
47typedef 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
58extern int ssd_get_label(struct block_device *bdev, struct ssd_label *label);
59extern int ssd_get_version(struct block_device *bdev, struct ssd_version_info *ver);
60extern int ssd_get_temperature(struct block_device *bdev, int *temp);
61
62
63enum ssd_bmstatus
64{
65 SSD_BMSTATUS_OK = 0,
66 SSD_BMSTATUS_CHARGING,
67 SSD_BMSTATUS_WARNING
68};
69extern int ssd_bm_status(struct block_device *bdev, int *status);
70
71enum ssd_otprotect
72{
73 SSD_OTPROTECT_OFF = 0,
74 SSD_OTPROTECT_ON
75};
76extern int ssd_set_otprotect(struct block_device *bdev, int otprotect);
77
78typedef struct pci_addr
79{
80 uint16_t domain;
81 uint8_t bus;
82 uint8_t slot;
83 uint8_t func;
84} pci_addr_t;
85extern int ssd_get_pciaddr(struct block_device *bdev, struct pci_addr *paddr);
86
87/* submit phys bio: phys addr in iovec */
88extern void ssd_submit_pbio(struct request_queue *q, struct bio *bio);
89
90extern int ssd_reset(struct block_device *bdev);
91
92enum 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};
101extern int ssd_set_wmode(struct block_device *bdev, int wmode);
102
103#endif
104