Searched refs:kcs (Results 1 - 3 of 3) sorted by relevance

/linux-4.1.27/drivers/char/ipmi/
H A Dipmi_kcs_sm.c143 static unsigned int init_kcs_data(struct si_sm_data *kcs, init_kcs_data() argument
146 kcs->state = KCS_IDLE; init_kcs_data()
147 kcs->io = io; init_kcs_data()
148 kcs->write_pos = 0; init_kcs_data()
149 kcs->write_count = 0; init_kcs_data()
150 kcs->orig_write_count = 0; init_kcs_data()
151 kcs->read_pos = 0; init_kcs_data()
152 kcs->error_retries = 0; init_kcs_data()
153 kcs->truncated = 0; init_kcs_data()
154 kcs->ibf_timeout = IBF_RETRY_TIMEOUT; init_kcs_data()
155 kcs->obf_timeout = OBF_RETRY_TIMEOUT; init_kcs_data()
161 static inline unsigned char read_status(struct si_sm_data *kcs) read_status() argument
163 return kcs->io->inputb(kcs->io, 1); read_status()
166 static inline unsigned char read_data(struct si_sm_data *kcs) read_data() argument
168 return kcs->io->inputb(kcs->io, 0); read_data()
171 static inline void write_cmd(struct si_sm_data *kcs, unsigned char data) write_cmd() argument
173 kcs->io->outputb(kcs->io, 1, data); write_cmd()
176 static inline void write_data(struct si_sm_data *kcs, unsigned char data) write_data() argument
178 kcs->io->outputb(kcs->io, 0, data); write_data()
198 static inline void write_next_byte(struct si_sm_data *kcs) write_next_byte() argument
200 write_data(kcs, kcs->write_data[kcs->write_pos]); write_next_byte()
201 (kcs->write_pos)++; write_next_byte()
202 (kcs->write_count)--; write_next_byte()
205 static inline void start_error_recovery(struct si_sm_data *kcs, char *reason) start_error_recovery() argument
207 (kcs->error_retries)++; start_error_recovery()
208 if (kcs->error_retries > MAX_ERROR_RETRIES) { start_error_recovery()
210 printk(KERN_DEBUG "ipmi_kcs_sm: kcs hosed: %s\n", start_error_recovery()
212 kcs->state = KCS_HOSED; start_error_recovery()
214 kcs->error0_timeout = jiffies + ERROR0_OBF_WAIT_JIFFIES; start_error_recovery()
215 kcs->state = KCS_ERROR0; start_error_recovery()
219 static inline void read_next_byte(struct si_sm_data *kcs) read_next_byte() argument
221 if (kcs->read_pos >= MAX_KCS_READ_SIZE) { read_next_byte()
223 read_data(kcs); read_next_byte()
224 kcs->truncated = 1; read_next_byte()
226 kcs->read_data[kcs->read_pos] = read_data(kcs); read_next_byte()
227 (kcs->read_pos)++; read_next_byte()
229 write_data(kcs, KCS_READ_BYTE); read_next_byte()
232 static inline int check_ibf(struct si_sm_data *kcs, unsigned char status, check_ibf() argument
236 kcs->ibf_timeout -= time; check_ibf()
237 if (kcs->ibf_timeout < 0) { check_ibf()
238 start_error_recovery(kcs, "IBF not ready in time"); check_ibf()
239 kcs->ibf_timeout = IBF_RETRY_TIMEOUT; check_ibf()
244 kcs->ibf_timeout = IBF_RETRY_TIMEOUT; check_ibf()
248 static inline int check_obf(struct si_sm_data *kcs, unsigned char status, check_obf() argument
252 kcs->obf_timeout -= time; check_obf()
253 if (kcs->obf_timeout < 0) { check_obf()
254 kcs->obf_timeout = OBF_RETRY_TIMEOUT; check_obf()
255 start_error_recovery(kcs, "OBF not ready in time"); check_obf()
260 kcs->obf_timeout = OBF_RETRY_TIMEOUT; check_obf()
264 static void clear_obf(struct si_sm_data *kcs, unsigned char status) clear_obf() argument
267 read_data(kcs); clear_obf()
270 static void restart_kcs_transaction(struct si_sm_data *kcs) restart_kcs_transaction() argument
272 kcs->write_count = kcs->orig_write_count; restart_kcs_transaction()
273 kcs->write_pos = 0; restart_kcs_transaction()
274 kcs->read_pos = 0; restart_kcs_transaction()
275 kcs->state = KCS_WAIT_WRITE_START; restart_kcs_transaction()
276 kcs->ibf_timeout = IBF_RETRY_TIMEOUT; restart_kcs_transaction()
277 kcs->obf_timeout = OBF_RETRY_TIMEOUT; restart_kcs_transaction()
278 write_cmd(kcs, KCS_WRITE_START); restart_kcs_transaction()
281 static int start_kcs_transaction(struct si_sm_data *kcs, unsigned char *data, start_kcs_transaction() argument
291 if ((kcs->state != KCS_IDLE) && (kcs->state != KCS_HOSED)) start_kcs_transaction()
300 kcs->error_retries = 0; start_kcs_transaction()
301 memcpy(kcs->write_data, data, size); start_kcs_transaction()
302 kcs->write_count = size; start_kcs_transaction()
303 kcs->orig_write_count = size; start_kcs_transaction()
304 kcs->write_pos = 0; start_kcs_transaction()
305 kcs->read_pos = 0; start_kcs_transaction()
306 kcs->state = KCS_START_OP; start_kcs_transaction()
307 kcs->ibf_timeout = IBF_RETRY_TIMEOUT; start_kcs_transaction()
308 kcs->obf_timeout = OBF_RETRY_TIMEOUT; start_kcs_transaction()
312 static int get_kcs_result(struct si_sm_data *kcs, unsigned char *data, get_kcs_result() argument
315 if (length < kcs->read_pos) { get_kcs_result()
316 kcs->read_pos = length; get_kcs_result()
317 kcs->truncated = 1; get_kcs_result()
320 memcpy(data, kcs->read_data, kcs->read_pos); get_kcs_result()
322 if ((length >= 3) && (kcs->read_pos < 3)) { get_kcs_result()
326 kcs->read_pos = 3; get_kcs_result()
328 if (kcs->truncated) { get_kcs_result()
335 kcs->truncated = 0; get_kcs_result()
338 return kcs->read_pos; get_kcs_result()
346 static enum si_sm_result kcs_event(struct si_sm_data *kcs, long time) kcs_event() argument
351 status = read_status(kcs); kcs_event()
354 printk(KERN_DEBUG "KCS: State = %d, %x\n", kcs->state, status); kcs_event()
357 if (!check_ibf(kcs, status, time)) kcs_event()
363 switch (kcs->state) { kcs_event()
366 clear_obf(kcs, status); kcs_event()
375 start_error_recovery(kcs, kcs_event()
380 clear_obf(kcs, status); kcs_event()
381 write_cmd(kcs, KCS_WRITE_START); kcs_event()
382 kcs->state = KCS_WAIT_WRITE_START; kcs_event()
388 kcs, kcs_event()
392 read_data(kcs); kcs_event()
393 if (kcs->write_count == 1) { kcs_event()
394 write_cmd(kcs, KCS_WRITE_END); kcs_event()
395 kcs->state = KCS_WAIT_WRITE_END; kcs_event()
397 write_next_byte(kcs); kcs_event()
398 kcs->state = KCS_WAIT_WRITE; kcs_event()
404 start_error_recovery(kcs, kcs_event()
408 clear_obf(kcs, status); kcs_event()
409 if (kcs->write_count == 1) { kcs_event()
410 write_cmd(kcs, KCS_WRITE_END); kcs_event()
411 kcs->state = KCS_WAIT_WRITE_END; kcs_event()
413 write_next_byte(kcs); kcs_event()
419 start_error_recovery(kcs, kcs_event()
424 clear_obf(kcs, status); kcs_event()
425 write_next_byte(kcs); kcs_event()
426 kcs->state = KCS_WAIT_READ; kcs_event()
432 kcs, kcs_event()
438 if (!check_obf(kcs, status, time)) kcs_event()
440 read_next_byte(kcs); kcs_event()
451 clear_obf(kcs, status); kcs_event()
452 kcs->orig_write_count = 0; kcs_event()
453 kcs->state = KCS_IDLE; kcs_event()
459 clear_obf(kcs, status); kcs_event()
460 status = read_status(kcs); kcs_event()
463 if (time_before(jiffies, kcs->error0_timeout)) kcs_event()
465 write_cmd(kcs, KCS_GET_STATUS_ABORT); kcs_event()
466 kcs->state = KCS_ERROR1; kcs_event()
470 clear_obf(kcs, status); kcs_event()
471 write_data(kcs, 0); kcs_event()
472 kcs->state = KCS_ERROR2; kcs_event()
477 start_error_recovery(kcs, kcs_event()
481 if (!check_obf(kcs, status, time)) kcs_event()
484 clear_obf(kcs, status); kcs_event()
485 write_data(kcs, KCS_READ_BYTE); kcs_event()
486 kcs->state = KCS_ERROR3; kcs_event()
491 start_error_recovery(kcs, kcs_event()
496 if (!check_obf(kcs, status, time)) kcs_event()
499 clear_obf(kcs, status); kcs_event()
500 if (kcs->orig_write_count) { kcs_event()
501 restart_kcs_transaction(kcs); kcs_event()
503 kcs->state = KCS_IDLE; kcs_event()
512 if (kcs->state == KCS_HOSED) { kcs_event()
513 init_kcs_data(kcs, kcs->io); kcs_event()
525 static int kcs_detect(struct si_sm_data *kcs) kcs_detect() argument
533 if (read_status(kcs) == 0xff) kcs_detect()
539 static void kcs_cleanup(struct si_sm_data *kcs) kcs_cleanup() argument
H A Dipmi_si_intf.c109 static char *si_to_str[] = { "kcs", "smic", "bt" };
1365 " interface separated by commas. The types are 'kcs',"
1366 " 'smic', and 'bt'. For example si_type=kcs,bt will set"
1367 " the first interface to kcs and the second to bt");
1700 * add|remove,kcs|bt|smic,mem|i/o,<address>[,<opt1>[,<opt2>[,...]]]
1719 { "kcs", SI_KCS },
1978 if (!si_type[i] || strcmp(si_type[i], "kcs") == 0) { hardcode_find_bmc()
2786 { .type = "ipmi", .compatible = "ipmi-kcs",
H A Dipmi_smic_sm.c583 static void smic_cleanup(struct si_sm_data *kcs) smic_cleanup() argument

Completed in 122 milliseconds