riscv: qemu: Enable usb keyboard as an input device

This brings PCI xHCI support to QEMU RISC-V and uses a usb keyboard
as one of the input devices.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Bin Meng 2023-07-23 12:40:41 +08:00 committed by Leo Yu-Chi Liang
parent 124308e67b
commit 02be57caf7
4 changed files with 16 additions and 1 deletions

View file

@ -76,5 +76,10 @@ config BOARD_SPECIFIC_OPTIONS # dummy
imply VIDEO_BOCHS
imply SYS_WHITE_ON_BLACK
imply PRE_CONSOLE_BUFFER
imply USB
imply USB_XHCI_HCD
imply USB_XHCI_PCI
imply USB_KEYBOARD
imply CMD_USB
endif

View file

@ -12,6 +12,7 @@
#include <log.h>
#include <spl.h>
#include <init.h>
#include <usb.h>
#include <virtio_types.h>
#include <virtio.h>
@ -41,6 +42,10 @@ int board_init(void)
int board_late_init(void)
{
/* start usb so that usb keyboard can be used as input device */
if (CONFIG_IS_ENABLED(USB_KEYBOARD))
usb_init();
return 0;
}

View file

@ -138,6 +138,11 @@ and adding::
-serial stdio -device VGA
In addition, a usb keyboard can be attached to an emulated xHCI controller in
RISC-V virt machine as an option of input devices by adding::
-device qemu-xhci,id=xhci -device usb-kbd,bus=xhci.0
Running with KVM
----------------

View file

@ -17,7 +17,7 @@
/* Environment options */
#define CFG_STD_DEVICES_SETTINGS "stdin=serial\0" \
#define CFG_STD_DEVICES_SETTINGS "stdin=serial,usbkbd\0" \
"stdout=serial,vidconsole\0" \
"stderr=serial,vidconsole\0"