From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:4864:20::242; helo=mail-lj1-x242.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 67A4621163271 for ; Fri, 19 Oct 2018 23:53:11 -0700 (PDT) Received: by mail-lj1-x242.google.com with SMTP id p89-v6so32672878ljb.3 for ; Fri, 19 Oct 2018 23:53:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=az63TOnf2nC1zxKuOiB/SpxRdgcLkWTI/vL7KnUexyM=; b=PpW+KekoqKxRL5CvK5lhI/n39GUeTa8asE9WWXvM+eY/lkOSY5f5UhmYGziLzEQdQx SFW4Pdv08qAXpDXFMmCidg96ZqW+yQkwcsPoVB+gHKZ1JsmW8bBNj4aG4hSjZ1xwspkJ hLoM7y1FRoLYAPWiv+hIlG0UkLLHjZ6s/3vAs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=az63TOnf2nC1zxKuOiB/SpxRdgcLkWTI/vL7KnUexyM=; b=uK7su5djlEPWmeUTmnJktM1H5zuAhFup/kVkQnz1Ci0jk2/ZcX7SARr7cbxn2+OGSr S9ZnEPly6hn7gcg8MqkbWL+AaxVdliBNcnyT0aimtu1y7iy2uvJKezrrPrI3758X2hyM 2wCkgPi66AGP+1RrbCNSR6jkzeBVtefJsW6Wh5PsPxJVpQ3wGC+umg41kL/Ia9YMInmh fjyBMyqalOnCo6uTNnfzuoof7ES92aSQCmgIPmlYzM+V/yG7oqVtO756ORSN2CQEIRq1 aPJqMZSxjOkOefvqpjKCPM+iL0LPDk2aRpl393G+qKPi/GA2Mhz4P8+2OJbwmBcu/cC/ gHIQ== X-Gm-Message-State: ABuFfoi9GsaR5VrlcApFWnxbQ6MY4RSuX/brR1eVkoqdHMbAJ6G41neL 3t/CWhlUdkRJ1IQs53oHBqIJjqcht3ZGnuWXEe64+w== X-Google-Smtp-Source: ACcGV63MrB9YWeeYXUyrngIEduN7FiaDB+oabM8bV02W6nIuL9WlCMK+ayDQ/6oEXpQtidVUDhWCvQCfHji2c4V3rEU= X-Received: by 2002:a2e:9c08:: with SMTP id s8-v6mr18881453lji.149.1540018389108; Fri, 19 Oct 2018 23:53:09 -0700 (PDT) MIME-Version: 1.0 References: <20181019104826.23073-1-ard.biesheuvel@linaro.org> In-Reply-To: <20181019104826.23073-1-ard.biesheuvel@linaro.org> From: Leif Lindholm Date: Sat, 20 Oct 2018 14:52:56 +0800 Message-ID: To: Ard Biesheuvel Cc: "edk2-devel (edk2-devel@lists.01.org)" , Masahisa Kojima X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [PATCH edk2-platforms] Silicon/SynQuacerPciCpuIo2Dxe: fix PCIe I/O translation X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Oct 2018 06:53:11 -0000 Content-Type: text/plain; charset="UTF-8" Looks good functionality-wise, but is a bit of a handful to look at (and not just because I'm code reviewing on a phone). Could you do it with a couple of temp vars? / Leif On Fri, 19 Oct 2018, 18:48 Ard Biesheuvel, wrote: > Commit 9dd8190e4995 ("Silicon/SynQuacer: tweak PCI I/O windows for > ACPI/Linux support") updated the min/max/offset definitions for the > PCIe I/O resource windows on SynQuacer, and updated the read path of > the platform's EfiCpuIo2 protocol implementation, but failed to update > the write path as well, resulting in spurious errors if when attempting > to write to PCIe I/O ports on PCIe RC #1, which uses translation for the > I/O BAR window. > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Ard Biesheuvel > --- > Silicon/Socionext/SynQuacer/Drivers/SynQuacerPciCpuIo2Dxe/SynQuacerPciCpuIo2Dxe.c > | 18 ++++++++++++------ > 1 file changed, 12 insertions(+), 6 deletions(-) > > diff --git > a/Silicon/Socionext/SynQuacer/Drivers/SynQuacerPciCpuIo2Dxe/SynQuacerPciCpuIo2Dxe.c > b/Silicon/Socionext/SynQuacer/Drivers/SynQuacerPciCpuIo2Dxe/SynQuacerPciCpuIo2Dxe.c > index 736b20cd5129..e5cc3aef908d 100644 > --- > a/Silicon/Socionext/SynQuacer/Drivers/SynQuacerPciCpuIo2Dxe/SynQuacerPciCpuIo2Dxe.c > +++ > b/Silicon/Socionext/SynQuacer/Drivers/SynQuacerPciCpuIo2Dxe/SynQuacerPciCpuIo2Dxe.c > @@ -518,12 +518,18 @@ CpuIoServiceWrite ( > return Status; > } > > - if ((Address >= SYNQUACER_PCI_SEG0_PORTIO_MIN) && > - (Address <= SYNQUACER_PCI_SEG0_PORTIO_MAX)) { > - Address += SYNQUACER_PCI_SEG0_PORTIO_MEMBASE; > - } else if ((Address >= SYNQUACER_PCI_SEG1_PORTIO_MIN) && > - (Address <= SYNQUACER_PCI_SEG1_PORTIO_MAX)) { > - Address += SYNQUACER_PCI_SEG1_PORTIO_MEMBASE; > + if ((Address >= (SYNQUACER_PCI_SEG0_PORTIO_MIN + > + SYNQUACER_PCI_SEG0_PORTIO_OFFSET)) && > + (Address <= (SYNQUACER_PCI_SEG0_PORTIO_MAX + > + SYNQUACER_PCI_SEG0_PORTIO_OFFSET))) { > + Address += SYNQUACER_PCI_SEG0_PORTIO_MEMBASE - > + SYNQUACER_PCI_SEG0_PORTIO_OFFSET; > + } else if ((Address >= (SYNQUACER_PCI_SEG1_PORTIO_MIN + > + SYNQUACER_PCI_SEG1_PORTIO_OFFSET)) && > + (Address <= (SYNQUACER_PCI_SEG1_PORTIO_MAX + > + SYNQUACER_PCI_SEG1_PORTIO_OFFSET))) { > + Address += SYNQUACER_PCI_SEG1_PORTIO_MEMBASE - > + SYNQUACER_PCI_SEG1_PORTIO_OFFSET; > > } else { > ASSERT (FALSE); > -- > 2.17.1 > >