diff options
Diffstat (limited to 'include/linux/ipmi_smi.h')
-rw-r--r-- | include/linux/ipmi_smi.h | 129 |
1 files changed, 69 insertions, 60 deletions
diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h index af457b5a689e..7d5fd38d5282 100644 --- a/include/linux/ipmi_smi.h +++ b/include/linux/ipmi_smi.h | |||
@@ -22,8 +22,10 @@ | |||
22 | 22 | ||
23 | struct device; | 23 | struct device; |
24 | 24 | ||
25 | /* This files describes the interface for IPMI system management interface | 25 | /* |
26 | drivers to bind into the IPMI message handler. */ | 26 | * This files describes the interface for IPMI system management interface |
27 | * drivers to bind into the IPMI message handler. | ||
28 | */ | ||
27 | 29 | ||
28 | /* Structure for the low-level drivers. */ | 30 | /* Structure for the low-level drivers. */ |
29 | typedef struct ipmi_smi *ipmi_smi_t; | 31 | typedef struct ipmi_smi *ipmi_smi_t; |
@@ -61,12 +63,20 @@ struct ipmi_smi_msg { | |||
61 | struct ipmi_smi_handlers { | 63 | struct ipmi_smi_handlers { |
62 | struct module *owner; | 64 | struct module *owner; |
63 | 65 | ||
64 | /* The low-level interface cannot start sending messages to | 66 | /* |
65 | the upper layer until this function is called. This may | 67 | * The low-level interface cannot start sending messages to |
66 | not be NULL, the lower layer must take the interface from | 68 | * the upper layer until this function is called. This may |
67 | this call. */ | 69 | * not be NULL, the lower layer must take the interface from |
68 | int (*start_processing)(void *send_info, | 70 | * this call. |
69 | ipmi_smi_t new_intf); | 71 | */ |
72 | int (*start_processing)(void *send_info, | ||
73 | struct ipmi_smi *new_intf); | ||
74 | |||
75 | /* | ||
76 | * When called, the low-level interface should disable all | ||
77 | * processing, it should be complete shut down when it returns. | ||
78 | */ | ||
79 | void (*shutdown)(void *send_info); | ||
70 | 80 | ||
71 | /* | 81 | /* |
72 | * Get the detailed private info of the low level interface and store | 82 | * Get the detailed private info of the low level interface and store |
@@ -75,25 +85,31 @@ struct ipmi_smi_handlers { | |||
75 | */ | 85 | */ |
76 | int (*get_smi_info)(void *send_info, struct ipmi_smi_info *data); | 86 | int (*get_smi_info)(void *send_info, struct ipmi_smi_info *data); |
77 | 87 | ||
78 | /* Called to enqueue an SMI message to be sent. This | 88 | /* |
79 | operation is not allowed to fail. If an error occurs, it | 89 | * Called to enqueue an SMI message to be sent. This |
80 | should report back the error in a received message. It may | 90 | * operation is not allowed to fail. If an error occurs, it |
81 | do this in the current call context, since no write locks | 91 | * should report back the error in a received message. It may |
82 | are held when this is run. Message are delivered one at | 92 | * do this in the current call context, since no write locks |
83 | a time by the message handler, a new message will not be | 93 | * are held when this is run. Message are delivered one at |
84 | delivered until the previous message is returned. */ | 94 | * a time by the message handler, a new message will not be |
95 | * delivered until the previous message is returned. | ||
96 | */ | ||
85 | void (*sender)(void *send_info, | 97 | void (*sender)(void *send_info, |
86 | struct ipmi_smi_msg *msg); | 98 | struct ipmi_smi_msg *msg); |
87 | 99 | ||
88 | /* Called by the upper layer to request that we try to get | 100 | /* |
89 | events from the BMC we are attached to. */ | 101 | * Called by the upper layer to request that we try to get |
102 | * events from the BMC we are attached to. | ||
103 | */ | ||
90 | void (*request_events)(void *send_info); | 104 | void (*request_events)(void *send_info); |
91 | 105 | ||
92 | /* Called by the upper layer when some user requires that the | 106 | /* |
93 | interface watch for events, received messages, watchdog | 107 | * Called by the upper layer when some user requires that the |
94 | pretimeouts, or not. Used by the SMI to know if it should | 108 | * interface watch for events, received messages, watchdog |
95 | watch for these. This may be NULL if the SMI does not | 109 | * pretimeouts, or not. Used by the SMI to know if it should |
96 | implement it. */ | 110 | * watch for these. This may be NULL if the SMI does not |
111 | * implement it. | ||
112 | */ | ||
97 | void (*set_need_watch)(void *send_info, bool enable); | 113 | void (*set_need_watch)(void *send_info, bool enable); |
98 | 114 | ||
99 | /* | 115 | /* |
@@ -101,30 +117,29 @@ struct ipmi_smi_handlers { | |||
101 | */ | 117 | */ |
102 | void (*flush_messages)(void *send_info); | 118 | void (*flush_messages)(void *send_info); |
103 | 119 | ||
104 | /* Called when the interface should go into "run to | 120 | /* |
105 | completion" mode. If this call sets the value to true, the | 121 | * Called when the interface should go into "run to |
106 | interface should make sure that all messages are flushed | 122 | * completion" mode. If this call sets the value to true, the |
107 | out and that none are pending, and any new requests are run | 123 | * interface should make sure that all messages are flushed |
108 | to completion immediately. */ | 124 | * out and that none are pending, and any new requests are run |
125 | * to completion immediately. | ||
126 | */ | ||
109 | void (*set_run_to_completion)(void *send_info, bool run_to_completion); | 127 | void (*set_run_to_completion)(void *send_info, bool run_to_completion); |
110 | 128 | ||
111 | /* Called to poll for work to do. This is so upper layers can | 129 | /* |
112 | poll for operations during things like crash dumps. */ | 130 | * Called to poll for work to do. This is so upper layers can |
131 | * poll for operations during things like crash dumps. | ||
132 | */ | ||
113 | void (*poll)(void *send_info); | 133 | void (*poll)(void *send_info); |
114 | 134 | ||
115 | /* Enable/disable firmware maintenance mode. Note that this | 135 | /* |
116 | is *not* the modes defined, this is simply an on/off | 136 | * Enable/disable firmware maintenance mode. Note that this |
117 | setting. The message handler does the mode handling. Note | 137 | * is *not* the modes defined, this is simply an on/off |
118 | that this is called from interrupt context, so it cannot | 138 | * setting. The message handler does the mode handling. Note |
119 | block. */ | 139 | * that this is called from interrupt context, so it cannot |
140 | * block. | ||
141 | */ | ||
120 | void (*set_maintenance_mode)(void *send_info, bool enable); | 142 | void (*set_maintenance_mode)(void *send_info, bool enable); |
121 | |||
122 | /* Tell the handler that we are using it/not using it. The | ||
123 | message handler get the modules that this handler belongs | ||
124 | to; this function lets the SMI claim any modules that it | ||
125 | uses. These may be NULL if this is not required. */ | ||
126 | int (*inc_usecount)(void *send_info); | ||
127 | void (*dec_usecount)(void *send_info); | ||
128 | }; | 143 | }; |
129 | 144 | ||
130 | struct ipmi_device_id { | 145 | struct ipmi_device_id { |
@@ -143,7 +158,8 @@ struct ipmi_device_id { | |||
143 | #define ipmi_version_major(v) ((v)->ipmi_version & 0xf) | 158 | #define ipmi_version_major(v) ((v)->ipmi_version & 0xf) |
144 | #define ipmi_version_minor(v) ((v)->ipmi_version >> 4) | 159 | #define ipmi_version_minor(v) ((v)->ipmi_version >> 4) |
145 | 160 | ||
146 | /* Take a pointer to an IPMI response and extract device id information from | 161 | /* |
162 | * Take a pointer to an IPMI response and extract device id information from | ||
147 | * it. @netfn is in the IPMI_NETFN_ format, so may need to be shifted from | 163 | * it. @netfn is in the IPMI_NETFN_ format, so may need to be shifted from |
148 | * a SI response. | 164 | * a SI response. |
149 | */ | 165 | */ |
@@ -187,12 +203,14 @@ static inline int ipmi_demangle_device_id(uint8_t netfn, uint8_t cmd, | |||
187 | return 0; | 203 | return 0; |
188 | } | 204 | } |
189 | 205 | ||
190 | /* Add a low-level interface to the IPMI driver. Note that if the | 206 | /* |
191 | interface doesn't know its slave address, it should pass in zero. | 207 | * Add a low-level interface to the IPMI driver. Note that if the |
192 | The low-level interface should not deliver any messages to the | 208 | * interface doesn't know its slave address, it should pass in zero. |
193 | upper layer until the start_processing() function in the handlers | 209 | * The low-level interface should not deliver any messages to the |
194 | is called, and the lower layer must get the interface from that | 210 | * upper layer until the start_processing() function in the handlers |
195 | call. */ | 211 | * is called, and the lower layer must get the interface from that |
212 | * call. | ||
213 | */ | ||
196 | int ipmi_register_smi(const struct ipmi_smi_handlers *handlers, | 214 | int ipmi_register_smi(const struct ipmi_smi_handlers *handlers, |
197 | void *send_info, | 215 | void *send_info, |
198 | struct device *dev, | 216 | struct device *dev, |
@@ -202,7 +220,7 @@ int ipmi_register_smi(const struct ipmi_smi_handlers *handlers, | |||
202 | * Remove a low-level interface from the IPMI driver. This will | 220 | * Remove a low-level interface from the IPMI driver. This will |
203 | * return an error if the interface is still in use by a user. | 221 | * return an error if the interface is still in use by a user. |
204 | */ | 222 | */ |
205 | int ipmi_unregister_smi(ipmi_smi_t intf); | 223 | void ipmi_unregister_smi(struct ipmi_smi *intf); |
206 | 224 | ||
207 | /* | 225 | /* |
208 | * The lower layer reports received messages through this interface. | 226 | * The lower layer reports received messages through this interface. |
@@ -210,11 +228,11 @@ int ipmi_unregister_smi(ipmi_smi_t intf); | |||
210 | * the lower layer gets an error sending a message, it should format | 228 | * the lower layer gets an error sending a message, it should format |
211 | * an error response in the message response. | 229 | * an error response in the message response. |
212 | */ | 230 | */ |
213 | void ipmi_smi_msg_received(ipmi_smi_t intf, | 231 | void ipmi_smi_msg_received(struct ipmi_smi *intf, |
214 | struct ipmi_smi_msg *msg); | 232 | struct ipmi_smi_msg *msg); |
215 | 233 | ||
216 | /* The lower layer received a watchdog pre-timeout on interface. */ | 234 | /* The lower layer received a watchdog pre-timeout on interface. */ |
217 | void ipmi_smi_watchdog_pretimeout(ipmi_smi_t intf); | 235 | void ipmi_smi_watchdog_pretimeout(struct ipmi_smi *intf); |
218 | 236 | ||
219 | struct ipmi_smi_msg *ipmi_alloc_smi_msg(void); | 237 | struct ipmi_smi_msg *ipmi_alloc_smi_msg(void); |
220 | static inline void ipmi_free_smi_msg(struct ipmi_smi_msg *msg) | 238 | static inline void ipmi_free_smi_msg(struct ipmi_smi_msg *msg) |
@@ -222,13 +240,4 @@ static inline void ipmi_free_smi_msg(struct ipmi_smi_msg *msg) | |||
222 | msg->done(msg); | 240 | msg->done(msg); |
223 | } | 241 | } |
224 | 242 | ||
225 | #ifdef CONFIG_IPMI_PROC_INTERFACE | ||
226 | /* Allow the lower layer to add things to the proc filesystem | ||
227 | directory for this interface. Note that the entry will | ||
228 | automatically be dstroyed when the interface is destroyed. */ | ||
229 | int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name, | ||
230 | const struct file_operations *proc_ops, | ||
231 | void *data); | ||
232 | #endif | ||
233 | |||
234 | #endif /* __LINUX_IPMI_SMI_H */ | 243 | #endif /* __LINUX_IPMI_SMI_H */ |