[SeaBIOS] [PATCH] Support USB MSC devices with multiples LUNs
Paolo Bonzini
pbonzini at redhat.com
Wed Jun 13 08:05:44 CEST 2012
Il 13/06/2012 01:14, Kevin O'Connor ha scritto:
> On Tue, Jun 12, 2012 at 06:21:39PM +0200, Paolo Bonzini wrote:
>> Il 12/06/2012 03:32, Kevin O'Connor ha scritto:
>>> -int bootprio_find_usb(struct usbdevice_s *usbdev)
>>> +int bootprio_find_usb(struct usbdevice_s *usbdev, int lun)
>>> {
>>> if (!CONFIG_BOOTORDER)
>>> return -1;
>>> - // Find usb - for example: /pci at i0cf8/usb at 1,2/hub at 1/network at 0/ethernet at 0
>>> + // Find usb - for example: /pci at i0cf8/usb at 1,2/storage at 1/channel at 0/disk at 0,0
>>> char desc[256], *p;
>>> p = build_pci_path(desc, sizeof(desc), "usb", usbdev->hub->cntl->pci);
>>> p = build_usb_path(p, desc+sizeof(desc)-p, usbdev->hub);
>>> - snprintf(p, desc+sizeof(desc)-p, "/*@%x", usbdev->port+1);
>>> + snprintf(p, desc+sizeof(desc)-p, "/*@%x/*@0/*@0,%d", usbdev->port+1, lun);
>>> return find_prio(desc);
>>
>> This will not work if you're redirecting a USB device from the host,
>> because then you will not have the SCSI-specific elements of the path.
>> I suggest that you fall back to "/*@%x" if find_prio returns failure and
>> lun=0.
>
> Do you have an example of the bootorder syntax found for USB
> passthrough?
It's also something like /pci at i0cf8/usb at 1,2/*@1, but * could be usb-host
or usb-redir (the latter for USB-over-IP).
Can we add a parameter to find_prio for "do not match a longer string"?
Paolo
> The problem is that a shorter pattern match will match a longer
> string. So, if the bootorder contains:
>
> /pci at i0cf8/usb at 1,2/storage at 1/channel at 0/disk at 0,1
>
> and we search for "/pci at i0cf8/usb at 1,2/storage at 1/channel at 0/disk at 0,0"
> (no match) followed by a search for "/pci at i0cf8/usb at 1,2" then we'll
> match even though we clearly intended to catch the lun=1 disk and not
> the lun=0 disk.
>
> I'm not sure what the solution is.
>
> -Kevin
>
More information about the SeaBIOS
mailing list