diff options
author | Andrew Jeffery <andrew@aj.id.au> | 2018-10-09 00:32:36 -0700 |
---|---|---|
committer | Stewart Smith <stewart@linux.ibm.com> | 2018-10-11 01:26:20 -0500 |
commit | 9a830ee06c66058b1421c017b25a65a22921e9f6 (patch) | |
tree | fad2405598bb7f620b3915599b0de948b614b91a /core | |
parent | dd554bacd13c6dea481ea4e1ec9f3c32087295d9 (diff) | |
download | skiboot-9a830ee06c66058b1421c017b25a65a22921e9f6.zip skiboot-9a830ee06c66058b1421c017b25a65a22921e9f6.tar.gz skiboot-9a830ee06c66058b1421c017b25a65a22921e9f6.tar.bz2 |
platform: Restructure bmc_platform type
Segregate the BMC platform configuration into hardware and software
components. This allows population of platform default values for
hardware configuration that may no-longer be accessible by the host.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
[stewart: fixup pci-quirk unit test]
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'core')
-rw-r--r-- | core/pci-quirk.c | 21 | ||||
-rw-r--r-- | core/test/run-pci-quirk.c | 8 |
2 files changed, 25 insertions, 4 deletions
diff --git a/core/pci-quirk.c b/core/pci-quirk.c index 7ed6b79..3a85836 100644 --- a/core/pci-quirk.c +++ b/core/pci-quirk.c @@ -14,9 +14,12 @@ * limitations under the License. */ +#define pr_fmt(fmt) "PCI-QUIRK: " fmt + #include <skiboot.h> #include <pci.h> #include <pci-quirk.h> +#include <platform.h> #include <ast.h> static void quirk_astbmc_vga(struct phb *phb __unused, @@ -25,10 +28,20 @@ static void quirk_astbmc_vga(struct phb *phb __unused, struct dt_node *np = pd->dn; uint32_t revision, mcr_configuration, mcr_scu_mpll, mcr_scu_strap; - revision = ast_ahb_readl(SCU_REVISION_ID); - mcr_configuration = ast_ahb_readl(MCR_CONFIGURATION); - mcr_scu_mpll = ast_ahb_readl(MCR_SCU_MPLL); - mcr_scu_strap = ast_ahb_readl(MCR_SCU_STRAP); + if (ast_sio_is_enabled()) { + revision = ast_ahb_readl(SCU_REVISION_ID); + mcr_configuration = ast_ahb_readl(MCR_CONFIGURATION); + mcr_scu_mpll = ast_ahb_readl(MCR_SCU_MPLL); + mcr_scu_strap = ast_ahb_readl(MCR_SCU_STRAP); + } else { + prlog(PR_WARNING, "Assumed platform default parameters for %s\n", + __func__); + revision = bmc_platform->hw->scu_revision_id; + mcr_configuration = bmc_platform->hw->mcr_configuration; + mcr_scu_mpll = bmc_platform->hw->mcr_scu_mpll; + mcr_scu_strap = bmc_platform->hw->mcr_scu_strap; + } + dt_add_property_cells(np, "aspeed,scu-revision-id", revision); dt_add_property_cells(np, "aspeed,mcr-configuration", mcr_configuration); dt_add_property_cells(np, "aspeed,mcr-scu-mpll", mcr_scu_mpll); diff --git a/core/test/run-pci-quirk.c b/core/test/run-pci-quirk.c index b9db680..2f71302 100644 --- a/core/test/run-pci-quirk.c +++ b/core/test/run-pci-quirk.c @@ -7,6 +7,14 @@ struct dt_property; struct dt_node; +static struct bmc_platform fake_bmc; +const struct bmc_platform *bmc_platform = &fake_bmc; + +static int ast_sio_is_enabled(void) +{ + return 0; +} + static uint32_t ast_ahb_readl(uint32_t reg) { return reg; |