From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from mail-qv1-f66.google.com (mail-qv1-f66.google.com [209.85.219.66])
 by mx.groups.io with SMTP id smtpd.web12.24929.1591981782869537959
 for <devel@edk2.groups.io>;
 Fri, 12 Jun 2020 10:09:43 -0700
Authentication-Results: mx.groups.io;
 dkim=pass header.i=@semihalf-com.20150623.gappssmtp.com header.s=20150623 header.b=Q9wGx0zC;
 spf=none, err=SPF record not found (domain: semihalf.com, ip: 209.85.219.66, mailfrom: mw@semihalf.com)
Received: by mail-qv1-f66.google.com with SMTP id ec10so4688953qvb.5
        for <devel@edk2.groups.io>; Fri, 12 Jun 2020 10:09:42 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=semihalf-com.20150623.gappssmtp.com; s=20150623;
        h=mime-version:references:in-reply-to:from:date:message-id:subject:to
         :cc:content-transfer-encoding;
        bh=VtxkCguUsUkzCO0SsJ1kfnKUt+SfpxHXJ/psKP/fmhA=;
        b=Q9wGx0zCXujaa9aNXMSbIUGNtGAp92BovT4W1ettLOIQmKIaNuicpfN75PAUDVJVzh
         zAayCNfpH88cbRgN6DrfOXd7b0G7eStE7CX7DFB9UnmmEBpbxtrUwG0K+LUYZcJwZLtW
         KxaGB4Q06izhsH6psrmzvONZcd2lBUVkbPC/VdZLJfHPUo4jtDrmO9N1CWILviKEjzem
         LYYwuwigRg3fwl/ZQQPjoqT6M8PtdtSICsEDgB+AyvRhe5mncWlW/J3lqj9X2O6I1mow
         cB87hs9IJYq0ao+Ix+sRsodMXYmQl98zVk8cpdFkqgShl+fbcTCtvVCg6Hys2eWgpz+/
         TD0w==
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:content-transfer-encoding;
        bh=VtxkCguUsUkzCO0SsJ1kfnKUt+SfpxHXJ/psKP/fmhA=;
        b=s7Yd5aPDIU7cCOkglRb0iRDQcLtlWcnHE4pk/0ehki5I6hRLbZ5zv7fTUAnNNbREsY
         D+c7QyuiVyu+H8tUL+GcvlU85K1UfUahlYGxNMNY74e4Z8BwjoOHDKvK0HzWgtwJDIoB
         SJFv/a13+OnrGhoB4pM/q7kPOdpaq20ZS2JMZd4tW25eIQBcDG0VpvM/6MT/wH3zUyHb
         XR15fW8hS9IMBIqDAPB0mT3vjWoMINO3S1jMQEG49V2snAjnTfI/rBknzHD0z9jklkO5
         JoklkXSB8oAloHahkDwMNlV8HaaliulGr+bFXJQMKER65ailnnuALymkhQDXskwx/1BY
         J7Dg==
X-Gm-Message-State: AOAM530yZFZENzzC/bT6FhfzY3WE5+ta2SDSrQx7dX96nVyhrm9u1ChX
	76MqH+sbmsV3R8OxhE+Bd05nGfBOOdLwGLvQilX8Kg==
X-Google-Smtp-Source: ABdhPJzJFNw7c1Ndv6dS61rHCVs9/XPyPnnzADgHSEOWbrq5M+X3rNXcZu1+Dxj8nowZ12+/qqAzQSeDDgQEDaO9rm0=
X-Received: by 2002:a0c:9ae2:: with SMTP id k34mr13222227qvf.247.1591981781951;
 Fri, 12 Jun 2020 10:09:41 -0700 (PDT)
MIME-Version: 1.0
References: <7860963d-c540-1577-600c-106d7236f921@arm.com> <14107.1591915430415249079@groups.io>
 <1886d7a0-cc28-54ce-6d57-b42f3525d6e2@arm.com> <CAPv3WKdvE1P2tuyRRrFudMLbnEwBQE6wzaVq-rhzHw_xnLUV5w@mail.gmail.com>
 <3576864E-A42B-41B1-9D6D-289BE362AECC@unrelenting.technology>
