diff options
author | Mario Scheithauer <mario.scheithauer@siemens.com> | 2018-09-25 17:26:32 +0200 |
---|---|---|
committer | Werner Zeh <werner.zeh@siemens.com> | 2018-09-27 15:55:58 +0000 |
commit | 66038c87dab0c46d3991fbf3945d0a502d3e9905 (patch) | |
tree | d427f073a4c43185b159ead9bef2bc6f5a817c9a /src/mainboard/siemens/mc_apl1/variants/mc_apl2/mainboard.c | |
parent | 7e15e87eccf8adbfdeb22dd1bca98d977c99bde1 (diff) | |
download | coreboot-66038c87dab0c46d3991fbf3945d0a502d3e9905.tar.xz |
siemens/mc_apl1: Add new mainboard variant mc_apl2
This mainboard is based on mc_apl1. In a first step, it contains a copy
of mc_apl1 directory with minimum changes. Special adaptations for
mc_apl2 mainboard will follow in separate commits.
Change-Id: I0af60ab0dfe556dd95da2cf1a49c685a8f0ae4eb
Signed-off-by: Mario Scheithauer <mario.scheithauer@siemens.com>
Reviewed-on: https://review.coreboot.org/28735
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
Diffstat (limited to 'src/mainboard/siemens/mc_apl1/variants/mc_apl2/mainboard.c')
-rw-r--r-- | src/mainboard/siemens/mc_apl1/variants/mc_apl2/mainboard.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/src/mainboard/siemens/mc_apl1/variants/mc_apl2/mainboard.c b/src/mainboard/siemens/mc_apl1/variants/mc_apl2/mainboard.c new file mode 100644 index 0000000000..0c2418ad27 --- /dev/null +++ b/src/mainboard/siemens/mc_apl1/variants/mc_apl2/mainboard.c @@ -0,0 +1,66 @@ +/* + * This file is part of the coreboot project. + * + * Copyright (C) 2018 Siemens AG + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <bootstate.h> +#include <console/console.h> +#include <device/pci_def.h> +#include <device/pci_ids.h> +#include <device/pci_ops.h> +#include <hwilib.h> +#include <intelblocks/lpc_lib.h> +#include <timer.h> +#include <timestamp.h> +#include <baseboard/variants.h> + +void variant_mainboard_final(void) +{ + struct device *dev; + uint16_t cmd = 0; + + /* Set Master Enable for on-board PCI device. */ + dev = dev_find_device(PCI_VENDOR_ID_SIEMENS, 0x403e, 0); + if (dev) { + cmd = pci_read_config16(dev, PCI_COMMAND); + cmd |= PCI_COMMAND_MASTER; + pci_write_config16(dev, PCI_COMMAND, cmd); + } +} + +static void wait_for_legacy_dev(void *unused) +{ + uint32_t legacy_delay, us_since_boot; + struct stopwatch sw; + + /* Open main hwinfo block. */ + if (hwilib_find_blocks("hwinfo.hex") != CB_SUCCESS) + return; + + /* Get legacy delay parameter from hwinfo. */ + if (hwilib_get_field(LegacyDelay, (uint8_t *) &legacy_delay, + sizeof(legacy_delay)) != sizeof(legacy_delay)) + return; + + us_since_boot = get_us_since_boot(); + /* No need to wait if the time since boot is already long enough.*/ + if (us_since_boot > legacy_delay) + return; + stopwatch_init_msecs_expire(&sw, (legacy_delay - us_since_boot) / 1000); + printk(BIOS_NOTICE, "Wait remaining %d of %d us for legacy devices...", + legacy_delay - us_since_boot, legacy_delay); + stopwatch_wait_until_expired(&sw); + printk(BIOS_NOTICE, "done!\n"); +} + +BOOT_STATE_INIT_ENTRY(BS_DEV_ENUMERATE, BS_ON_ENTRY, wait_for_legacy_dev, NULL); |