Aamir Bohra has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/34582 )
Change subject: soc/intel/common/block/uart: Update the UART PCI device reference ......................................................................
soc/intel/common/block/uart: Update the UART PCI device reference
This implementation revises the UART PCI device reference in common UART driver. The SOC functions have been aligned to provide the UART PCI device refernce using pcidev_path_on_root.
Change-Id: Ie0fe5991f3b0b9c596c3de9472e98e4091d7dd87 Signed-off-by: Aamir Bohra aamir.bohra@intel.com --- M src/soc/intel/apollolake/uart.c M src/soc/intel/cannonlake/uart.c M src/soc/intel/common/block/uart/uart.c M src/soc/intel/icelake/uart.c M src/soc/intel/skylake/uart.c 5 files changed, 19 insertions(+), 16 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/82/34582/1
diff --git a/src/soc/intel/apollolake/uart.c b/src/soc/intel/apollolake/uart.c index 27be4e6..de07a80 100644 --- a/src/soc/intel/apollolake/uart.c +++ b/src/soc/intel/apollolake/uart.c @@ -82,13 +82,13 @@ */ switch (uart_console) { case 0: - return (struct device *)PCH_DEV_UART0; + return (struct device *)pcidev_path_on_root(PCH_DEVFN_UART0); case 1: - return (struct device *)PCH_DEV_UART1; + return (struct device *)pcidev_path_on_root(PCH_DEVFN_UART1); case 2: - return (struct device *)PCH_DEV_UART2; + return (struct device *)pcidev_path_on_root(PCH_DEVFN_UART2); case 3: - return (struct device *)PCH_DEV_UART3; + return (struct device *)pcidev_path_on_root(PCH_DEVFN_UART3); default: printk(BIOS_ERR, "Invalid UART console index\n"); return NULL; diff --git a/src/soc/intel/cannonlake/uart.c b/src/soc/intel/cannonlake/uart.c index 7174a9a..1909996 100644 --- a/src/soc/intel/cannonlake/uart.c +++ b/src/soc/intel/cannonlake/uart.c @@ -58,11 +58,11 @@ */ switch (uart_console) { case 0: - return (struct device *)PCH_DEV_UART0; + return (struct device *)pcidev_path_on_root(PCH_DEVFN_UART0); case 1: - return (struct device *)PCH_DEV_UART1; + return (struct device *)pcidev_path_on_root(PCH_DEVFN_UART1); case 2: - return (struct device *)PCH_DEV_UART2; + return (struct device *)pcidev_path_on_root(PCH_DEVFN_UART2); default: printk(BIOS_ERR, "Invalid UART console index\n"); return NULL; diff --git a/src/soc/intel/common/block/uart/uart.c b/src/soc/intel/common/block/uart/uart.c index 82e5df4..6a4765d 100644 --- a/src/soc/intel/common/block/uart/uart.c +++ b/src/soc/intel/common/block/uart/uart.c @@ -71,7 +71,8 @@ void uart_common_init(struct device *device, uintptr_t baseaddr) { #if defined(__SIMPLE_DEVICE__) - pci_devfn_t dev = (pci_devfn_t)(uintptr_t)device; + unsigned int devfn = device->path.pci.devfn; + pci_devfn_t dev = PCI_DEV(0, PCI_SLOT(devfn), PCI_FUNC(devfn)); #else struct device *dev = device; #endif @@ -108,11 +109,13 @@ bool uart_is_controller_initialized(void) { uintptr_t base; + struct device *dev_uart = uart_get_device();
#if defined(__SIMPLE_DEVICE__) - pci_devfn_t dev = (pci_devfn_t)(uintptr_t)uart_get_device(); + unsigned int devfn = dev_uart->path.pci.devfn; + pci_devfn_t dev = PCI_DEV(0, PCI_SLOT(devfn), PCI_FUNC(devfn)); #else - struct device *dev = uart_get_device(); + struct device *dev = dev_uart; #endif if (!dev) return false; diff --git a/src/soc/intel/icelake/uart.c b/src/soc/intel/icelake/uart.c index 7174a9a..1909996 100644 --- a/src/soc/intel/icelake/uart.c +++ b/src/soc/intel/icelake/uart.c @@ -58,11 +58,11 @@ */ switch (uart_console) { case 0: - return (struct device *)PCH_DEV_UART0; + return (struct device *)pcidev_path_on_root(PCH_DEVFN_UART0); case 1: - return (struct device *)PCH_DEV_UART1; + return (struct device *)pcidev_path_on_root(PCH_DEVFN_UART1); case 2: - return (struct device *)PCH_DEV_UART2; + return (struct device *)pcidev_path_on_root(PCH_DEVFN_UART2); default: printk(BIOS_ERR, "Invalid UART console index\n"); return NULL; diff --git a/src/soc/intel/skylake/uart.c b/src/soc/intel/skylake/uart.c index 8b7c99e..ee181dc 100644 --- a/src/soc/intel/skylake/uart.c +++ b/src/soc/intel/skylake/uart.c @@ -59,11 +59,11 @@ */ switch (uart_console) { case 0: - return (struct device *)PCH_DEV_UART0; + return (struct device *)pcidev_path_on_root(PCH_DEVFN_UART0); case 1: - return (struct device *)PCH_DEV_UART1; + return (struct device *)pcidev_path_on_root(PCH_DEVFN_UART1); case 2: - return (struct device *)PCH_DEV_UART2; + return (struct device *)pcidev_path_on_root(PCH_DEVFN_UART2); default: printk(BIOS_ERR, "Invalid UART console index\n"); return NULL;