One thing that can make the shell operation easier is to do "connect -r" and then "map -r" to rebuild the driver stack and then the drive identifiers without having to exit and re-launch the shell to reconfigure the USB sticks.
-Jaben -----Original Message----- From: Laszlo Ersek [mailto:[email protected]] Sent: Tuesday, September 10, 2013 2:50 AM To: David F. Cc: [email protected] Subject: Re: [edk2] Hot Swap Bugs Hi David, On 09/10/13 03:04, Andrew Fish wrote: > I mostly use the EmulatorPkg that supports X64. The QEMU is actively > maintained and seems to generate a lot of traffic on this list. You can > map real USB devices in the emulator, and use that to simulate hot plug. > > The generic UEFI code is hardware agnostic, so perfect HW emulation is > not needed to replicate this issue. Not sure if there is an easy way to > emulate hot plug in QEMU or just map in a real USB device. > > Sent from my iPhone > > On Sep 9, 2013, at 5:29 PM, "David F." <[email protected] > <mailto:[email protected]>> wrote: > >> It's across different systems. Intel Mother Board, HP Systems, etc.. >> >> I tried using QEMU a while back and it wouldn't run correctly on this >> Win7 x64 system. The Nt32Pkg runs, but everything I have is x64. Do >> those environments have usb support combined with regular drives that >> USB can be hot swapped in and out several times to change contents on >> it. It's generally a problem using VM's as they are good only to a >> point, real hardware makes a difference. Install OVMF from Gerd's RPMs: http://www.kraxel.org/repos/ Create two small disks and copy different contents to them: unix2dos <<<"file 1" >f1.txt unix2dos <<<"file 2" >f2.txt qemu-img create -f qcow2 test1.img 64M qemu-img create -f qcow2 test2.img 64M guestfish -a test1.img -a test2.img run part-disk /dev/sda mbr mkfs vfat /dev/sda1 mount /dev/sda1 / copy-in f1.txt / umount / part-disk /dev/sdb mbr mkfs vfat /dev/sdb1 mount /dev/sdb1 / copy-in f2.txt / umount / q Start qemu: qemu-system-x86_64 \ -enable-kvm \ -m 1024 \ -L /usr/share/edk2.git/ovmf-x64 \ -bios /usr/share/edk2.git/ovmf-x64/OVMF-pure-efi.fd \ -device cirrus-vga \ -display vnc=localhost:0 \ -monitor stdio \ -S \ -debugcon file:/tmp/test.debug \ -global isa-debugcon.iobase=0x402 \ -net none \ -device usb-ehci,id=ehci \ -drive if=none,id=drive1,file=test1.img \ -drive if=none,id=drive2,file=test2.img This will start a VM that is paused and has - an EHCI controller, - no disk visible to the guest (the -drive options configure the backend (ie. host side), - a cirrus VGA card available via VNC, - and the qemu command monitor connected to stdio. Connect to the dispaly with vncviewer, issuing the command on another terminal: vncviewer localhost:5900 Unpause the guest using the qemu monitor: cont The UEFI shell should soon be running in the VM. Verify the mapping table -- no USB sticks should be visible: map -v It's time to attach the USB disk(s). Exit the UEFI shell, then while at the OVMF text-UI, issue the following two commands at the QEMU monitor: device_add usb-storage,id=stick1,bus=ehci.0,drive=drive1 device_add usb-storage,id=stick2,bus=ehci.0,drive=drive2 Launch the UEFI shell again from the OVMF text-UI, then enter map -v The two disks / files should be available as FS0:\F1.TXT and FS1:\F2.TXT. Exit the shell, and detach the 2nd disk at the QEMU monitor: device_del stick2 Re-launch the shell -- only the first disk should be available: map -v [...] type FS0:\F1.TXT file 1 type FS1:\F2.TXT Error. The file 'FS1:\F2.TXT' did not open. During testing, you can follow the edk2 EHCI/USB messages in "/tmp/test.debug" . For example, the disconnect (initiated by the "device_del" qemu command) generates the following for me: UsbEnumeratePort: port 1 state - 100, change - 01 on 3E8F5E18 UsbEnumeratePort: Device Connect/Disconnect Normally UsbEnumeratePort: device at port 1 removed from root hub 3E8F5E18 UsbDisconnectDriver: old TPL is 8, 3D659018 Success to stop non-multi-lun root handle UsbDisconnectDriver: TPL after disconnect is 8, 0 UsbRemoveDevice: device 2 removed UsbEnumeratePort: device disconnected event on port 1 EhcClearRootHubPortFeature: exit status Success And scrolling a bit back, 3E8F5E18 stands for the root hub: UsbRootHubInit: root hub 3E8F5E18 - max speed 2, 6 ports UsbBusStart: usb bus started on 3EA08498, root hub 3E8F5E18 [...] Connecting the disks generates another bunch of messages etc. Laszlo ------------------------------------------------------------------------------ How ServiceNow helps IT people transform IT departments: 1. Consolidate legacy IT systems to a single system of record for IT 2. Standardize and globalize service processes across IT 3. Implement zero-touch automation to replace manual, redundant tasks http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk _______________________________________________ edk2-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/edk2-devel ------------------------------------------------------------------------------ How ServiceNow helps IT people transform IT departments: 1. Consolidate legacy IT systems to a single system of record for IT 2. Standardize and globalize service processes across IT 3. Implement zero-touch automation to replace manual, redundant tasks http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk _______________________________________________ edk2-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/edk2-devel
