aboutsummaryrefslogtreecommitdiff
path: root/src/hw
AgeCommit message (Collapse)AuthorFilesLines
2014-01-29usb: USB 3 devices encode bMaxPacketSize0 field.Kevin O'Connor1-4/+7
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>
2014-01-29xhci: Check if scratch pad allocation fails.Kevin O'Connor1-0/+6
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>
2014-01-29Remove pci_writel() and pci_readl() functions.Kevin O'Connor2-50/+0
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>
2014-01-29xhci: Run the XHCI driver entirely in 32bit mode.Kevin O'Connor6-11/+32
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>
2014-01-29xhci: Support USB hubs on xhci controllers.Kevin O'Connor1-10/+57
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-01-29xhci: Report the "protocol defined" and PSIC bits of extended capabilities.Kevin O'Connor1-2/+4
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-01-29xhci: Don't use a dummy endpoint count in configure command.Kevin O'Connor1-1/+1
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>
2014-01-29xhci: Support xhci controllers with 64 byte contexts.Kevin O'Connor2-36/+39
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>
2014-01-29xhci: Eliminate 'struct xhci_device'.Kevin O'Connor2-90/+57
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>
2014-01-29xhci: Move set_address code from xhci_control to xhci_alloc_pipe.Kevin O'Connor2-35/+36
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>
2014-01-29xhci: Allocate and free the xhci inctx structure on each use.Kevin O'Connor1-43/+61
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>
2014-01-29xhci: Verify PAGESIZE register before initializing driver.Kevin O'Connor1-7/+16
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-01-29xhci: Set the interval parameter on interrupt pipes.Kevin O'Connor1-0/+2
Be sure to set the interval parameter when creating an interrupt based pipe. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-01-29xhci: Fix incorrect direction setting on status transmissions.Kevin O'Connor1-3/+3
The status part of a control message was likely to have an incorrect direction set. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-01-29xhci: Use 64bit writes to ERDP register.Kevin O'Connor1-0/+1
At least some real-world XHCI controllers expect a 64bit write to the ERDP register. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-01-29xhci: allocate scratch pad buffersGerd Hoffmann1-0/+13
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>
2014-01-20ehci: memset the qTD structures in ehci_alloc_intr_pipeKevin O'Connor1-0/+2
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>
2014-01-17init_virtio_scsi(): reset the HBA before freeing its virtio ringLaszlo Ersek1-1/+3
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>
2013-12-27usb: Replace EHCI to UHCI/OHCI synchronization with new scheme.Kevin O'Connor10-127/+92
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>
2013-12-27pvscsi: Remove use of LOWFLAT and GLOBALFLAT macros.Kevin O'Connor1-41/+33
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>
2013-12-27pvscsi: Always run entirely in 32bit mode.Kevin O'Connor2-16/+17
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>
2013-12-27pvscsi: Don't store reference to struct pci_device.Kevin O'Connor1-2/+0
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>
2013-12-27Remove unnecesary updates of the disk op->count field.Kevin O'Connor7-37/+14
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>
2013-12-12floppy: Implement cylinder seeking when accessing a different cylinder.Kevin O'Connor1-38/+48
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>
2013-12-12On disk format request, verify cylinders and pass to driver.Kevin O'Connor1-2/+2
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>
2013-12-12floppy: Encode command and flags into single value in floppy pio code.Kevin O'Connor1-112/+93
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>
2013-12-07floppy: Fix accesses to DOR register.Kevin O'Connor1-7/+20
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>
2013-12-07floppy: Fix incorrect LBA to CHS translation.Kevin O'Connor1-3/+2
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>
2013-12-04floppy: Minor - add warnings if timeouts occur.Kevin O'Connor1-0/+3
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-12-04Move low-level hardware writing from output.c to new file hw/serialio.c.Kevin O'Connor2-0/+97
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>
2013-12-04ahci: alloc structs in high memoryGerd Hoffmann1-3/+3
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>
2013-12-04ahci: remote some parenthesesGerd Hoffmann1-3/+3
Minor cleanups. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-12-04ahci: zap real mode macrosGerd Hoffmann1-37/+37
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>
2013-10-26megasas: Don't attempt to access 'struct pci_device' at runtime.Kevin O'Connor1-3/+3
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>
2013-10-26Convert op->drive_g from a 16bit pointer to a 32 bit "GLOBALFLAT" pointer.Kevin O'Connor13-229/+233
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>
2013-10-26hw/usb-xhci.c: Code refactoring to not override initializers in ↵Paul Menzel1-1/+2
`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>
2013-10-26Add pvscsi boot supportEvgeny Budilovsky4-0/+377
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>
2013-10-14Run ahci code entirely in 32bit mode.Kevin O'Connor2-13/+7
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>
2013-10-14Rename fields of 'struct chs_s' and use in floppy lba2chs().Kevin O'Connor5-46/+46
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>
2013-09-28Remove ioport.h; disperse its contents to other header files.Kevin O'Connor17-13/+86
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>
2013-09-28Move dma code to new file hw/dma.c.Kevin O'Connor2-34/+62
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>
2013-09-28Rename hw/cmos.h to hw/rtc.h and copy RTC code from clock.c to hw/rtc.c.Kevin O'Connor4-34/+117
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>
2013-09-28Move PIT setup from clock.c to hw/timer.c.Kevin O'Connor2-54/+33
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>
2013-09-19usb: add xhci supportGerd Hoffmann5-7/+1295
$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>
2013-09-19usb: add usb_update_pipe()Gerd Hoffmann1-5/+17
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>
2013-09-19uas: add (temporary) superspeed stopgapGerd Hoffmann2-0/+5
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-09-18Merge bmp.h, boot.h, jpeg.h, and post.h into util.h.Kevin O'Connor12-12/+2
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-09-18Split disk.h into block.h and std/disk.h.Kevin O'Connor14-15/+27
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-09-18Move pirtable definitions from hw/pci.h to std/pirtable.h and util.h.Kevin O'Connor1-40/+0
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-09-18Move definition of struct segoff_s from farptr.h to types.h.Kevin O'Connor1-1/+0
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>