Blame view
include/linux/enclosure.h
4.02 KB
82c298100 treewide: Replace... |
1 |
/* SPDX-License-Identifier: GPL-2.0-only */ |
d569d5bb3 [SCSI] enclosure:... |
2 3 4 5 6 7 8 |
/* * Enclosure Services * * Copyright (C) 2008 James Bottomley <James.Bottomley@HansenPartnership.com> * **----------------------------------------------------------------------------- ** |
d569d5bb3 [SCSI] enclosure:... |
9 10 11 12 13 14 15 16 17 18 19 20 |
** **----------------------------------------------------------------------------- */ #ifndef _LINUX_ENCLOSURE_H_ #define _LINUX_ENCLOSURE_H_ #include <linux/device.h> #include <linux/list.h> /* A few generic types ... taken from ses-2 */ enum enclosure_component_type { ENCLOSURE_COMPONENT_DEVICE = 0x01, |
5e1033561 ses: fix addition... |
21 22 23 |
ENCLOSURE_COMPONENT_CONTROLLER_ELECTRONICS = 0x07, ENCLOSURE_COMPONENT_SCSI_TARGET_PORT = 0x14, ENCLOSURE_COMPONENT_SCSI_INITIATOR_PORT = 0x15, |
d569d5bb3 [SCSI] enclosure:... |
24 |
ENCLOSURE_COMPONENT_ARRAY_DEVICE = 0x17, |
5e1033561 ses: fix addition... |
25 |
ENCLOSURE_COMPONENT_SAS_EXPANDER = 0x18, |
d569d5bb3 [SCSI] enclosure:... |
26 27 28 29 30 31 32 33 34 35 36 37 |
}; /* ses-2 common element status */ enum enclosure_status { ENCLOSURE_STATUS_UNSUPPORTED = 0, ENCLOSURE_STATUS_OK, ENCLOSURE_STATUS_CRITICAL, ENCLOSURE_STATUS_NON_CRITICAL, ENCLOSURE_STATUS_UNRECOVERABLE, ENCLOSURE_STATUS_NOT_INSTALLED, ENCLOSURE_STATUS_UNKNOWN, ENCLOSURE_STATUS_UNAVAILABLE, |
cc9b2e9f6 [SCSI] enclosure:... |
38 39 |
/* last element for counting purposes */ ENCLOSURE_STATUS_MAX |
d569d5bb3 [SCSI] enclosure:... |
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
}; /* SFF-8485 activity light settings */ enum enclosure_component_setting { ENCLOSURE_SETTING_DISABLED = 0, ENCLOSURE_SETTING_ENABLED = 1, ENCLOSURE_SETTING_BLINK_A_ON_OFF = 2, ENCLOSURE_SETTING_BLINK_A_OFF_ON = 3, ENCLOSURE_SETTING_BLINK_B_ON_OFF = 6, ENCLOSURE_SETTING_BLINK_B_OFF_ON = 7, }; struct enclosure_device; struct enclosure_component; struct enclosure_component_callbacks { void (*get_status)(struct enclosure_device *, struct enclosure_component *); int (*set_status)(struct enclosure_device *, struct enclosure_component *, enum enclosure_status); void (*get_fault)(struct enclosure_device *, struct enclosure_component *); int (*set_fault)(struct enclosure_device *, struct enclosure_component *, enum enclosure_component_setting); void (*get_active)(struct enclosure_device *, struct enclosure_component *); int (*set_active)(struct enclosure_device *, struct enclosure_component *, enum enclosure_component_setting); void (*get_locate)(struct enclosure_device *, struct enclosure_component *); int (*set_locate)(struct enclosure_device *, struct enclosure_component *, enum enclosure_component_setting); |
08024885a ses: Add power_st... |
75 76 77 78 79 |
void (*get_power_status)(struct enclosure_device *, struct enclosure_component *); int (*set_power_status)(struct enclosure_device *, struct enclosure_component *, int); |
967f7bab0 ses: add enclosur... |
80 |
int (*show_id)(struct enclosure_device *, char *buf); |
d569d5bb3 [SCSI] enclosure:... |
81 82 83 84 85 |
}; struct enclosure_component { void *scratch; |
ee959b00c SCSI: convert str... |
86 87 |
struct device cdev; struct device *dev; |
d569d5bb3 [SCSI] enclosure:... |
88 89 90 91 92 |
enum enclosure_component_type type; int number; int fault; int active; int locate; |
921ce7f57 ses: add reliable... |
93 |
int slot; |
d569d5bb3 [SCSI] enclosure:... |
94 |
enum enclosure_status status; |
08024885a ses: Add power_st... |
95 |
int power_status; |
d569d5bb3 [SCSI] enclosure:... |
96 97 98 99 100 |
}; struct enclosure_device { void *scratch; struct list_head node; |
ee959b00c SCSI: convert str... |
101 |
struct device edev; |
d569d5bb3 [SCSI] enclosure:... |
102 103 |
struct enclosure_component_callbacks *cb; int components; |
192199464 enclosure.h: Repl... |
104 |
struct enclosure_component component[]; |
d569d5bb3 [SCSI] enclosure:... |
105 106 107 |
}; static inline struct enclosure_device * |
ee959b00c SCSI: convert str... |
108 |
to_enclosure_device(struct device *dev) |
d569d5bb3 [SCSI] enclosure:... |
109 |
{ |
ee959b00c SCSI: convert str... |
110 |
return container_of(dev, struct enclosure_device, edev); |
d569d5bb3 [SCSI] enclosure:... |
111 112 113 |
} static inline struct enclosure_component * |
ee959b00c SCSI: convert str... |
114 |
to_enclosure_component(struct device *dev) |
d569d5bb3 [SCSI] enclosure:... |
115 116 117 118 119 120 121 122 123 |
{ return container_of(dev, struct enclosure_component, cdev); } struct enclosure_device * enclosure_register(struct device *, const char *, int, struct enclosure_component_callbacks *); void enclosure_unregister(struct enclosure_device *); struct enclosure_component * |
ed09dcc8b ses: close potent... |
124 125 126 |
enclosure_component_alloc(struct enclosure_device *, unsigned int, enum enclosure_component_type, const char *); int enclosure_component_register(struct enclosure_component *); |
d569d5bb3 [SCSI] enclosure:... |
127 128 |
int enclosure_add_device(struct enclosure_device *enclosure, int component, struct device *dev); |
43d8eb9cf [SCSI] ses: add s... |
129 |
int enclosure_remove_device(struct enclosure_device *, struct device *); |
163f52b6c [SCSI] ses: fix h... |
130 131 |
struct enclosure_device *enclosure_find(struct device *dev, struct enclosure_device *start); |
d569d5bb3 [SCSI] enclosure:... |
132 133 134 135 |
int enclosure_for_each_device(int (*fn)(struct enclosure_device *, void *), void *data); #endif /* _LINUX_ENCLOSURE_H_ */ |