Commit d7e0a61a authored by Huawei SSD DEV Team's avatar Huawei SSD DEV Team Committed by Kamal Mostafa

UBUNTU: SAUCE: import Huawei ES3000_V2 (2.1.0.23)

BugLink: http://bugs.launchpad.net/bugs/1603483

Source: http://support.huawei.com/enterprisesearch/ebgSearch#sp.keyword=HUAWEI%20ES3000%20V2%20Driver%20SRC

  Huawei SSD device driver
  Copyright (c) 2016, Huawei Technologies Co., Ltd.

  This program is free software; you can redistribute it and/or modify it
  under the terms and conditions of the GNU General Public License,
  version 2, as published by the Free Software Foundation.

  This program is distributed in the hope it will be useful, but WITHOUT
  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  more details.
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
Acked-by: default avatarBrad Figg <brad.figg@canonical.com>
Acked-by: default avatarTim Gardner <tim.gardner@canonical.com>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
parent 9b950d1c
ifneq ($(KERNELRELEASE),)
# hio-y := hio_main.o
# obj-$(CONFIG_HIO_DRIVER) += hio.o
obj-m += hio.o
else
KVER=
ifeq ($(KVER),)
KVER=$(shell uname -r)
endif
PDIR=
ifeq ($(PDIR),)
PDIR=extra
endif
PREFIX=
MODDIR=/lib/modules/$(KVER)/$(PDIR)/hio/
MOD=hio.ko
ifeq ($(KVER),2.6.32-300.3.1.el6uek.x86_64)
FLAGS += -DSSD_QUEUE_PBIO
endif
ifeq ($(KVER),2.6.32-220.el6.x86_64)
FLAGS += -DSSD_QUEUE_PBIO
endif
ifeq ($(KVER),2.6.32-358.el6.x86_64)
FLAGS += -DSSD_QUEUE_PBIO
endif
ifeq ($(KVER),2.6.32-358.23.2.el6.x86_64)
FLAGS += -DSSD_QUEUE_PBIO
endif
ifeq ($(KVER),3.0.58-0.6.6-xen)
FLAGS += -DSSD_QUEUE_PBIO
endif
ifeq ($(KVER),3.2.0-4-amd64)
FLAGS += -DSSD_BIOVEC_PHYS_MERGEABLE_FIXED
endif
ifeq ($(KVER),2.6.39-400.209.1.el5uek) #Oracle Linux Server release 5.10
FLAGS += -DSSD_BIOVEC_PHYS_MERGEABLE_FIXED
endif
ifeq ($(KVER),2.6.39-400.215.10.el5uek) #Oracle Linux Server release 5.11
FLAGS += -DSSD_BIOVEC_PHYS_MERGEABLE_FIXED
endif
ifeq ($(KVER),2.6.39-200.24.1.el6uek.x86_64) #Oracle Linux Server release 6.3
FLAGS += -DSSD_BIOVEC_PHYS_MERGEABLE_FIXED
endif
ifeq ($(KVER),2.6.39-400.17.1.el6uek.x86_64) #Oracle Linux Server release 6.4
FLAGS += -DSSD_BIOVEC_PHYS_MERGEABLE_FIXED
endif
KERNELDIR ?= /lib/modules/$(KVER)/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KERNELDIR) M=$(PWD) EXTRA_CFLAGS="$(FLAGS)" modules
clean:
rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions Module.*
install: default
mkdir -p $(PREFIX)/$(MODDIR)
install -m 444 $(MOD) $(PREFIX)/$(MODDIR)
@if [ "$(PREFIX)" = "" ]; then /sbin/depmod -a ;\
else echo " *** Run 'depmod -a' to update the module database.";\
fi
endif
This diff is collapsed.
/*
* Huawei SSD device driver
* Copyright (c) 2016, Huawei Technologies Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*/
#ifndef _HIO_H
#define _HIO_H
#include <linux/types.h>
#include <linux/genhd.h>
#include <linux/blkdev.h>
#include <linux/genhd.h>
typedef int (*ssd_event_call)(struct gendisk *, int, int); /* gendisk, event id, event level */
extern int ssd_register_event_notifier(struct block_device *bdev, ssd_event_call event_call);
/* unregister event notifier before module exit */
extern int ssd_unregister_event_notifier(struct block_device *bdev);
/* label */
#define SSD_LABEL_FIELD_SZ 32
#define SSD_SN_SZ 16
typedef struct ssd_label
{
char date[SSD_LABEL_FIELD_SZ];
char sn[SSD_LABEL_FIELD_SZ];
char part[SSD_LABEL_FIELD_SZ];
char desc[SSD_LABEL_FIELD_SZ];
char other[SSD_LABEL_FIELD_SZ];
char maf[SSD_LABEL_FIELD_SZ];
} ssd_label_t;
/* version */
typedef struct ssd_version_info
{
uint32_t bridge_ver; /* bridge fw version: hex */
uint32_t ctrl_ver; /* controller fw version: hex */
uint32_t bm_ver; /* battery manager fw version: hex */
uint8_t pcb_ver; /* main pcb version: char */
uint8_t upper_pcb_ver;
uint8_t pad0;
uint8_t pad1;
} ssd_version_info_t;
extern int ssd_get_label(struct block_device *bdev, struct ssd_label *label);
extern int ssd_get_version(struct block_device *bdev, struct ssd_version_info *ver);
extern int ssd_get_temperature(struct block_device *bdev, int *temp);
enum ssd_bmstatus
{
SSD_BMSTATUS_OK = 0,
SSD_BMSTATUS_CHARGING,
SSD_BMSTATUS_WARNING
};
extern int ssd_bm_status(struct block_device *bdev, int *status);
enum ssd_otprotect
{
SSD_OTPROTECT_OFF = 0,
SSD_OTPROTECT_ON
};
extern int ssd_set_otprotect(struct block_device *bdev, int otprotect);
typedef struct pci_addr
{
uint16_t domain;
uint8_t bus;
uint8_t slot;
uint8_t func;
} pci_addr_t;
extern int ssd_get_pciaddr(struct block_device *bdev, struct pci_addr *paddr);
/* submit phys bio: phys addr in iovec */
extern void ssd_submit_pbio(struct request_queue *q, struct bio *bio);
extern int ssd_reset(struct block_device *bdev);
enum ssd_write_mode
{
SSD_WMODE_BUFFER = 0,
SSD_WMODE_BUFFER_EX,
SSD_WMODE_FUA,
/* dummy */
SSD_WMODE_AUTO,
SSD_WMODE_DEFAULT
};
extern int ssd_set_wmode(struct block_device *bdev, int wmode);
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment