From patchwork Tue Mar 20 07:19:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 888102 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40548G1L88z9sYq for ; Tue, 20 Mar 2018 18:20:14 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="nvbkrTpP"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40548F6DqczF1dZ for ; Tue, 20 Mar 2018 18:20:13 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="nvbkrTpP"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c00::22b; helo=mail-pf0-x22b.google.com; envelope-from=oohall@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="nvbkrTpP"; dkim-atps=neutral Received: from mail-pf0-x22b.google.com (mail-pf0-x22b.google.com [IPv6:2607:f8b0:400e:c00::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4054844n0wzF1N3 for ; Tue, 20 Mar 2018 18:20:04 +1100 (AEDT) Received: by mail-pf0-x22b.google.com with SMTP id d26so313632pfn.5 for ; Tue, 20 Mar 2018 00:20:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=U9cdFseUj2KIaK1n9ZOv3XM4MJbCrqGVPy0J7nZBc/0=; b=nvbkrTpP5V6s/4Kn0e/e4I7Xwn8nB2U2rEtyfFvWmaf2a7TVQgh54YOy/C5vnBIPFR 3Ve096wP5gidO0uORZBQnRI2pgZMqk1HBNS0PR7tPOODDTBRPrmGYGnb5g4kOzHJyjmE RGmFdpv7r8GfAS1ySFgk7T5FBOpFNSu448XWi7axRN3II7YDtp8psNotBTWH0W0DV41H Ge9OR1bvKw/KBoytoqxt+8xQc1Puke6WSgm0hO7Sy+KU0WcoO2QqeIoGn2h7ZRwN+uMr zRlLlzwW8+jR2wu/3V7y8bLwtcfWJsdOaidkEgAYASkLXiRH+mSbk+lmY+hekl/Cd9WI tK0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=U9cdFseUj2KIaK1n9ZOv3XM4MJbCrqGVPy0J7nZBc/0=; b=e3McxlTx1RDZKVocu8I3rMO5qhJn+KUVsvG1Cz6Sydpy8qYR1XCXc4aVwsf7OA1/y7 Ob9tzqHRUIhyu0kLrKCrqNuND7UmfXgisBvPH9QeKzRhUeUaLu2Vr+bnCTqLQNp8QauB 1zCglhZnL/zz/VP+xf7/Nw63VS0LTv9GQ+GLe1NH4g3BHUAYfyt6QBpxS7UnX0oYmInE nL0tdsg2ukRXt4UH9xs6izTIKAUalkH2TlIahl6ggbqYxHKvh51jkpSd0khGR3ZghGnW LxP81S2sRqkZW4CuBkwcMkf6Eo4aum0acr8BaDmfI+gTouigsqvrkquxRyKsdyNRtMhM xqiw== X-Gm-Message-State: AElRT7Hrs2vtW+viFEJfv0h4utDAJVI5bcregaROxVIgSx6bQqwqr0WM kQ3tK+oN9LQXK9F2urxxb+RRRQ== X-Google-Smtp-Source: AG47ELsR+9Z2pewCwfP/AvYZlSFLdqs8ze0Bq3OMqwPeY1rJSpYHQZe2Sa45IAgbcJOlkx1QO6AlCw== X-Received: by 10.98.141.205 with SMTP id p74mr3629866pfk.210.1521530401338; Tue, 20 Mar 2018 00:20:01 -0700 (PDT) Received: from flat-canetoad.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id b8sm1745528pgv.17.2018.03.20.00.19.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Mar 2018 00:20:00 -0700 (PDT) From: Oliver O'Halloran To: skiboot@lists.ozlabs.org Date: Tue, 20 Mar 2018 18:19:49 +1100 Message-Id: <20180320071949.25078-1-oohall@gmail.com> X-Mailer: git-send-email 2.9.5 Subject: [Skiboot] [PATCH] phb*: Remove the state field in the various phb structures X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" We've been carting around this field since the original p7ioc-phb code. As far as I can tell we never actually use it for anything other than checking if the PHB has been marked as broken or not. The _FENCED state is set in a few places, but we never use it in favour of just checking the MMIO register. This patch just replaces it with a boolean that indicates if the PHB has been marked as broken and removes the giant, mostly wrong, comment explaining it's usage that is copied and pasted into each phb header file. Signed-off-by: Oliver O'Halloran --- hw/p7ioc-phb.c | 27 +++++++++++------------- hw/p7ioc.c | 2 -- hw/phb3.c | 27 +++++++++++------------- hw/phb4.c | 28 ++++++++++++------------- include/p7ioc.h | 64 +-------------------------------------------------------- include/phb3.h | 63 +------------------------------------------------------- include/phb4.h | 62 +------------------------------------------------------ 7 files changed, 40 insertions(+), 233 deletions(-) diff --git a/hw/p7ioc-phb.c b/hw/p7ioc-phb.c index b0a26e845194..fafd841e686d 100644 --- a/hw/p7ioc-phb.c +++ b/hw/p7ioc-phb.c @@ -76,7 +76,7 @@ static int64_t p7ioc_pcicfg_check(struct p7ioc_phb *p, uint32_t bdfn, return OPAL_HARDWARE; /* Check PHB state */ - if (p->state == P7IOC_PHB_STATE_BROKEN) + if (p->broken) return OPAL_HARDWARE; return OPAL_SUCCESS; @@ -296,7 +296,7 @@ static int64_t p7ioc_eeh_freeze_status(struct phb *phb, uint64_t pe_number, *pci_error_type = OPAL_EEH_NO_ERROR; /* Check dead */ - if (p->state == P7IOC_PHB_STATE_BROKEN) { + if (p->broken) { *freeze_state = OPAL_EEH_STOPPED_MMIO_DMA_FREEZE; *pci_error_type = OPAL_EEH_PHB_ERROR; if (severity) @@ -311,7 +311,6 @@ static int64_t p7ioc_eeh_freeze_status(struct phb *phb, uint64_t pe_number, *pci_error_type = OPAL_EEH_PHB_ERROR; if (severity) *severity = OPAL_EEH_SEV_PHB_FENCED; - p->state = P7IOC_PHB_STATE_FENCED; goto bail; } @@ -372,7 +371,7 @@ static int64_t p7ioc_eeh_next_error(struct phb *phb, uint64_t *first_frozen_pe, *first_frozen_pe = (uint64_t)-1; /* Check dead */ - if (p->state == P7IOC_PHB_STATE_BROKEN) { + if (p->broken) { *pci_error_type = OPAL_EEH_PHB_ERROR; *severity = OPAL_EEH_SEV_PHB_DEAD; return OPAL_SUCCESS; @@ -383,7 +382,6 @@ static int64_t p7ioc_eeh_next_error(struct phb *phb, uint64_t *first_frozen_pe, /* Should be OPAL_EEH_STOPPED_TEMP_UNAVAIL ? */ *pci_error_type = OPAL_EEH_PHB_ERROR; *severity = OPAL_EEH_SEV_PHB_FENCED; - p->state = P7IOC_PHB_STATE_FENCED; p7ioc_phb_set_err_pending(p, false); return OPAL_SUCCESS; } @@ -2474,7 +2472,7 @@ static void p7ioc_phb_err_interrupt(struct irq_source *is, uint32_t isn) opal_pci_eeh_set_evt(p->phb.opal_id); /* If the PHB is broken, go away */ - if (p->state == P7IOC_PHB_STATE_BROKEN) + if (p->broken) return; /* @@ -2483,7 +2481,6 @@ static void p7ioc_phb_err_interrupt(struct irq_source *is, uint32_t isn) */ phb_lock(&p->phb); if (p7ioc_phb_fenced(p)) { - p->state = P7IOC_PHB_STATE_FENCED; PHBERR(p, "ER error ignored, PHB fenced\n"); phb_unlock(&p->phb); return; @@ -2657,7 +2654,6 @@ void p7ioc_phb_setup(struct p7ioc *ioc, uint8_t index) p->io_base = ioc->mmio1_win_start + PHBn_IO_BASE(index); p->m32_base = ioc->mmio2_win_start + PHBn_M32_BASE(index); p->m64_base = ioc->mmio2_win_start + PHBn_M64_BASE(index); - p->state = P7IOC_PHB_STATE_UNINITIALIZED; p->phb.scan_map = 0x1; /* Only device 0 to scan */ /* Find P7IOC base location code in IOC */ @@ -2959,7 +2955,11 @@ int64_t p7ioc_phb_init(struct p7ioc_phb *p) PHBDBG(p, "Initializing PHB %x...\n", p->index); - p->state = P7IOC_PHB_STATE_INITIALIZING; + /* + * We re-init the PHB on a creset (and a few other cases) + * so clear the broken flag + */ + p->broken = false; /* For some reason, the doc wants us to read the version * register, so let's do it. We shoud probably check that @@ -3173,14 +3173,11 @@ int64_t p7ioc_phb_init(struct p7ioc_phb *p) out_be64(p->regs + PHB_TIMEOUT_CTRL1, 0x1611112010200000UL); out_be64(p->regs + PHB_TIMEOUT_CTRL2, 0x0000561300000000UL); - /* Mark the PHB as functional which enables all the various sequences */ - p->state = P7IOC_PHB_STATE_FUNCTIONAL; - return OPAL_SUCCESS; failed: PHBERR(p, "Initialization failed\n"); - p->state = P7IOC_PHB_STATE_BROKEN; + p->broken = true; return OPAL_HARDWARE; } @@ -3206,7 +3203,7 @@ void p7ioc_phb_reset(struct phb *phb) * notable that the IODA table cache won't be emptied so that we * can restore them during error recovery. */ - if (p->state == P7IOC_PHB_STATE_FUNCTIONAL && !fenced) { + if (!p->broken && !fenced) { PHBDBG(p, " ioda reset ...\n"); p7ioc_ioda_reset(&p->phb, false); time_wait_ms(100); @@ -3247,7 +3244,7 @@ void p7ioc_phb_reset(struct phb *phb) /* Reset failed, not much to do, maybe add an error return */ if (fenced) { PHBERR(p, "Reset failed, fence still set !\n"); - p->state = P7IOC_PHB_STATE_BROKEN; + p->broken = true; return; } diff --git a/hw/p7ioc.c b/hw/p7ioc.c index fc035d6bbd07..e036433a7bab 100644 --- a/hw/p7ioc.c +++ b/hw/p7ioc.c @@ -666,8 +666,6 @@ static void p7ioc_create_hub(struct dt_node *np) for (i = 0; i < P7IOC_NUM_PHBS; i++) { if (p7ioc_phb_enabled(ioc, i)) p7ioc_phb_setup(ioc, i); - else - ioc->phbs[i].state = P7IOC_PHB_STATE_OFF; } /* Now, we do the bulk of the inits */ diff --git a/hw/phb3.c b/hw/phb3.c index 0c4e1eb301a5..f28f568fc63a 100644 --- a/hw/phb3.c +++ b/hw/phb3.c @@ -72,7 +72,6 @@ static bool phb3_fenced(struct phb3 *p) xscom_read(p->chip_id, p->pe_xscom + 0x0, &nfir); if (nfir & PPC_BIT(16)) { p->flags |= PHB3_AIB_FENCED; - p->state = PHB3_STATE_FENCED; return true; } return false; @@ -134,7 +133,7 @@ static int64_t phb3_pcicfg_check(struct phb3 *p, uint32_t bdfn, return OPAL_HARDWARE; /* Check PHB state */ - if (p->state == PHB3_STATE_BROKEN) + if (p->broken) return OPAL_HARDWARE; /* Fetch the PE# from cache */ @@ -1798,7 +1797,7 @@ static int64_t phb3_msi_set_xive(struct irq_source *is, uint32_t isn, index = p8_irq_to_phb(isn); ive_num = PHB3_IRQ_NUM(isn); - if (p->state == PHB3_STATE_BROKEN || !p->tbl_rtt) + if (p->broken || !p->tbl_rtt) return OPAL_HARDWARE; if (chip != p->chip_id || index != p->index || @@ -1908,7 +1907,7 @@ static int64_t phb3_lsi_set_xive(struct irq_source *is, uint32_t isn, index = p8_irq_to_phb(isn); irq = PHB3_IRQ_NUM(isn); - if (p->state == PHB3_STATE_BROKEN) + if (p->broken) return OPAL_HARDWARE; if (chip != p->chip_id || @@ -1953,7 +1952,7 @@ static void phb3_err_interrupt(struct irq_source *is, uint32_t isn) OPAL_EVENT_PCI_ERROR); /* If the PHB is broken, go away */ - if (p->state == PHB3_STATE_BROKEN) + if (p->broken) return; /* @@ -2181,7 +2180,7 @@ static int64_t phb3_get_presence_state(struct pci_slot *slot, uint8_t *val) struct phb3 *p = phb_to_phb3(slot->phb); uint64_t hp_override; - if (p->state == PHB3_STATE_BROKEN) + if (p->broken) return OPAL_HARDWARE; /* @@ -2675,7 +2674,6 @@ static int64_t phb3_creset(struct pci_slot *slot) } error: - p->state = PHB3_STATE_FENCED; return OPAL_HARDWARE; } @@ -2732,7 +2730,7 @@ static int64_t phb3_eeh_freeze_status(struct phb *phb, uint64_t pe_number, *pci_error_type = OPAL_EEH_NO_ERROR; /* Check dead */ - if (p->state == PHB3_STATE_BROKEN) { + if (p->broken) { *freeze_state = OPAL_EEH_STOPPED_MMIO_DMA_FREEZE; *pci_error_type = OPAL_EEH_PHB_ERROR; if (severity) @@ -2788,7 +2786,7 @@ static int64_t phb3_eeh_freeze_clear(struct phb *phb, uint64_t pe_number, int32_t i; bool frozen_pe = false; - if (p->state == PHB3_STATE_BROKEN) + if (p->broken) return OPAL_HARDWARE; /* Summary. If nothing, move to clearing the PESTs which can @@ -2845,7 +2843,7 @@ static int64_t phb3_eeh_freeze_set(struct phb *phb, uint64_t pe_number, struct phb3 *p = phb_to_phb3(phb); uint64_t data; - if (p->state == PHB3_STATE_BROKEN) + if (p->broken) return OPAL_HARDWARE; if (pe_number >= PHB3_MAX_PE_NUM) @@ -2884,7 +2882,7 @@ static int64_t phb3_eeh_next_error(struct phb *phb, int32_t i, j; /* If the PHB is broken, we needn't go forward */ - if (p->state == PHB3_STATE_BROKEN) { + if (p->broken) { *pci_error_type = OPAL_EEH_PHB_ERROR; *severity = OPAL_EEH_SEV_PHB_DEAD; return OPAL_SUCCESS; @@ -3369,7 +3367,7 @@ static int64_t phb3_get_diag_data(struct phb *phb, if (diag_buffer_len < sizeof(struct OpalIoPhb3ErrorData)) return OPAL_PARAMETER; - if (p->state == PHB3_STATE_BROKEN) + if (p->broken) return OPAL_HARDWARE; /* @@ -4373,7 +4371,7 @@ static void phb3_init_hw(struct phb3 *p, bool first_init) out_be64(p->regs + PHB_TIMEOUT_CTRL2, 0x2320d71600000000); /* Mark the PHB as functional which enables all the various sequences */ - p->state = PHB3_STATE_FUNCTIONAL; + p->broken = false; PHBDBG(p, "Initialization complete\n"); @@ -4381,7 +4379,7 @@ static void phb3_init_hw(struct phb3 *p, bool first_init) failed: PHBERR(p, "Initialization failed\n"); - p->state = PHB3_STATE_BROKEN; + p->broken = true; } static void phb3_allocate_tables(struct phb3 *p) @@ -4625,7 +4623,6 @@ static void phb3_create(struct dt_node *np) p->phb.ops = &phb3_ops; p->phb.phb_type = phb_type_pcie_v3; p->phb.scan_map = 0x1; /* Only device 0 to scan */ - p->state = PHB3_STATE_UNINITIALIZED; if (!phb3_calculate_windows(p)) return; diff --git a/hw/phb4.c b/hw/phb4.c index 47175df2b8b7..e45be01fe094 100644 --- a/hw/phb4.c +++ b/hw/phb4.c @@ -274,7 +274,7 @@ static int64_t phb4_pcicfg_check(struct phb4 *p, uint32_t bdfn, return OPAL_HARDWARE; /* Check PHB state */ - if (p->state == PHB4_STATE_BROKEN) + if (p->broken) return OPAL_HARDWARE; /* Fetch the PE# from cache */ @@ -2187,7 +2187,7 @@ static int64_t phb4_get_presence_state(struct pci_slot *slot, uint8_t *val) uint64_t hps, dtctl; /* Test for PHB in error state ? */ - if (p->state == PHB4_STATE_BROKEN) + if (p->broken) return OPAL_HARDWARE; /* Check hotplug status */ @@ -2399,7 +2399,6 @@ static bool phb4_fenced(struct phb4 *p) /* Mark ourselves fenced */ p->flags |= PHB4_AIB_FENCED; - p->state = PHB4_STATE_FENCED; /* dump capp error registers in case phb was fenced due to capp */ if (nfir_n & XPEC_NEST_STK_PCI_NFIR_CXA_PE_CAPP) @@ -2884,7 +2883,7 @@ static int64_t phb4_creset(struct pci_slot *slot) uint64_t pbcq_status, reg; /* Don't even try fixing a broken PHB */ - if (p->state == PHB4_STATE_BROKEN) + if (p->broken) return OPAL_HARDWARE; switch (slot->state) { @@ -2983,7 +2982,7 @@ static int64_t phb4_creset(struct pci_slot *slot) error: /* Mark the PHB as dead and expect it to be removed */ - p->state = PHB4_STATE_BROKEN; + p->broken = true; return OPAL_HARDWARE; } @@ -3087,7 +3086,7 @@ static int64_t phb4_eeh_freeze_status(struct phb *phb, uint64_t pe_number, *pci_error_type = OPAL_EEH_NO_ERROR; /* Check dead */ - if (p->state == PHB4_STATE_BROKEN) { + if (p->broken) { *freeze_state = OPAL_EEH_STOPPED_MMIO_DMA_FREEZE; *pci_error_type = OPAL_EEH_PHB_ERROR; if (severity) @@ -3150,7 +3149,7 @@ static int64_t phb4_eeh_freeze_clear(struct phb *phb, uint64_t pe_number, int32_t i; bool frozen_pe = false; - if (p->state == PHB4_STATE_BROKEN) + if (p->broken) return OPAL_HARDWARE; /* Summary. If nothing, move to clearing the PESTs which can @@ -3207,7 +3206,7 @@ static int64_t phb4_eeh_freeze_set(struct phb *phb, uint64_t pe_number, struct phb4 *p = phb_to_phb4(phb); uint64_t data; - if (p->state == PHB4_STATE_BROKEN) + if (p->broken) return OPAL_HARDWARE; if (pe_number >= p->num_pes) @@ -3246,7 +3245,7 @@ static int64_t phb4_eeh_next_error(struct phb *phb, int32_t i, j; /* If the PHB is broken, we needn't go forward */ - if (p->state == PHB4_STATE_BROKEN) { + if (p->broken) { *pci_error_type = OPAL_EEH_PHB_ERROR; *severity = OPAL_EEH_SEV_PHB_DEAD; return OPAL_SUCCESS; @@ -3548,7 +3547,7 @@ static int64_t phb4_get_diag_data(struct phb *phb, if (diag_buffer_len < sizeof(struct OpalIoPhb4ErrorData)) return OPAL_PARAMETER; - if (p->state == PHB4_STATE_BROKEN) + if (p->broken) return OPAL_HARDWARE; /* @@ -4689,7 +4688,7 @@ static void phb4_init_hw(struct phb4 *p, bool first_init) out_be64(p->regs + PHB_PBL_TIMEOUT_CTRL, 0x2013000000000000ull); /* Mark the PHB as functional which enables all the various sequences */ - p->state = PHB4_STATE_FUNCTIONAL; + p->broken = false; PHBDBG(p, "Initialization complete\n"); @@ -4697,7 +4696,7 @@ static void phb4_init_hw(struct phb4 *p, bool first_init) failed: PHBERR(p, "Initialization failed\n"); - p->state = PHB4_STATE_BROKEN; + p->broken = true; } /* FIXME: Use scoms rather than MMIO incase we are fenced */ @@ -4954,7 +4953,7 @@ static void phb4_err_interrupt(struct irq_source *is, uint32_t isn) OPAL_EVENT_PCI_ERROR); /* If the PHB is broken, go away */ - if (p->state == PHB3_STATE_BROKEN) + if (p->broken) return; /* @@ -5056,7 +5055,6 @@ static void phb4_create(struct dt_node *np) p->phb.ops = &phb4_ops; p->phb.phb_type = phb_type_pcie_v4; p->phb.scan_map = 0x1; /* Only device 0 to scan */ - p->state = PHB4_STATE_UNINITIALIZED; if (!phb4_calculate_windows(p)) return; @@ -5229,7 +5227,7 @@ static void phb4_create(struct dt_node *np) return; failed: - p->state = PHB4_STATE_BROKEN; + p->broken = true; /* Tell Linux it's broken */ dt_add_property_string(np, "status", "error"); diff --git a/include/p7ioc.h b/include/p7ioc.h index 8040b3a934cd..96f9209cc5e9 100644 --- a/include/p7ioc.h +++ b/include/p7ioc.h @@ -146,68 +146,6 @@ #define PHB_LSI_PCIE_UNUSED 6 #define PHB_LSI_PCIE_ERROR 7 -/* - * State structure for a PHB on P7IOC - */ - -/* - * The PHB State structure is essentially used during PHB reset - * or recovery operations to indicate that the PHB cannot currently - * be used for normal operations. - * - * Some states involve waiting for the timebase to reach a certain - * value. In which case the field "delay_tgt_tb" is set and the - * state machine will be run from the "state_poll" callback. - * - * At IPL time, we call this repeatedly during the various sequences - * however under OS control, this will require a change in API. - * - * Fortunately, the OPAL API for slot power & reset are not currently - * used by Linux, so changing them isn't going to be an issue. The idea - * here is that some of these APIs will return a positive integer when - * needing such a delay to proceed. The OS will then be required to - * call a new function opal_poll_phb() after that delay. That function - * will potentially return a new delay, or OPAL_SUCCESS when the original - * operation has completed successfully. If the operation has completed - * with an error, then opal_poll_phb() will return that error. - * - * Note: Should we consider also returning optionally some indication - * of what operation is in progress for OS debug/diag purposes ? - * - * Any attempt at starting a new "asynchronous" operation while one is - * already in progress will result in an error. - * - * Internally, this is represented by the state being P7IOC_PHB_STATE_FUNCTIONAL - * when no operation is in progress, which it reaches at the end of the - * boot time initializations. Any attempt at performing a slot operation - * on a PHB in that state will change the state to the corresponding - * operation state machine. Any attempt while not in that state will - * return an error. - * - * Some operations allow for a certain amount of retries, this is - * provided for by the "retries" structure member for use by the state - * machine as it sees fit. - */ -enum p7ioc_phb_state { - /* First init state */ - P7IOC_PHB_STATE_UNINITIALIZED, - - /* During PHB HW inits */ - P7IOC_PHB_STATE_INITIALIZING, - - /* Set if the PHB is for some reason unusable */ - P7IOC_PHB_STATE_BROKEN, - - /* Set if the PHB is fenced due to an error */ - P7IOC_PHB_STATE_FENCED, - - /* PHB turned off by FSP (no clocks) */ - P7IOC_PHB_STATE_OFF, - - /* Normal PHB functional state */ - P7IOC_PHB_STATE_FUNCTIONAL, -}; - /* P7IOC PHB slot states */ #define P7IOC_SLOT_NORMAL PCI_SLOT_STATE_NORMAL #define P7IOC_SLOT_LINK PCI_SLOT_STATE_LINK @@ -290,7 +228,7 @@ struct p7ioc_phb { uint8_t index; /* 0..5 index inside p7ioc */ uint8_t gen; uint32_t flags; - enum p7ioc_phb_state state; + bool broken; #define P7IOC_REV_DD10 0x00a20001 #define P7IOC_REV_DD11 0x00a20002 uint32_t rev; /* Both major and minor have 2 bytes */ diff --git a/include/phb3.h b/include/phb3.h index 3f949fccf2b3..bc46da7ca7cc 100644 --- a/include/phb3.h +++ b/include/phb3.h @@ -146,67 +146,6 @@ #define PHB3_RESERVED_PE_NUM 255 /* - * State structure for a PHB - */ - -/* - * (Comment copied from p7ioc.h, please update both when relevant) - * - * The PHB State structure is essentially used during PHB reset - * or recovery operations to indicate that the PHB cannot currently - * be used for normal operations. - * - * Some states involve waiting for the timebase to reach a certain - * value. In which case the field "delay_tgt_tb" is set and the - * state machine will be run from the "state_poll" callback. - * - * At IPL time, we call this repeatedly during the various sequences - * however under OS control, this will require a change in API. - * - * Fortunately, the OPAL API for slot power & reset are not currently - * used by Linux, so changing them isn't going to be an issue. The idea - * here is that some of these APIs will return a positive integer when - * neededing such a delay to proceed. The OS will then be required to - * call a new function opal_poll_phb() after that delay. That function - * will potentially return a new delay, or OPAL_SUCCESS when the original - * operation has completed successfully. If the operation has completed - * with an error, then opal_poll_phb() will return that error. - * - * Note: Should we consider also returning optionally some indication - * of what operation is in progress for OS debug/diag purposes ? - * - * Any attempt at starting a new "asynchronous" operation while one is - * already in progress will result in an error. - * - * Internally, this is represented by the state being P7IOC_PHB_STATE_FUNCTIONAL - * when no operation is in progress, which it reaches at the end of the - * boot time initializations. Any attempt at performing a slot operation - * on a PHB in that state will change the state to the corresponding - * operation state machine. Any attempt while not in that state will - * return an error. - * - * Some operations allow for a certain amount of retries, this is - * provided for by the "retries" structure member for use by the state - * machine as it sees fit. - */ -enum phb3_state { - /* First init state */ - PHB3_STATE_UNINITIALIZED, - - /* During PHB HW inits */ - PHB3_STATE_INITIALIZING, - - /* Set if the PHB is for some reason unusable */ - PHB3_STATE_BROKEN, - - /* PHB fenced */ - PHB3_STATE_FENCED, - - /* Normal PHB functional state */ - PHB3_STATE_FUNCTIONAL, -}; - -/* * PHB3 PCI slot state. When you're going to apply any * changes here, please make sure the base state isn't * conflicting with those defined in pci-slot.h @@ -267,7 +206,7 @@ struct phb3 { unsigned int index; /* 0..2 index inside P8 */ unsigned int flags; unsigned int chip_id; /* Chip ID (== GCID on P8) */ - enum phb3_state state; + bool broken; unsigned int rev; /* 00MMmmmm */ #define PHB3_REV_MURANO_DD10 0xa30001 #define PHB3_REV_VENICE_DD10 0xa30002 diff --git a/include/phb4.h b/include/phb4.h index 757a3feb48f9..4ab2912b05bb 100644 --- a/include/phb4.h +++ b/include/phb4.h @@ -106,66 +106,6 @@ #define PELTV_TABLE_SIZE_MAX 0x20000 #define PHB4_RESERVED_PE_NUM(p) ((p)->num_pes - 1) -/* - * State structure for a PHB - */ - -/* - * (Comment copied from p7ioc.h, please update both when relevant) - * - * The PHB State structure is essentially used during PHB reset - * or recovery operations to indicate that the PHB cannot currently - * be used for normal operations. - * - * Some states involve waiting for the timebase to reach a certain - * value. In which case the field "delay_tgt_tb" is set and the - * state machine will be run from the "state_poll" callback. - * - * At IPL time, we call this repeatedly during the various sequences - * however under OS control, this will require a change in API. - * - * Fortunately, the OPAL API for slot power & reset are not currently - * used by Linux, so changing them isn't going to be an issue. The idea - * here is that some of these APIs will return a positive integer when - * neededing such a delay to proceed. The OS will then be required to - * call a new function opal_poll_phb() after that delay. That function - * will potentially return a new delay, or OPAL_SUCCESS when the original - * operation has completed successfully. If the operation has completed - * with an error, then opal_poll_phb() will return that error. - * - * Note: Should we consider also returning optionally some indication - * of what operation is in progress for OS debug/diag purposes ? - * - * Any attempt at starting a new "asynchronous" operation while one is - * already in progress will result in an error. - * - * Internally, this is represented by the state being P7IOC_PHB_STATE_FUNCTIONAL - * when no operation is in progress, which it reaches at the end of the - * boot time initializations. Any attempt at performing a slot operation - * on a PHB in that state will change the state to the corresponding - * operation state machine. Any attempt while not in that state will - * return an error. - * - * Some operations allow for a certain amount of retries, this is - * provided for by the "retries" structure member for use by the state - * machine as it sees fit. - */ -enum phb4_state { - /* First init state */ - PHB4_STATE_UNINITIALIZED, - - /* During PHB HW inits */ - PHB4_STATE_INITIALIZING, - - /* Set if the PHB is for some reason unusable */ - PHB4_STATE_BROKEN, - - /* PHB fenced */ - PHB4_STATE_FENCED, - - /* Normal PHB functional state */ - PHB4_STATE_FUNCTIONAL, -}; /* * PHB4 PCI slot state. When you're going to apply any @@ -229,7 +169,7 @@ struct phb4 { unsigned int index; /* 0..5 index inside p9 */ unsigned int flags; unsigned int chip_id; /* Chip ID (== GCID on p9) */ - enum phb4_state state; + bool broken; unsigned int rev; /* 00MMmmmm */ #define PHB4_REV_NIMBUS_DD10 0xa40001 #define PHB4_REV_NIMBUS_DD20 0xa40002