XenevaOS
Loading...
Searching...
No Matches
virtio_rng.h
Go to the documentation of this file.
1#ifndef _LINUX_VIRTIO_RNG_H
2#define _LINUX_VIRTIO_RNG_H
3
4/*
5 * DCL <linux/virtio_rng.h> -- the virtio entropy device's IDs.
6 *
7 * mainline's uapi header includes <linux/virtio_ids.h> and
8 * <linux/virtio_config.h> and defines nothing of its own; its whole job is to
9 * give a driver the device type it matches on. DCL keeps one <linux/virtio.h>
10 * instead of that pair, so this header is the same shape minus the middle
11 * hop: include virtio.h, then define VIRTIO_ID_RNG.
12 *
13 * The id is mainline's, from include/uapi/linux/virtio_ids.h:
14 *
15 * #define VIRTIO_ID_RNG 4
16 *
17 * and it has to be 4 rather than any local numbering, because that is what
18 * the device reports: virtio_shim.c's virtio_device_type() computes the type
19 * as (PCI device id - 0x1040), and QEMU's virtio-rng-pci with
20 * disable-legacy=on enumerates as 1AF4:1044 -> 0x1044 - 0x1040 = 4. Get this
21 * number wrong and virtio_rng_detect() finds the device, probe never runs, and
22 * the only symptom is that hwrng_register() is never called.
23 */
24
25#include <linux/virtio.h>
26
27#ifndef VIRTIO_ID_RNG
28#define VIRTIO_ID_RNG 4
29#endif
30
31#endif /* _LINUX_VIRTIO_RNG_H */