From db4254e2dff110b1f0c7d4d95e3e6f4395c44380 Mon Sep 17 00:00:00 2001 From: Minggui Cao Date: Thu, 29 Nov 2018 14:59:10 +0800 Subject: [PATCH] HV: find and hide serial PCI dev from service OS serial PCI device is just used for HV/SOS output debug information; because it is used in hypervisor layer, SOS should not touch it. so need to check and hide it from SOS. Tracked-On: #1923 Signed-off-by: Minggui Cao Acked-by: Eddie Dong --- hypervisor/debug/uart16550.c | 13 +++++++++++++ hypervisor/dm/hw/pci.c | 6 ++++++ hypervisor/include/debug/console.h | 1 + hypervisor/release/console.c | 1 + 4 files changed, 21 insertions(+) diff --git a/hypervisor/debug/uart16550.c b/hypervisor/debug/uart16550.c index 05fefb322..bd90fc0d6 100644 --- a/hypervisor/debug/uart16550.c +++ b/hypervisor/debug/uart16550.c @@ -182,3 +182,16 @@ void uart16550_set_property(bool enabled, bool port_mapped, uint64_t base_addr) serial_port_mapped = port_mapped; uart_base_address = base_addr; } + +bool is_pci_dbg_uart(union pci_bdf bdf_value) +{ + bool ret = false; + + if (uart_enabled && !serial_port_mapped) { + if (bdf_value.value == serial_pci_bdf.value) { + ret = true; + } + } + + return ret; +} diff --git a/hypervisor/dm/hw/pci.c b/hypervisor/dm/hw/pci.c index b3b63d4c7..594255544 100644 --- a/hypervisor/dm/hw/pci.c +++ b/hypervisor/dm/hw/pci.c @@ -155,6 +155,12 @@ void pci_scan_bus(pci_enumeration_cb cb_func, void *cb_data) continue; } + /* if it is debug uart, hide it from SOS */ + if (is_pci_dbg_uart(pbdf)) { + pr_info("hide pci uart dev: (%x:%x:%x)", pbdf.bits.b, pbdf.bits.d, pbdf.bits.f); + continue; + } + if (cb_func != NULL) { cb_func(pbdf.value, cb_data); } diff --git a/hypervisor/include/debug/console.h b/hypervisor/include/debug/console.h index 90af4e53c..ede919699 100644 --- a/hypervisor/include/debug/console.h +++ b/hypervisor/include/debug/console.h @@ -37,6 +37,7 @@ char console_getc(void); void console_setup_timer(void); void uart16550_set_property(bool enabled, bool port_mapped, uint64_t base_addr); +bool is_pci_dbg_uart(union pci_bdf bdf_value); void shell_init(void); void shell_kick(void); diff --git a/hypervisor/release/console.c b/hypervisor/release/console.c index a8b672af8..71878b76a 100644 --- a/hypervisor/release/console.c +++ b/hypervisor/release/console.c @@ -25,6 +25,7 @@ void suspend_console(void) {} void resume_console(void) {} void uart16550_set_property(__unused bool enabled, __unused bool port_mapped, __unused uint64_t base_addr) {} +bool is_pci_dbg_uart(__unused union pci_bdf bdf_value) { return false; } void shell_init(void) {} void shell_kick(void) {}