Age | Commit message (Collapse) | Author | Files | Lines |
|
A USB 3 device uses an exponential encoding of the max packet size for
the default end point.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
Some boards ask for a large amount of ram for scratch pad usage, and
it is possible the allocation will fail.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
These functions are no longer used. Going forward it's better to move
a driver to full 32bit mode then to use these functions.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
Since the XHCI driver needs to jump into 32bit mode anyway, it is
simpler to just run all of the code in 32bit mode.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
At least some real-world controllers expect the endpoint count in the
inctx to be accurate, so set it to the pipe currently being activated.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
At least some real-world controllers require 64 byte contexts. Detect
this case and handle it appropriately.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
Eliminate the xhci_device struct by storing the slotid in usbdevice_s
and in xhci_pipe. The remaining storage in that struct (xhci_devctx)
is available from xhci->devs.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
It's easier to run the set_address from xhci_alloc_pipe as there is
more information available there.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
The inctx struct isn't long lived, so it doesn't need to be allocated
in permanent memory.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
Be sure to set the interval parameter when creating an interrupt based
pipe.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
The status part of a control message was likely to have an incorrect
direction set.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
At least some real-world XHCI controllers expect a 64bit write to the
ERDP register.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
Untested. Anyone who tried to get xhci run on real hardware
is welcome to test whenever this patch improves things.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
The qTD structures were not being cleared in ehci_alloc_intr_pipe()
and it was possible that garbage could have been in some of the
fields. Also, memset the data array for sanity purposes.
A similar fix is in the Chromium seabios repo (3e711dc261).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
When init_virtio_scsi() finds no SCSI targets connected to the HBA, it
frees the virtio ring. Other code in SeaBIOS proceeds to overwrite the
area. However, the ring is in use by qemu at that point -- not only did we
report the (ACK|DRIVER|DRIVER_OK) status earlier, we even communicated
over the ring.
Of course SeaBIOS doesn't "kick" the HBA ever again, hence qemu has no
reason to look at the ring. However, when qemu uses KVM acceleration, and
ioeventfd is enabled for the HBA, then a vmstate change to "running"
(including stop->cont monitor commands and incoming migration) "forces" a
kick (see qemu commit 25db9ebe). Qemu then tries to interpret whatever
unrelated guest data is in the HBA's original ring area, as virtio
protocol. Qemu exits upon seeing the garbage.
init_virtio_scsi() should reset the HBA before allowing the virtio ring
memory to be reused. Device reset causes the hypervisor to drop its
references.
This change is justified / underpinned by pure virtio-spec compliance as
well.
Related RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1013418
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
|
|
The previous code attempts to correlate which UHCI and OHCI
controllers correlate with which EHCI controllers so that it can
ensure high speed devices are handled by the EHCI code while low/full
speed devices are handled by the UHCI/OHCI code. Replace this logic
by initializing all EHCI controllers first, and then initializing all
UHCI and OHCI controllers. This simplifies the code and improves
support for some hardware devices that don't follow the OHCI/UHCI to
EHCI correlation standard.
Also, remove the unused usb->busid field.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
Now that pvscsi runs entirely in 32bit mode, there is no need to use
the memory segment access macros.
This also fixes up an incorrect memcpy and memset call.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
Instead of jumping into 32bit mode to access the PCI config space, run
the entire driver in 32bit mode.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
The pci_device reference isn't used by pvscsi, and it's confusing to
keep a long held reference to a short lived object.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
Now that the op->count field is cleared in a global location on simple
errors, remove various local clears done in individual drivers.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
It appears that on real hardware, floppies require a seek command to
move the floppy head between cylinders. So, track what cylinder is
active and issue a seek command whenever a new cylinder is requested.
This also breaks up the floppy_cmd() code so that the low-level
command functions can pass the desired cylinder directly to the
seeking code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
The regs->ch field contains the cylinder to format on a disk_1305
call. Verify that parameter and pass to the low-level driver code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
Eliminate struct floppy_pio_s and change floppy_pio() to take the
command type and parameters in a single encoded value. This makes the
code similar to the ps2port.c pio code. It also reduces some of the
boilerplate code in the callers of floppy_pio().
Also, collapse pairs of floppy_select_drive() and floppy_pio() calls
into new call floppy_drive_pio().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
The DOR register is a write-only register (even though QEMU and at
least some real hardware permit read/write acess). So, do not read
from the DOR port. Introduce a VARLOW variable (FloppyDOR) to store
the current state.
When resetting the controller, make sure to enable both the controller
and interrupts. Also, make sure the controller is really reset (by
writing a 0 to DOR first) to ensure an IRQ is received on reset.
Also, add some additional dprintf statements to the floppy init path.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
The floppy LBA to CHS translation was incorrect for the last sector of
a given cylinder. This wasn't a problem under QEMU as it came to the
same results anyway, but it causes errors of real floppy controllers.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
Avoid hardware specific code in output.c. This will reduce the amount
of change needed to output.c as support for more serial hardware is
added.
This patch also renames some functions to improve the naming scheme.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
With ahci running in 32bit mode we can also allocate the
(ahci private) data structures in high memory. This
reduces the real mode memory footprint as we only need
to move struct ahci_port_s (which contains struct drive_s)
to fseg in case the port probe was successful.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
Minor cleanups.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
Not needed any more now that ahci runs in 32bit mode
all the time. Script-based search & replace.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
The PCI device structures are only available during the POST phase.
Don't attempt to access them from the runtime disk driver code.
This patch has not been tested, but the old code is definitely
incorrect.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
The "drive" structure is always malloc'ed and therefore always starts
off described as a 32-bit "flat" pointer. Instead of switching
to/from 16bit pointers, make all the code use the 32bit pointer. This
eliminates the confusing 16/32 bit pointer switches.
This patch also removes the "_g" suffixes on local variables in
functions that are always called in 32bit mode.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
`speed_from_xhci[16]`
Using Debian clang version 3.4-1 (trunk) (based on LLVM 3.4) to build
SeaBIOS, the switch `-Winitializer-overrides` results in the following
warnings.
$ CC=clang make
[…]
Compile checking out/src/hw/usb-xhci.o
clang: warning: argument unused during compilation: '-mpreferred-stack-boundary=2'
clang: warning: argument unused during compilation: '-minline-all-stringops'
clang: warning: argument unused during compilation: '-fno-delete-null-pointer-checks'
src/hw/usb-xhci.c:281:13: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
[ 1 ] = USB_FULLSPEED,
^~~~~~~~~~~~~
src/hw/usb.h:68:24: note: expanded from macro 'USB_FULLSPEED'
^
src/hw/usb-xhci.c:280:20: note: previous initialization is here
[ 0 ... 15 ] = -1,
^~
src/hw/usb-xhci.c:282:13: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
[ 2 ] = USB_LOWSPEED,
^~~~~~~~~~~~
src/hw/usb.h:69:24: note: expanded from macro 'USB_LOWSPEED'
^
src/hw/usb-xhci.c:280:20: note: previous initialization is here
[ 0 ... 15 ] = -1,
^~
src/hw/usb-xhci.c:283:13: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
[ 3 ] = USB_HIGHSPEED,
^~~~~~~~~~~~~
src/hw/usb.h:70:24: note: expanded from macro 'USB_HIGHSPEED'
^
src/hw/usb-xhci.c:280:20: note: previous initialization is here
[ 0 ... 15 ] = -1,
^~
src/hw/usb-xhci.c:284:13: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
[ 4 ] = USB_SUPERSPEED,
^~~~~~~~~~~~~~
src/hw/usb.h:71:24: note: expanded from macro 'USB_SUPERSPEED'
^
src/hw/usb-xhci.c:280:20: note: previous initialization is here
[ 0 ... 15 ] = -1,
^~
Refactor the code a little to get rid of the warnings.
Signed-off-by: Paul Menzel <paulepanter@users.sourceforge.net>
|
|
Testing was done on windows images (win 2008/2012) taken from esx with vmware
tools installed and boot disk configured to use pvscsi.
Also I've used linux (ubuntu 12.04) where pvscsi drivers are installed by
default and booted it using qemu cmd similar to this:
./x86_64-softmmu/qemu-system-x86_64 -snapshot -device pvscsi,id=pvscsi0 \
-device scsi-disk,bus=pvscsi0.0,drive=drive0 \
-drive id=drive0,if=none,file=ubuntu-12.04.qcow2 \
-bios roms/seabios/out/bios.bin
Signed-off-by: Evgeny Budilovsky <evgeny.budilovsky@ravellosystems.com>
|
|
The ahci driver needs to jump into 32bit mode in order to access
portions of the ahci controllers PCI config space. Instead of jumping
into 32bit mode just to toggle the ahci registers, jump into 32bit
mode for all of the driver interactions. This shrinks the size of the
overall code and can lead to further cleanups.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
Rename the fields of 'struct chs_s' so that it can be used both to
describe a drive and to describe a particular sector on a drive.
Update floppy.c:lba2chs() to return a 'struct chs_s' instead of
passing the results via pointers.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
Move the inb(), insb(), etc. code from ioport.h to x86.h. Move the
PORT_* definitions to their appropriate hardware files.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
Move the DMA controller code in resume.c and hw/floppy.c to a new file
hw/dma.c. This centralizes the DMA controller code into one place.
Also, don't unmask the floppy DRQ during floppy setup - there is no
reason to unmask the DRQ prior to a command being programmed into the
DMA controller.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
Group the Real Time Clock code into hw/rtc.[ch].
Also, use rtc_read/write/mask function naming (instead of
inb/outb_cmos) to be more consistent with other register accessors.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
Move the hardware setup to the hw/timer.c code. This eliminates the
need for a separate hw/pit.h file with definitions.
Also, move the IRQ counting code (which is dependent on the BDA) from
hw/timer.c to clock.c.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
$subject says all. Support for usb3 streams is not implemented yet,
otherwise it is fully functional. Tested all usb devices supported
by qemu (keyboard, storage, usb hubs), except for usb attached scsi
in usb3 mode (which needs streams).
Tested on qemu only, tagged with QEMU_HARDWARE because of that.
Testing with physical hardware to be done.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
Preparation for better xhci support: allows to notify host controllers
instead of going through a free+alloc cycle.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
The segoff_s definition is used by a number of header files that would
not otherwise need farptr.h, so move it to a more central location.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|