From fb387dfb920f73abb144183b8a41dc917e2e32da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Fri, 7 Jun 2013 22:16:52 +0300 Subject: usbdebug: Drop duplicates of EHCI BAR relocation code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All the additional work that needs to be done in EHCI BAR relocation is independent of the hardware platform and was functionally identical in all the copies removed. When USBDEBUG is not selected, PCI EHCI controllers use standard pci_dev_read_resources() call. With USBDEBUG selected, PCI EHCI controller's device_operations .read_resources is replaced with pci_ehci_read_resources() call, which in turn will replace the device_operations .set_resources call. The replacement for .set_resources reconfigures usbdebug driver side, and calls the original .set_resources to configure hardware side. Change-Id: I8e136a5da4efedf60b6dd7068c0488153efaaf8e Signed-off-by: Kyösti Mälkki Reviewed-on: http://review.coreboot.org/3412 Reviewed-by: Aaron Durbin Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel --- src/include/ehci.h | 2 -- src/include/usbdebug.h | 19 ++++++++++++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) (limited to 'src/include') diff --git a/src/include/ehci.h b/src/include/ehci.h index 7ec9810f62..b096f42761 100644 --- a/src/include/ehci.h +++ b/src/include/ehci.h @@ -23,8 +23,6 @@ #ifndef EHCI_H #define EHCI_H -#define EHCI_BAR_INDEX 0x10 - /* EHCI register interface, corresponds to EHCI Revision 0.95 specification */ /* Section 2.2 Host Controller Capability Registers */ diff --git a/src/include/usbdebug.h b/src/include/usbdebug.h index c3b34377fa..990312aa34 100644 --- a/src/include/usbdebug.h +++ b/src/include/usbdebug.h @@ -21,7 +21,24 @@ #ifndef USBDEBUG_H #define USBDEBUG_H -#include +#define EHCI_BAR_INDEX 0x10 + +#ifndef __PRE_RAM__ +#if !CONFIG_USBDEBUG +#define pci_ehci_read_resources pci_dev_read_resources +#else +/* Relocation of EHCI Debug Port BAR + * + * PCI EHCI controller with Debug Port capability shall replace + * pci_dev_read_resources() with pci_ehci_read_resources() in its + * declaration of device_operations for .read_resources. + * This installs a hook to reconfigure usbdebug when resource allocator + * assigns a new BAR for the device. + */ +struct device; +void pci_ehci_read_resources(struct device *dev); +#endif +#endif struct ehci_debug_info { void *ehci_caps; -- cgit v1.2.3