
On 15 October 2018 at 03:21, Bin Meng bmeng.cn@gmail.com wrote:
This adds a new virtio uclass driver for “virtio” [1] family of devices that are are found in virtual environments like QEMU, yet by design they look like physical devices to the guest.
The uclass driver provides child_pre_probe() and child_post_probe() methods to do some common operations for virtio device drivers like device and driver supported feature negotiation, etc.
[1] http://docs.oasis-open.org/virtio/virtio/v1.0/virtio-v1.0.pdf
Signed-off-by: Tuomas Tynkkynen tuomas.tynkkynen@iki.fi Signed-off-by: Bin Meng bmeng.cn@gmail.com
Changes in v3: None Changes in v2:
- Added virtio spec link and a short statement of what virtio is in the header and source files
- Changed to use 'transport' over 'bus' in drivers/virtio/Kconfig
- Added UCLASS_VIRTIO ID in alphabetical order
- Moved the header file inclusion from virtio.h to C file
- Fixed code styling issue (blank line before return) in virtio_xxx() APIs
- Changed virtio_init() to return int if there is an error
- Added virtio_uclass_pre_probe() to check virtio transport driver ops here so that we don't need check these ops each time when the virtio_xxx APIs are called
- Implemented child_post_remove() method to reset the virtio device
- Changed virtio_driver_features_init() parameter 'feature' and 'feature_legacy' to const, and adjust member of 'struct virtio_dev_priv' accordingly
- Initialize uc_priv->vqs in virtio_uclass_post_probe()
drivers/Kconfig | 2 + drivers/Makefile | 1 + drivers/virtio/Kconfig | 25 ++ drivers/virtio/Makefile | 6 + drivers/virtio/virtio-uclass.c | 369 +++++++++++++++++++++ include/dm/uclass-id.h | 1 + include/virtio.h | 707 +++++++++++++++++++++++++++++++++++++++++ include/virtio_types.h | 24 ++ 8 files changed, 1135 insertions(+) create mode 100644 drivers/virtio/Kconfig create mode 100644 drivers/virtio/Makefile create mode 100644 drivers/virtio/virtio-uclass.c create mode 100644 include/virtio.h create mode 100644 include/virtio_types.h
Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot-dm/next, thanks!