xhci: allocate scratch pad buffers

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>
xhci: Use 64bit writes to ERDP register.

At least some real-world XHCI controllers expect a 64bit write to the
ERDP register.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
xhci: Fix incorrect direction setting on status transmissions.

The status part of a control message was likely to have an incorrect
direction set.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
xhci: Set the interval parameter on interrupt pipes.

Be sure to set the interval parameter when creating an interrupt based
pipe.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
xhci: Verify PAGESIZE register before initializing driver.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
xhci: Allocate and free the xhci inctx structure on each use.

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>
xhci: Move set_address code from xhci_control to xhci_alloc_pipe.

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>
xhci: Eliminate 'struct xhci_device'.

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>
xhci: Support xhci controllers with 64 byte contexts.

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>
xhci: Allow the XHCI USB controller to be enabled for coreboot.

Initial tests look promising and at least two different real-world
chipsets show limited functionality with the support enabled.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
xhci: Don't use a dummy endpoint count in configure command.

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>
xhci: Report the "protocol defined" and PSIC bits of extended capabilities.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
xhci: Hack to get hubs working.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add call32_params() helper function.

Add helper function for calling 32bit functions with more than just
one parameter.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add space between DTYPE_* definitions.

Avoi consective numbering on the DTYPE_* definitions.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
xhci: Run the XHCI driver entirely in 32bit mode.

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>
Remove pci_writel() and pci_readl() functions.

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>
xhci: Check if scratch pad allocation fails.

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>