Lines Matching +full:ssif +full:- +full:bmc

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
74 device_t dev = sc->ipmi_dev; in ssif_polled_request()
75 device_t smbus = sc->ipmi_ssif_smbus; in ssif_polled_request()
88 ssif_buf[0] = req->ir_addr; in ssif_polled_request()
89 ssif_buf[1] = req->ir_command; in ssif_polled_request()
90 if (req->ir_requestlen > 0) in ssif_polled_request()
91 bcopy(req->ir_request, &ssif_buf[2], in ssif_polled_request()
92 min(req->ir_requestlen, SMBUS_DATA_SIZE - 2)); in ssif_polled_request()
95 if (req->ir_requestlen <= 30) { in ssif_polled_request()
98 req->ir_requestlen + 2); in ssif_polled_request()
101 sc->ipmi_ssif_smbus_address, SMBUS_WRITE_SINGLE, in ssif_polled_request()
102 req->ir_requestlen + 2, ssif_buf)); in ssif_polled_request()
105 device_printf(dev, "SSIF: WRITE_SINGLE error %d\n", in ssif_polled_request()
111 /* Longer requests are sent out in 32-byte messages. */ in ssif_polled_request()
116 sc->ipmi_ssif_smbus_address, SMBUS_WRITE_START, in ssif_polled_request()
120 device_printf(dev, "SSIF: WRITE_START error %d\n", in ssif_polled_request()
126 len = req->ir_requestlen - (SMBUS_DATA_SIZE - 2); in ssif_polled_request()
127 cp = req->ir_request + (SMBUS_DATA_SIZE - 2); in ssif_polled_request()
134 sc->ipmi_ssif_smbus_address, SMBUS_WRITE_CONT, in ssif_polled_request()
138 device_printf(dev, "SSIF: WRITE_CONT error %d\n", in ssif_polled_request()
144 len -= SMBUS_DATA_SIZE; in ssif_polled_request()
148 * The final WRITE_CONT transaction has to have a non-zero in ssif_polled_request()
161 sc->ipmi_ssif_smbus_address, SMBUS_WRITE_CONT, in ssif_polled_request()
165 device_printf(dev, "SSIF: WRITE_CONT error %d\n", in ssif_polled_request()
176 /* Give the BMC 100ms to chew on the request. */ in ssif_polled_request()
185 sc->ipmi_ssif_smbus_address, SMBUS_READ_START, &count, ssif_buf)); in ssif_polled_request()
189 device_printf(dev, "SSIF: READ_START retry\n"); in ssif_polled_request()
191 /* Give the BMC another 10ms. */ in ssif_polled_request()
197 device_printf(dev, "SSIF: READ_START failed: %d\n", error); in ssif_polled_request()
202 device_printf(dev, "SSIF: READ_START: ok\n"); in ssif_polled_request()
206 * If this is the first part of a multi-part read, then we need to in ssif_polled_request()
216 device_printf(dev, "SSIF: Short reply packet\n"); in ssif_polled_request()
221 if (ssif_buf[offset] != IPMI_REPLY_ADDR(req->ir_addr)) { in ssif_polled_request()
222 device_printf(dev, "SSIF: Reply address mismatch\n"); in ssif_polled_request()
227 if (ssif_buf[offset + 1] != req->ir_command) { in ssif_polled_request()
233 req->ir_compcode = ssif_buf[offset + 2]; in ssif_polled_request()
240 len = count - 3; in ssif_polled_request()
241 bcopy(&ssif_buf[3], req->ir_reply, in ssif_polled_request()
242 min(req->ir_replybuflen, len)); in ssif_polled_request()
247 * This is the first part of a multi-read transaction, so copy in ssif_polled_request()
251 dump_buffer(dev, "READ_START", ssif_buf + 2, count - 2); in ssif_polled_request()
253 bcopy(&ssif_buf[5], req->ir_reply, min(req->ir_replybuflen, count - 5)); in ssif_polled_request()
254 len = count - 5; in ssif_polled_request()
261 sc->ipmi_ssif_smbus_address, SMBUS_READ_CONT, &count, in ssif_polled_request()
265 printf("SSIF: READ_CONT failed: %d\n", error); in ssif_polled_request()
270 device_printf(dev, "SSIF: READ_CONT... ok\n"); in ssif_polled_request()
275 device_printf(dev, "SSIF: Read wrong block %d %d\n", in ssif_polled_request()
281 "SSIF: Read short middle block, length %d\n", in ssif_polled_request()
287 dump_buffer(dev, "READ_END", ssif_buf + 1, count - 1); in ssif_polled_request()
289 dump_buffer(dev, "READ_CONT", ssif_buf + 1, count - 1); in ssif_polled_request()
291 if (len < req->ir_replybuflen) in ssif_polled_request()
292 bcopy(&ssif_buf[1], &req->ir_reply[len], in ssif_polled_request()
293 min(req->ir_replybuflen - len, count - 1)); in ssif_polled_request()
294 len += count - 1; in ssif_polled_request()
304 req->ir_replylen = len; in ssif_polled_request()
332 device_printf(sc->ipmi_dev, in ssif_loop()
333 "SSIF: Retrying request (%d)\n", i + 1); in ssif_loop()
337 req->ir_error = 0; in ssif_loop()
339 req->ir_error = EIO; in ssif_loop()
357 return (kproc_create(ssif_loop, sc, &sc->ipmi_kthread, 0, 0, in ssif_startup()
358 "%s: ssif", device_get_nameunit(sc->ipmi_dev))); in ssif_startup()
369 error = msleep(req, &sc->ipmi_requests_lock, 0, "ipmireq", 0); in ssif_driver_request()
371 error = req->ir_error; in ssif_driver_request()
381 sc->ipmi_ssif_smbus = smbus; in ipmi_ssif_attach()
382 sc->ipmi_ssif_smbus_address = smbus_address; in ipmi_ssif_attach()
385 sc->ipmi_startup = ssif_startup; in ipmi_ssif_attach()
386 sc->ipmi_enqueue_request = ipmi_polled_enqueue_request; in ipmi_ssif_attach()
387 sc->ipmi_driver_request = ssif_driver_request; in ipmi_ssif_attach()