diff options
author | Yi Li <adamliyi@msn.com> | 2016-10-25 13:19:59 +0800 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2016-11-18 15:01:54 +0000 |
commit | 0475f65f5feb9381ef2710dca96b545546ccd944 (patch) | |
tree | 87b47b5740441be769d0e4ae0f487c4d6b259991 /libopenbmc_intf | |
parent | dfda936510a56421370267ef5fc54b10b739c67c (diff) | |
download | talos-skeleton-0475f65f5feb9381ef2710dca96b545546ccd944.tar.gz talos-skeleton-0475f65f5feb9381ef2710dca96b545546ccd944.zip |
op-pwrctl: Hold PCI resets until BootProgress passes BASE_INITIALIZATION state
When powering on host, hold PCI resets until hostboot passes stage
"BASE_INITIALIZATION"(0x14).
This fix applies to Firestone and Garrison.
Partially resolves openbmc/openbmc#315
Change-Id: Ic71c81406ac188b34df89569e2264ea0b94406f3
Signed-off-by: Yi Li <adamliyi@msn.com>
Diffstat (limited to 'libopenbmc_intf')
-rw-r--r-- | libopenbmc_intf/power_gpio.c | 34 | ||||
-rw-r--r-- | libopenbmc_intf/power_gpio.h | 5 |
2 files changed, 37 insertions, 2 deletions
diff --git a/libopenbmc_intf/power_gpio.c b/libopenbmc_intf/power_gpio.c index 543281f..3c44c81 100644 --- a/libopenbmc_intf/power_gpio.c +++ b/libopenbmc_intf/power_gpio.c @@ -31,10 +31,14 @@ gboolean read_power_gpio(GDBusConnection *connection, PowerGpio *power_gpio) gchar *latch_out_name; GVariantIter *power_up_outs_iter; GVariantIter *reset_outs_iter; + GVariantIter *pci_reset_outs_iter; gchar *power_up_out_name; gchar *reset_out_name; + gchar *pci_reset_out_name; gboolean power_up_polarity; gboolean reset_out_polarity; + gboolean pci_reset_out_polarity; + gboolean pci_reset_out_hold; int i; proxy = g_dbus_proxy_new_sync(connection, @@ -67,8 +71,8 @@ gboolean read_power_gpio(GDBusConnection *connection, PowerGpio *power_gpio) g_assert(value != NULL); memset(power_gpio, 0, sizeof(*power_gpio)); - g_variant_get(value, "(&s&sa(sb)a(sb))", &power_good_in_name, &latch_out_name, - &power_up_outs_iter, &reset_outs_iter); + g_variant_get(value, "(&s&sa(sb)a(sb)a(sbb))", &power_good_in_name, &latch_out_name, + &power_up_outs_iter, &reset_outs_iter, &pci_reset_outs_iter); g_print("Power GPIO latch output %s\n", latch_out_name); if(*latch_out_name != '\0') { /* latch is optional */ @@ -105,8 +109,28 @@ gboolean read_power_gpio(GDBusConnection *connection, PowerGpio *power_gpio) power_gpio->reset_pols[i] = reset_out_polarity; } + power_gpio->num_pci_reset_outs = g_variant_iter_n_children(pci_reset_outs_iter); + g_print("Power GPIO %d pci reset outputs\n", power_gpio->num_pci_reset_outs); + power_gpio->pci_reset_outs = g_malloc0_n(power_gpio->num_pci_reset_outs, + sizeof(GPIO)); + power_gpio->pci_reset_pols = g_malloc0_n(power_gpio->num_pci_reset_outs, + sizeof(gboolean)); + power_gpio->pci_reset_holds = g_malloc0_n(power_gpio->num_pci_reset_outs, + sizeof(gboolean)); + for(i = 0; g_variant_iter_next(pci_reset_outs_iter, "(&sbb)", &pci_reset_out_name, + &pci_reset_out_polarity, &pci_reset_out_hold); i++) { + g_print("Power GPIO pci reset[%d] = %s active %s, hold - %s\n", i, + pci_reset_out_name, + pci_reset_out_polarity ? "HIGH" : "LOW", + pci_reset_out_hold ? "Yes" : "No"); + power_gpio->pci_reset_outs[i].name = g_strdup(pci_reset_out_name); + power_gpio->pci_reset_pols[i] = pci_reset_out_polarity; + power_gpio->pci_reset_holds[i] = pci_reset_out_hold; + } + g_variant_iter_free(power_up_outs_iter); g_variant_iter_free(reset_outs_iter); + g_variant_iter_free(pci_reset_outs_iter); g_variant_unref(value); return TRUE; @@ -126,4 +150,10 @@ void free_power_gpio(PowerGpio *power_gpio) { } g_free(power_gpio->reset_outs); g_free(power_gpio->reset_pols); + for(i = 0; i < power_gpio->num_pci_reset_outs; i++) { + g_free(power_gpio->pci_reset_outs[i].name); + } + g_free(power_gpio->pci_reset_outs); + g_free(power_gpio->pci_reset_pols); + g_free(power_gpio->pci_reset_holds); } diff --git a/libopenbmc_intf/power_gpio.h b/libopenbmc_intf/power_gpio.h index 77e1c9c..e3714d0 100644 --- a/libopenbmc_intf/power_gpio.h +++ b/libopenbmc_intf/power_gpio.h @@ -37,6 +37,11 @@ typedef struct PowerGpio { GPIO *reset_outs; /* TRUE for active high */ gboolean *reset_pols; + size_t num_pci_reset_outs; + GPIO *pci_reset_outs; + /* TRUE for active high */ + gboolean *pci_reset_pols; + gboolean *pci_reset_holds; } PowerGpio; /* Read system configuration for power GPIOs. */ |