From patchwork Thu Mar 22 09:52:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 148205 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 28670B6F13 for ; Thu, 22 Mar 2012 20:52:57 +1100 (EST) Received: from localhost ([::1]:35603 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SAehL-0006YL-0h for incoming@patchwork.ozlabs.org; Thu, 22 Mar 2012 05:52:47 -0400 Received: from eggs.gnu.org ([208.118.235.92]:38778) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SAeh9-0006X2-DR for qemu-devel@nongnu.org; Thu, 22 Mar 2012 05:52:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SAeh3-0003L3-2X for qemu-devel@nongnu.org; Thu, 22 Mar 2012 05:52:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49839) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SAeh2-0003Ku-Qe for qemu-devel@nongnu.org; Thu, 22 Mar 2012 05:52:28 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q2M9qRQS023222 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 22 Mar 2012 05:52:27 -0400 Received: from rincewind.home.kraxel.org (ovpn-116-31.ams2.redhat.com [10.36.116.31]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q2M9qQAu003053; Thu, 22 Mar 2012 05:52:26 -0400 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id B050F42888; Thu, 22 Mar 2012 10:52:25 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 22 Mar 2012 10:52:25 +0100 Message-Id: <1332409945-25378-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH] Add bootindex support to usb-host and usb-redir X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org When passing through a usb pendrive seabios will present it in the F12 boot menu and will happily boot from it. This patch adds bootorder support so you can even make it the default boot device. Signed-off-by: Gerd Hoffmann --- hw/usb/host-linux.c | 3 +++ hw/usb/redirect.c | 3 +++ 2 files changed, 6 insertions(+), 0 deletions(-) diff --git a/hw/usb/host-linux.c b/hw/usb/host-linux.c index 72f0306..f3d5a62 100644 --- a/hw/usb/host-linux.c +++ b/hw/usb/host-linux.c @@ -117,6 +117,7 @@ typedef struct USBHostDevice { int addr; char port[MAX_PORTLEN]; struct USBAutoFilter match; + int32_t bootindex; int seen, errcount; QTAILQ_ENTRY(USBHostDevice) next; @@ -1420,6 +1421,7 @@ static int usb_host_initfn(USBDevice *dev) if (s->match.bus_num != 0 && s->match.port != NULL) { usb_host_claim_port(s); } + add_boot_device_path(s->bootindex, &dev->qdev, NULL); return 0; } @@ -1435,6 +1437,7 @@ static Property usb_host_dev_properties[] = { DEFINE_PROP_HEX32("vendorid", USBHostDevice, match.vendor_id, 0), DEFINE_PROP_HEX32("productid", USBHostDevice, match.product_id, 0), DEFINE_PROP_UINT32("isobufs", USBHostDevice, iso_urb_count, 4), + DEFINE_PROP_INT32("bootindex", USBHostDevice, bootindex, -1), DEFINE_PROP_END_OF_LIST(), }; diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index 8e9f175..4288324 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -74,6 +74,7 @@ struct USBRedirDevice { CharDriverState *cs; uint8_t debug; char *filter_str; + int32_t bootindex; /* Data passed from chardev the fd_read cb to the usbredirparser read cb */ const uint8_t *read_buf; int read_buf_size; @@ -923,6 +924,7 @@ static int usbredir_initfn(USBDevice *udev) qemu_chr_add_handlers(dev->cs, usbredir_chardev_can_read, usbredir_chardev_read, usbredir_chardev_event, dev); + add_boot_device_path(dev->bootindex, &udev->qdev, NULL); return 0; } @@ -1452,6 +1454,7 @@ static Property usbredir_properties[] = { DEFINE_PROP_CHR("chardev", USBRedirDevice, cs), DEFINE_PROP_UINT8("debug", USBRedirDevice, debug, 0), DEFINE_PROP_STRING("filter", USBRedirDevice, filter_str), + DEFINE_PROP_INT32("bootindex", USBRedirDevice, bootindex, -1), DEFINE_PROP_END_OF_LIST(), };