| 362 | } |
| 363 | |
| 364 | static int |
| 365 | aw_sid_sysctl(SYSCTL_HANDLER_ARGS) |
| 366 | { |
| 367 | struct aw_sid_softc *sc; |
| 368 | device_t dev = arg1; |
| 369 | enum aw_sid_fuse_id fuse = arg2; |
| 370 | uint8_t data[32]; |
| 371 | char out[128]; |
| 372 | uint32_t size; |
| 373 | int ret, i; |
| 374 | |
| 375 | sc = device_get_softc(dev); |
| 376 | |
| 377 | /* Get the size of the efuse data */ |
| 378 | size = 0; |
| 379 | aw_sid_get_fuse(fuse, NULL, &size); |
| 380 | /* We now have the real size */ |
| 381 | ret = aw_sid_get_fuse(fuse, data, &size); |
| 382 | if (ret != 0) { |
| 383 | device_printf(dev, "Cannot get fuse id %d: %d\n", fuse, ret); |
| 384 | return (ENOENT); |
| 385 | } |
| 386 | |
| 387 | for (i = 0; i < size; i++) |
| 388 | snprintf(out + (i * 2), sizeof(out) - (i * 2), |
| 389 | "%.2x", data[i]); |
| 390 | |
| 391 | return sysctl_handle_string(oidp, out, sizeof(out), req); |
| 392 | } |
| 393 | |
| 394 | static device_method_t aw_sid_methods[] = { |
| 395 | /* Device interface */ |
nothing calls this directly
no test coverage detected