virtio.h: add virtio_has_feature api for virtio driver

Virtio driver can used this api to judge whether the this feature
is supported by both virtio driver and device.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
This commit is contained in:
Bowen Wang 2023-12-06 11:18:00 +08:00 committed by Xiang Xiao
parent 8b9c64eecf
commit 449197c188
1 changed files with 3 additions and 0 deletions

View File

@ -38,6 +38,9 @@
* Pre-processor Definitions
****************************************************************************/
#define virtio_has_feature(vdev, fbit) \
(((vdev)->features & (1UL << (fbit))) != 0)
#define virtio_read_config_member(vdev, structname, member, ptr) \
virtio_read_config((vdev), offsetof(structname, member), \
(ptr), sizeof(*(ptr)));