In-Reply-To: <3576864E-A42B-41B1-9D6D-289BE362AECC@unrelenting.technology>
From: "Marcin Wojtas" <mw@semihalf.com>
Date: Fri, 12 Jun 2020 19:09:30 +0200
Message-ID: <CAPv3WKeFD2e3A5X_4YL+XbRjA26vx6A-TQoPmHQceQ_4J5=2Lg@mail.gmail.com>
Subject: Re: [edk2-devel] Additional configuration options on Armada/Cn913x
To: myfreeweb <greg@unrelenting.technology>
Cc: Mark Kettenis <mark.kettenis@xs4all.nl>, edk2-devel-groups-io <devel@edk2.groups.io>, 
	Ard Biesheuvel <ard.biesheuvel@arm.com>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

pt., 12 cze 2020 o 18:32 myfreeweb <greg@unrelenting.technology> napisa=C5=
=82(a):
>
>
>
> On June 12, 2020 3:07:21 PM UTC, Marcin Wojtas <mw@semihalf.com> wrote:
> >Hi,
> >
> >I see Greg was dropped in the meantime.
> >
> >pt., 12 cze 2020 o 10:45 Ard Biesheuvel <ard.biesheuvel@arm.com> napisa=
=C5=82(a):
> >>
> >> On 6/12/20 12:43 AM, Mark Kettenis via Groups.Io wrote:
> >> > On Thu, Jun 11, 2020 at 04:17 PM, Ard Biesheuvel wrote:
> >> >
> >> >     On 6/11/20 4:07 PM, greg@unrelenting.technology wrote:
> >> >
> >> >         June 11, 2020 4:19 PM, "Ard Biesheuvel" <ard.biesheuvel@arm.=
com>
> >> >         wrote:
> >> >
> >> >             On 6/5/20 5:19 PM, Marcin Wojtas via groups.io wrote:
> >> >
> >> >                 Hi,
> >> >                 I'd like to ask for comments before I develop the ac=
tual
> >> >                 code - > currently we have 2 workarounds
> >> >                 done specifically for Linux:
> >> >                 a. ECAM shift in PCIE
> >> >                 b. SPCR address space definition
> >> >
> >> >             What does this mean?
> >> >
> >> >         The SPCR in upstream edk2 is set up to work around some Linu=
x
> >> >         weirdness (?) and I have to do this:
> >> >
> >> >         https://github.com/myfreeweb/edk2-platforms/commit/74ec98a64=
98e78d2ae6c861db88487bf75f2e1a1
> >> >
> >> >         to make it work on FreeBSD.
> >> >
> >> >     Surely, they can't both be correct. Marcin?
> >> >
> >> > Assuming the serial port on Armada/Cn911x is the same as on Armada8k=
,
> >> > the following DT properties would be applicable:
> >> >
> >> > reg-shift =3D <2>;
> >> > reg-io-width =3D <1>
> >> >
> >> > which means the registers are spaced 32-bits apart but have to be
> >> > accessed using 8-bit load/store instructions.  I'd say that
> >> > means that the ACPI Generic Address Space should have RegisterBitWid=
th
> >> > set to 32 and AccessSize set to BYTE.
> >> > In other words, I think that the current:
> >> >
> >> > #define MV_UART_AS32(Address) { EFI_ACPI_5_0_SYSTEM_MEMORY, 32, 0,
> >> > EFI_ACPI_5_0_BYTE, Address }
> >> >
> >> > is correct.  That certainly is what works for OpenBSD.
> >>
> >> Thanks Mark
> >>
> >> The struct type is defined as
> >>
> >> typedef struct {
> >>    UINT8   AddressSpaceId;
> >>    UINT8   RegisterBitWidth;
> >>    UINT8   RegisterBitOffset;
> >>    UINT8   AccessSize;
> >>    UINT64  Address;
> >> } EFI_ACPI_5_0_GENERIC_ADDRESS_STRUCTURE;
> >>
> >> so I agree that the current definition matches a UART that requires by=
te
> >> accesses on registers that are 32 bits apart.
> >>
> >> So why does FreeBSD deviate from this?
> >
> >Greg, can you please explain your concerns here?
>
> Yeah, looking at our code again, looks like we did screw it up, seems lik=
e we are using register width as access width and vice versa :/

Ok, so I'll prepare only a switch to toggle the ECAM hack enablement.

Any chance you submit a fix to phabricator?

Best regards,
Marcin