#include <linux/slab.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/enclosure.h>
#include <asm/unaligned.h>
#include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_dbg.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_driver.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_transport_sas.h>
struct ses_device { … };
struct ses_component { … };
static bool ses_page2_supported(struct enclosure_device *edev)
{ … }
static int ses_probe(struct device *dev)
{ … }
#define SES_TIMEOUT …
#define SES_RETRIES …
static void init_device_slot_control(unsigned char *dest_desc,
struct enclosure_component *ecomp,
unsigned char *status)
{ … }
static int ses_recv_diag(struct scsi_device *sdev, int page_code,
void *buf, int bufflen)
{ … }
static int ses_send_diag(struct scsi_device *sdev, int page_code,
void *buf, int bufflen)
{ … }
static int ses_set_page2_descriptor(struct enclosure_device *edev,
struct enclosure_component *ecomp,
unsigned char *desc)
{ … }
static unsigned char *ses_get_page2_descriptor(struct enclosure_device *edev,
struct enclosure_component *ecomp)
{ … }
static void ses_get_fault(struct enclosure_device *edev,
struct enclosure_component *ecomp)
{ … }
static int ses_set_fault(struct enclosure_device *edev,
struct enclosure_component *ecomp,
enum enclosure_component_setting val)
{ … }
static void ses_get_status(struct enclosure_device *edev,
struct enclosure_component *ecomp)
{ … }
static void ses_get_locate(struct enclosure_device *edev,
struct enclosure_component *ecomp)
{ … }
static int ses_set_locate(struct enclosure_device *edev,
struct enclosure_component *ecomp,
enum enclosure_component_setting val)
{ … }
static int ses_set_active(struct enclosure_device *edev,
struct enclosure_component *ecomp,
enum enclosure_component_setting val)
{ … }
static int ses_show_id(struct enclosure_device *edev, char *buf)
{ … }
static void ses_get_power_status(struct enclosure_device *edev,
struct enclosure_component *ecomp)
{ … }
static int ses_set_power_status(struct enclosure_device *edev,
struct enclosure_component *ecomp,
int val)
{ … }
static struct enclosure_component_callbacks ses_enclosure_callbacks = …;
struct ses_host_edev { … };
#if 0
int ses_match_host(struct enclosure_device *edev, void *data)
{
struct ses_host_edev *sed = data;
struct scsi_device *sdev;
if (!scsi_is_sdev_device(edev->edev.parent))
return 0;
sdev = to_scsi_device(edev->edev.parent);
if (sdev->host != sed->shost)
return 0;
sed->edev = edev;
return 1;
}
#endif
static int ses_process_descriptor(struct enclosure_component *ecomp,
unsigned char *desc, int max_desc_len)
{ … }
struct efd { … };
static int ses_enclosure_find_by_addr(struct enclosure_device *edev,
void *data)
{ … }
#define INIT_ALLOC_SIZE …
static void ses_enclosure_data_process(struct enclosure_device *edev,
struct scsi_device *sdev,
int create)
{ … }
static void ses_match_to_enclosure(struct enclosure_device *edev,
struct scsi_device *sdev,
int refresh)
{ … }
static int ses_intf_add(struct device *cdev)
{ … }
static int ses_remove(struct device *dev)
{ … }
static void ses_intf_remove_component(struct scsi_device *sdev)
{ … }
static void ses_intf_remove_enclosure(struct scsi_device *sdev)
{ … }
static void ses_intf_remove(struct device *cdev)
{ … }
static struct class_interface ses_interface = …;
static struct scsi_driver ses_template = …;
static int __init ses_init(void)
{ … }
static void __exit ses_exit(void)
{ … }
module_init(…) …;
module_exit(ses_exit);
MODULE_ALIAS_SCSI_DEVICE(…);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;