| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
#include <console/uart.h> |
| 10 |
#include <device/device.h> |
| 11 |
#include <device/pci.h> |
| 12 |
#include <device/pci_ops.h> |
| 13 |
#include <device/pci_ids.h> |
| 14 |
#include <soc/pci_devs.h> |
| 15 |
#include <console/console.h> |
| 16 |
#include <soc/uart.h> |
| 17 |
#include <fsp/api.h> |
| 18 |
|
| 19 |
static void dnv_ns_uart_read_resources(struct device *dev) |
| 20 |
{ |
| 21 |
|
| 22 |
pci_dev_read_resources(dev); |
| 23 |
if (!CONFIG(LEGACY_UART_MODE)) |
| 24 |
return; |
| 25 |
struct resource *res = probe_resource(dev, PCI_BASE_ADDRESS_0); |
| 26 |
if (res == NULL) |
| 27 |
return; |
| 28 |
res->size = 0x8; |
| 29 |
res->flags = IORESOURCE_IO | IORESOURCE_ASSIGNED | IORESOURCE_FIXED; |
| 30 |
|
| 31 |
res = probe_resource(dev, PCI_BASE_ADDRESS_1); |
| 32 |
if (res != NULL) |
| 33 |
res->flags = 0; |
| 34 |
compact_resources(dev); |
| 35 |
} |
| 36 |
|
| 37 |
static struct device_operations uart_ops = { |
| 38 |
.read_resources = dnv_ns_uart_read_resources, |
| 39 |
.set_resources = pci_dev_set_resources, |
| 40 |
.enable_resources = pci_dev_enable_resources, |
| 41 |
.init = pci_dev_init, |
| 42 |
}; |
| 43 |
|
| 44 |
static const struct pci_driver uart_driver __pci_driver = { |
| 45 |
.ops = &uart_ops, |
| 46 |
.vendor = PCI_VID_INTEL, |
| 47 |
.device = PCI_DID_INTEL_DNV_HSUART |
| 48 |
}; |
| 49 |
|
| 50 |
static void hide_hsuarts(void) |
| 51 |
{ |
| 52 |
int i; |
| 53 |
printk(BIOS_DEBUG, "HIDING HSUARTs.\n"); |
| 54 |
|
| 55 |
|
| 56 |
for (i = DENVERTON_UARTS_TO_INI - 1; i >= 0; i--) { |
| 57 |
struct device *uart_dev; |
| 58 |
uart_dev = pcidev_on_root(HSUART_DEV, i); |
| 59 |
if (uart_dev == NULL) |
| 60 |
continue; |
| 61 |
pci_or_config32(uart_dev, PCI_FUNC_RDCFG_HIDE, 1); |
| 62 |
} |
| 63 |
} |
| 64 |
|
| 65 |
|
| 66 |
void platform_fsp_notify_status(enum fsp_notify_phase phase) |
| 67 |
{ |
| 68 |
if (phase != END_OF_FIRMWARE) |
| 69 |
return; |
| 70 |
if (CONFIG(LEGACY_UART_MODE)) |
| 71 |
hide_hsuarts(); |
| 72 |
} |