| * Copyright (c) 2019 Intel Corporation |
| * SPDX-License-Identifier: Apache-2.0 |
| #include <drivers/pcie/pcie.h> |
| #include <drivers/pcie/msi.h> |
| /* functions documented in include/drivers/pcie/msi.h */ |
| bool pcie_set_msi(pcie_bdf_t bdf, unsigned int irq) |
| bool success = false; /* keepin' the MISRA peeps employed */ |
| base = pcie_get_cap(bdf, PCIE_MSI_CAP_ID); |
| mcr = pcie_conf_read(bdf, base + PCIE_MSI_MCR); |
| pcie_conf_write(bdf, base + PCIE_MSI_MAP0, map); |
| if (mcr & PCIE_MSI_MCR_64) { |
| pcie_conf_write(bdf, base + PCIE_MSI_MAP1_64, 0U); |
| pcie_conf_write(bdf, base + PCIE_MSI_MDR_64, mdr); |
| pcie_conf_write(bdf, base + PCIE_MSI_MDR_32, mdr); |
| mcr &= ~PCIE_MSI_MCR_MME; /* only 1 IRQ please */ |
| pcie_conf_write(bdf, base + PCIE_MSI_MCR, mcr); |
| pcie_set_cmd(bdf, PCIE_CONF_CMDSTAT_MASTER, true); |