From nobody Sat May 18 20:37:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+81377+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81377+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1633135967; cv=none; d=zohomail.com; s=zohoarc; b=WsRvwfpiENtrMzUa0BUA9+BQaDEFjRAaz52GVQytWlXhvRrhJadKYdTwzzyZJsjy3dRziZXkdVtwqbdbVl+6cd/mX7bXUJB3oUPencwd6ucXQ3YFSWaDcvBm3AgXESgY8sPTOeSBPrjHGh4Uy0kwM+5yCpOKBxn3AQ7PcHlqxdQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633135967; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=mEAKYzCmQ1D7qedUBrILV6YMBca7XiZDIjdNTT9E8ko=; b=A8Dq8wifr6/QuiZ0hIedVd4Ues/aggjwwWS1AYFcXcX7Xm7Wfc1Apus2ZIuG7nw2HQqyNy2BH/e1Wfef4Dnja0Dvu6WYMyAd9tpkia+/e6ixH6pVz/2dzeRCBuAvpNdxMD6Ry6IEbBWMPWGlmS5bjyEPOQxMUIYsEiT36hzZFQI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81377+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1633135967691723.9873970130485; Fri, 1 Oct 2021 17:52:47 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 3tSDYY1788612xBuJhsTnivN; Fri, 01 Oct 2021 17:52:47 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web09.5729.1633135965792728872 for ; Fri, 01 Oct 2021 17:52:45 -0700 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 634F3113E; Fri, 1 Oct 2021 17:52:45 -0700 (PDT) X-Received: from u200856.usa.arm.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 190633F766; Fri, 1 Oct 2021 17:52:45 -0700 (PDT) From: "Jeremy Linton" To: devel@edk2.groups.io Cc: pete@akeo.ie, ardb+tianocore@kernel.org, leif@nuviainc.com, awarkentin@vmware.com, Sunny.Wang@arm.com, samer.el-haj-mahmoud@arm.com, Jeremy Linton Subject: [edk2-devel] [PATCH 1/5] Platform/RaspberryPi: Fix vfr warning caused by two defaults Date: Fri, 1 Oct 2021 19:52:34 -0500 Message-Id: <20211002005238.40280-2-jeremy.linton@arm.com> In-Reply-To: <20211002005238.40280-1-jeremy.linton@arm.com> References: <20211002005238.40280-1-jeremy.linton@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,jeremy.linton@arm.com X-Gm-Message-State: ddHBB2Q76lrRSbnbPst1TA2Gx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1633135967; bh=5og/z0aYRi1JmYil9Q0oQNnCFiLpiKT4aQyO6IHPGEs=; h=Cc:Date:From:Reply-To:Subject:To; b=OvTXr8EIUeUXeysitAbSUiiwPH3pnWT+MFTbWLyV1P4a2mMbclMEcomOsx2XoI18Ypn y+YAQkf1TMdWvI54w6oXMOm2V039us3cAvPSooo74TMsot00p969LHQtlhZw1y3FcaAe3 UK6XC2m3eb+v0baua1GoPnFIPIgvIhV0GmM= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1633135968317100006 Content-Type: text/plain; charset="utf-8" The build has been tossing a warning about having two defaults for a while now, lets fix it. Signed-off-by: Jeremy Linton Reviewed-by: Andrei Warkentin --- Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr b/Plat= form/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr index 18b3ec726e..e8bf16312d 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr @@ -192,7 +192,7 @@ formset flags =3D NUMERIC_SIZE_4 | INTERACTIVE | RESET_REQUIRED, option text =3D STRING_TOKEN(STR_ADVANCED_SYSTAB_ACPI), value = =3D SYSTEM_TABLE_MODE_ACPI, flags =3D 0; option text =3D STRING_TOKEN(STR_ADVANCED_SYSTAB_BOTH), value = =3D SYSTEM_TABLE_MODE_BOTH, flags =3D DEFAULT; - option text =3D STRING_TOKEN(STR_ADVANCED_SYSTAB_DT), value = =3D SYSTEM_TABLE_MODE_DT, flags =3D DEFAULT; + option text =3D STRING_TOKEN(STR_ADVANCED_SYSTAB_DT), value = =3D SYSTEM_TABLE_MODE_DT, flags =3D0; endoneof; =20 #if (RPI_MODEL =3D=3D 4) --=20 2.13.7 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#81377): https://edk2.groups.io/g/devel/message/81377 Mute This Topic: https://groups.io/mt/86014861/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sat May 18 20:37:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+81378+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81378+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1633135968; cv=none; d=zohomail.com; s=zohoarc; b=h2HrsM3n7zBsNF1ltw+qvFfPJNLHKwqwHVCVzLKsrfF4R6iYtkEMXtrcemsRxysK1gAVAOESSsWc67m5Rv6X4aTEYbGH5puIQp1vfKCovtQ9ROvNX1khdYSfYmJy7rRzHql3SqUtoSVto22gANo0tuNoQtzDXThcKA06JoV33WM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633135968; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=agMzH+66NoQgrQsgwgnBi9Yp+ebvET58yzETxU5Mezo=; b=k/hUZyvwZC4oBphstT86FgDP+/sWge9YQ38Ji6v5wAnbX0wphgUXie7yjG5Ifrs0zQKxsOV4FWMBRo4c134DXRxcKYYwWxwab2uoTr70kNGYLyhWRhcepsoeY9T8zSZOnY4HNUhXw2EpJi/Tp640dUrLuUnk8yEFHKvZuVkvn+Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81378+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1633135968247993.8428869151908; Fri, 1 Oct 2021 17:52:48 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id do05YY1788612xhExtvjlkJT; Fri, 01 Oct 2021 17:52:47 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.5776.1633135966696912201 for ; Fri, 01 Oct 2021 17:52:46 -0700 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 57EF3D6E; Fri, 1 Oct 2021 17:52:46 -0700 (PDT) X-Received: from u200856.usa.arm.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 127093F766; Fri, 1 Oct 2021 17:52:46 -0700 (PDT) From: "Jeremy Linton" To: devel@edk2.groups.io Cc: pete@akeo.ie, ardb+tianocore@kernel.org, leif@nuviainc.com, awarkentin@vmware.com, Sunny.Wang@arm.com, samer.el-haj-mahmoud@arm.com, Jeremy Linton Subject: [edk2-devel] [PATCH 2/5] Platform/RaspberryPi: Expand locking to cover return data Date: Fri, 1 Oct 2021 19:52:35 -0500 Message-Id: <20211002005238.40280-3-jeremy.linton@arm.com> In-Reply-To: <20211002005238.40280-1-jeremy.linton@arm.com> References: <20211002005238.40280-1-jeremy.linton@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,jeremy.linton@arm.com X-Gm-Message-State: omyuRKXMZ0JKMFMI4veqp7KKx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1633135967; bh=qlkso7ip4TcvgT1zgpxnQvTi5Q3Z+9pGksQVs+t8+N4=; h=Cc:Date:From:Reply-To:Subject:To; b=kMWfv1NuJDEfeF9S2WvlnFTkMHfxc1RuB3MMPz0KDu1HYd/0lMtVzaMDxDNXNKethYg DsEgmkvGbG1h0LL+gkMvcSePxvVP75LDRPZcjKIbaOI+C4f4vCLL7x3CwUirImJIJlgYh 7F2jylKlsPUb5JguShF26vJ79z428eC+3zg= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1633135970360100012 Content-Type: text/plain; charset="utf-8" While debugging problems with the GET/SET_CLOCK mailbox calls it appeared that the locking in most of the mailbox commands isn't perfectly correct. All UEFI firmware calls to the RPi mailbox share a single mDmaBuffer which is used to fill out the command passed to the vc firmware, and record its response. The buffer is protected by mMailboxLock, yet in many cases the result of the request is copied from the buffer after the lock has been released. This doesn't currently appear to be causing any problems, but should probably be fixed anyway. There are a couple other minor tweaks in this patch that are hard to justify on their own, one is a bit of whitespace cleanup, and the other is the addition of a debug message to print the returned clock rate for the requested clock. This latter print would have immediatly shown that the vc firmware was returning 0 as the emmc clock rate rather than something reasonable. Signed-off-by: Jeremy Linton Reviewed-by: Andrei Warkentin --- .../Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c | 102 ++++++++++++-----= ---- 1 file changed, 59 insertions(+), 43 deletions(-) diff --git a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c b= /Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c index bf74148bbb..29719aa5ec 100644 --- a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c +++ b/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c @@ -203,7 +203,6 @@ RpiFirmwareSetPowerState ( =20 Status =3D MailboxTransaction (Cmd->BufferHead.BufferSize, RPI_MBOX_VC_C= HANNEL, &Result); =20 - ReleaseSpinLock (&mMailboxLock); =20 if (EFI_ERROR (Status) || Cmd->BufferHead.Response !=3D RPI_MBOX_RESP_SUCCESS) { @@ -219,6 +218,7 @@ RpiFirmwareSetPowerState ( __FUNCTION__, PowerState ? "en" : "dis", DeviceId)); Status =3D EFI_DEVICE_ERROR; } + ReleaseSpinLock (&mMailboxLock); =20 return Status; } @@ -266,18 +266,20 @@ RpiFirmwareGetArmMemory ( =20 Status =3D MailboxTransaction (Cmd->BufferHead.BufferSize, RPI_MBOX_VC_C= HANNEL, &Result); =20 - ReleaseSpinLock (&mMailboxLock); =20 if (EFI_ERROR (Status) || Cmd->BufferHead.Response !=3D RPI_MBOX_RESP_SUCCESS) { DEBUG ((DEBUG_ERROR, "%a: mailbox transaction error: Status =3D=3D %r, Response =3D=3D 0x= %x\n", __FUNCTION__, Status, Cmd->BufferHead.Response)); + ReleaseSpinLock (&mMailboxLock); return EFI_DEVICE_ERROR; } =20 *Base =3D Cmd->TagBody.Base; *Size =3D Cmd->TagBody.Size; + ReleaseSpinLock (&mMailboxLock); + return EFI_SUCCESS; } =20 @@ -323,17 +325,18 @@ RpiFirmwareGetMacAddress ( =20 Status =3D MailboxTransaction (Cmd->BufferHead.BufferSize, RPI_MBOX_VC_C= HANNEL, &Result); =20 - ReleaseSpinLock (&mMailboxLock); - if (EFI_ERROR (Status) || Cmd->BufferHead.Response !=3D RPI_MBOX_RESP_SUCCESS) { DEBUG ((DEBUG_ERROR, "%a: mailbox transaction error: Status =3D=3D %r, Response =3D=3D 0x= %x\n", __FUNCTION__, Status, Cmd->BufferHead.Response)); + ReleaseSpinLock (&mMailboxLock); return EFI_DEVICE_ERROR; } =20 CopyMem (MacAddress, Cmd->TagBody.MacAddress, sizeof (Cmd->TagBody.MacAd= dress)); + ReleaseSpinLock (&mMailboxLock); + return EFI_SUCCESS; } =20 @@ -378,17 +381,17 @@ RpiFirmwareGetSerial ( =20 Status =3D MailboxTransaction (Cmd->BufferHead.BufferSize, RPI_MBOX_VC_C= HANNEL, &Result); =20 - ReleaseSpinLock (&mMailboxLock); - if (EFI_ERROR (Status) || Cmd->BufferHead.Response !=3D RPI_MBOX_RESP_SUCCESS) { DEBUG ((DEBUG_ERROR, "%a: mailbox transaction error: Status =3D=3D %r, Response =3D=3D 0x= %x\n", __FUNCTION__, Status, Cmd->BufferHead.Response)); + ReleaseSpinLock (&mMailboxLock); return EFI_DEVICE_ERROR; } =20 *Serial =3D Cmd->TagBody.Serial; + ReleaseSpinLock (&mMailboxLock); // Some platforms return 0 or 0x0000000010000000 for serial. // For those, try to use the MAC address. if ((*Serial =3D=3D 0) || ((*Serial & 0xFFFFFFFF0FFFFFFFULL) =3D=3D 0)) { @@ -441,17 +444,18 @@ RpiFirmwareGetModel ( =20 Status =3D MailboxTransaction (Cmd->BufferHead.BufferSize, RPI_MBOX_VC_C= HANNEL, &Result); =20 - ReleaseSpinLock (&mMailboxLock); - if (EFI_ERROR (Status) || Cmd->BufferHead.Response !=3D RPI_MBOX_RESP_SUCCESS) { DEBUG ((DEBUG_ERROR, "%a: mailbox transaction error: Status =3D=3D %r, Response =3D=3D 0x= %x\n", __FUNCTION__, Status, Cmd->BufferHead.Response)); + ReleaseSpinLock (&mMailboxLock); return EFI_DEVICE_ERROR; } =20 *Model =3D Cmd->TagBody.Model; + ReleaseSpinLock (&mMailboxLock); + return EFI_SUCCESS; } =20 @@ -496,17 +500,18 @@ RpiFirmwareGetModelRevision ( =20 Status =3D MailboxTransaction (Cmd->BufferHead.BufferSize, RPI_MBOX_VC_C= HANNEL, &Result); =20 - ReleaseSpinLock (&mMailboxLock); - if (EFI_ERROR (Status) || Cmd->BufferHead.Response !=3D RPI_MBOX_RESP_SUCCESS) { DEBUG ((DEBUG_ERROR, "%a: mailbox transaction error: Status =3D=3D %r, Response =3D=3D 0x= %x\n", __FUNCTION__, Status, Cmd->BufferHead.Response)); + ReleaseSpinLock (&mMailboxLock); return EFI_DEVICE_ERROR; } =20 *Revision =3D Cmd->TagBody.Revision; + ReleaseSpinLock (&mMailboxLock); + return EFI_SUCCESS; } =20 @@ -538,17 +543,18 @@ RpiFirmwareGetFirmwareRevision ( =20 Status =3D MailboxTransaction (Cmd->BufferHead.BufferSize, RPI_MBOX_VC_C= HANNEL, &Result); =20 - ReleaseSpinLock (&mMailboxLock); - if (EFI_ERROR (Status) || Cmd->BufferHead.Response !=3D RPI_MBOX_RESP_SUCCESS) { DEBUG ((DEBUG_ERROR, "%a: mailbox transaction error: Status =3D=3D %r, Response =3D=3D 0x= %x\n", __FUNCTION__, Status, Cmd->BufferHead.Response)); + ReleaseSpinLock (&mMailboxLock); return EFI_DEVICE_ERROR; } =20 *Revision =3D Cmd->TagBody.Revision; + ReleaseSpinLock (&mMailboxLock); + return EFI_SUCCESS; } =20 @@ -831,18 +837,19 @@ RpiFirmwareGetFbSize ( =20 Status =3D MailboxTransaction (Cmd->BufferHead.BufferSize, RPI_MBOX_VC_C= HANNEL, &Result); =20 - ReleaseSpinLock (&mMailboxLock); - if (EFI_ERROR (Status) || Cmd->BufferHead.Response !=3D RPI_MBOX_RESP_SUCCESS) { DEBUG ((DEBUG_ERROR, "%a: mailbox transaction error: Status =3D=3D %r, Response =3D=3D 0= x%x\n", __FUNCTION__, Status, Cmd->BufferHead.Response)); + ReleaseSpinLock (&mMailboxLock); return EFI_DEVICE_ERROR; } =20 *Width =3D Cmd->TagBody.Width; *Height =3D Cmd->TagBody.Height; + ReleaseSpinLock (&mMailboxLock); + return EFI_SUCCESS; } =20 @@ -872,16 +879,18 @@ RpiFirmwareFreeFb (VOID) Cmd->EndTag =3D 0; =20 Status =3D MailboxTransaction (Cmd->BufferHead.BufferSize, RPI_MBOX_VC_C= HANNEL, &Result); - ReleaseSpinLock (&mMailboxLock); =20 if (EFI_ERROR (Status) || Cmd->BufferHead.Response !=3D RPI_MBOX_RESP_SUCCESS) { DEBUG ((DEBUG_ERROR, "%a: mailbox transaction error: Status =3D=3D %r, Response =3D=3D 0x= %x\n", __FUNCTION__, Status, Cmd->BufferHead.Response)); + ReleaseSpinLock (&mMailboxLock); return EFI_DEVICE_ERROR; } =20 + ReleaseSpinLock (&mMailboxLock); + return EFI_SUCCESS; } =20 @@ -935,19 +944,20 @@ RpiFirmwareAllocFb ( =20 Status =3D MailboxTransaction (Cmd->BufferHead.BufferSize, RPI_MBOX_VC_C= HANNEL, &Result); =20 - ReleaseSpinLock (&mMailboxLock); - if (EFI_ERROR (Status) || Cmd->BufferHead.Response !=3D RPI_MBOX_RESP_SUCCESS) { DEBUG ((DEBUG_ERROR, "%a: mailbox transaction error: Status =3D=3D %r, Response =3D=3D 0x= %x\n", __FUNCTION__, Status, Cmd->BufferHead.Response)); + ReleaseSpinLock (&mMailboxLock); return EFI_DEVICE_ERROR; } =20 *Pitch =3D Cmd->Pitch.Pitch; *FbBase =3D Cmd->AllocFb.AlignmentBase - BCM2836_DMA_DEVICE_OFFSET; *FbSize =3D Cmd->AllocFb.Size; + ReleaseSpinLock (&mMailboxLock); + return EFI_SUCCESS; } =20 @@ -999,13 +1009,12 @@ RpiFirmwareGetCommmandLine ( =20 Status =3D MailboxTransaction (Cmd->BufferHead.BufferSize, RPI_MBOX_VC_C= HANNEL, &Result); =20 - ReleaseSpinLock (&mMailboxLock); - if (EFI_ERROR (Status) || Cmd->BufferHead.Response !=3D RPI_MBOX_RESP_SUCCESS) { DEBUG ((DEBUG_ERROR, "%a: mailbox transaction error: Status =3D=3D %r, Response =3D=3D 0x= %x\n", __FUNCTION__, Status, Cmd->BufferHead.Response)); + ReleaseSpinLock (&mMailboxLock); return EFI_DEVICE_ERROR; } =20 @@ -1013,6 +1022,7 @@ RpiFirmwareGetCommmandLine ( if (Cmd->TagHead.TagValueSize >=3D BufferSize && Cmd->CommandLine[Cmd->TagHead.TagValueSize - 1] !=3D '\0') { DEBUG ((DEBUG_ERROR, "%a: insufficient buffer size\n", __FUNCTION__)); + ReleaseSpinLock (&mMailboxLock); return EFI_OUT_OF_RESOURCES; } =20 @@ -1026,6 +1036,7 @@ RpiFirmwareGetCommmandLine ( CommandLine[Cmd->TagHead.TagValueSize] =3D '\0'; } =20 + ReleaseSpinLock (&mMailboxLock); return EFI_SUCCESS; } =20 @@ -1075,18 +1086,20 @@ RpiFirmwareSetClockRate ( Cmd->TagBody.SkipTurbo =3D SkipTurbo ? 1 : 0; Cmd->EndTag =3D 0; =20 + DEBUG ((DEBUG_ERROR, "%a: Request clock rate %X =3D %d\n", __FUNCTION__,= ClockId, ClockRate)); Status =3D MailboxTransaction (Cmd->BufferHead.BufferSize, RPI_MBOX_VC_C= HANNEL, &Result); =20 - ReleaseSpinLock (&mMailboxLock); - if (EFI_ERROR (Status) || Cmd->BufferHead.Response !=3D RPI_MBOX_RESP_SUCCESS) { DEBUG ((DEBUG_ERROR, "%a: mailbox transaction error: Status =3D=3D %r, Response =3D=3D 0x= %x\n", __FUNCTION__, Status, Cmd->BufferHead.Response)); + ReleaseSpinLock (&mMailboxLock); return EFI_DEVICE_ERROR; } =20 + ReleaseSpinLock (&mMailboxLock); + return EFI_SUCCESS; } =20 @@ -1131,20 +1144,23 @@ RpiFirmwareGetClockRate ( Cmd->TagHead.TagValueSize =3D 0; Cmd->TagBody.ClockId =3D ClockId; Cmd->EndTag =3D 0; - +=20 Status =3D MailboxTransaction (Cmd->BufferHead.BufferSize, RPI_MBOX_VC_C= HANNEL, &Result); =20 - ReleaseSpinLock (&mMailboxLock); - if (EFI_ERROR (Status) || Cmd->BufferHead.Response !=3D RPI_MBOX_RESP_SUCCESS) { DEBUG ((DEBUG_ERROR, "%a: mailbox transaction error: Status =3D=3D %r, Response =3D=3D 0x= %x\n", __FUNCTION__, Status, Cmd->BufferHead.Response)); + ReleaseSpinLock (&mMailboxLock); return EFI_DEVICE_ERROR; } =20 *ClockRate =3D Cmd->TagBody.ClockRate; + ReleaseSpinLock (&mMailboxLock); + + DEBUG ((DEBUG_ERROR, "%a: Get Clock Rate return: ClockRate=3D%d ClockId= =3D%X\n", __FUNCTION__, *ClockRate, ClockId)); + return EFI_SUCCESS; } =20 @@ -1191,7 +1207,7 @@ RpiFirmwareGetMinClockRate ( { return RpiFirmwareGetClockRate (ClockId, RPI_MBOX_GET_MIN_CLOCK_RATE, Cl= ockRate); } - + #pragma pack() typedef struct { UINT32 ClockId; @@ -1236,16 +1252,17 @@ RpiFirmwareSetClockState ( =20 Status =3D MailboxTransaction (Cmd->BufferHead.BufferSize, RPI_MBOX_VC_C= HANNEL, &Result); =20 - ReleaseSpinLock (&mMailboxLock); - if (EFI_ERROR (Status) || Cmd->BufferHead.Response !=3D RPI_MBOX_RESP_SUCCESS) { DEBUG ((DEBUG_ERROR, "%a: mailbox transaction error: Status =3D=3D %r, Response =3D=3D 0x= %x\n", __FUNCTION__, Status, Cmd->BufferHead.Response)); + ReleaseSpinLock (&mMailboxLock); return EFI_DEVICE_ERROR; } =20 + ReleaseSpinLock (&mMailboxLock); + return EFI_SUCCESS; } =20 @@ -1297,16 +1314,15 @@ RpiFirmwareSetGpio ( =20 Status =3D MailboxTransaction (Cmd->BufferHead.BufferSize, RPI_MBOX_VC_C= HANNEL, &Result); =20 - ReleaseSpinLock (&mMailboxLock); - if (EFI_ERROR (Status) || Cmd->BufferHead.Response !=3D RPI_MBOX_RESP_SUCCESS) { DEBUG ((DEBUG_ERROR, "%a: mailbox transaction error: Status =3D=3D %r, Response =3D=3D 0= x%x\n", __FUNCTION__, Status, Cmd->BufferHead.Response)); } + ReleaseSpinLock (&mMailboxLock); } - + STATIC VOID EFIAPI @@ -1361,8 +1377,6 @@ RpiFirmwareNotifyXhciReset ( =20 Status =3D MailboxTransaction (Cmd->BufferHead.BufferSize, RPI_MBOX_VC_C= HANNEL, &Result); =20 - ReleaseSpinLock (&mMailboxLock); - if (EFI_ERROR (Status) || Cmd->BufferHead.Response !=3D RPI_MBOX_RESP_SUCCESS) { DEBUG ((DEBUG_ERROR, @@ -1370,6 +1384,8 @@ RpiFirmwareNotifyXhciReset ( __FUNCTION__, Status, Cmd->BufferHead.Response)); } =20 + ReleaseSpinLock (&mMailboxLock); + return Status; } =20 @@ -1424,8 +1440,6 @@ RpiFirmwareNotifyGpioGetCfg ( =20 *Polarity =3D Cmd->TagBody.Polarity; =20 - ReleaseSpinLock (&mMailboxLock); - if (EFI_ERROR (Status) || Cmd->BufferHead.Response !=3D RPI_MBOX_RESP_SUCCESS) { DEBUG ((DEBUG_ERROR, @@ -1433,6 +1447,8 @@ RpiFirmwareNotifyGpioGetCfg ( __FUNCTION__, Status, Cmd->BufferHead.Response)); } =20 + ReleaseSpinLock (&mMailboxLock); + return Status; } =20 @@ -1471,8 +1487,8 @@ RpiFirmwareNotifyGpioSetCfg ( =20 Status =3D RpiFirmwareNotifyGpioGetCfg (Gpio, &Result); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a: Failed to get GPIO polarity\n", __FUNCTION__)= ); - Result =3D 0; //default polarity + DEBUG ((DEBUG_ERROR, "%a: Failed to get GPIO polarity\n", __FUNCTION= __)); + Result =3D 0; //default polarity } =20 =20 @@ -1488,7 +1504,7 @@ RpiFirmwareNotifyGpioSetCfg ( Cmd->BufferHead.Response =3D 0; Cmd->TagHead.TagId =3D RPI_MBOX_SET_GPIO_CONFIG; Cmd->TagHead.TagSize =3D sizeof (Cmd->TagBody); - + Cmd->TagBody.Gpio =3D 128 + Gpio; Cmd->TagBody.Direction =3D Direction; Cmd->TagBody.Polarity =3D Result; @@ -1501,17 +1517,17 @@ RpiFirmwareNotifyGpioSetCfg ( =20 Status =3D MailboxTransaction (Cmd->BufferHead.BufferSize, RPI_MBOX_VC_C= HANNEL, &Result); =20 - ReleaseSpinLock (&mMailboxLock); - if (EFI_ERROR (Status) || Cmd->BufferHead.Response !=3D RPI_MBOX_RESP_SUCCESS) { DEBUG ((DEBUG_ERROR, "%a: mailbox transaction error: Status =3D=3D %r, Response =3D=3D 0= x%x\n", __FUNCTION__, Status, Cmd->BufferHead.Response)); } - - RpiFirmwareSetGpio (Gpio,!State); - + + ReleaseSpinLock (&mMailboxLock); + + RpiFirmwareSetGpio (Gpio,!State); + =20 return Status; } @@ -1540,7 +1556,7 @@ STATIC RASPBERRY_PI_FIRMWARE_PROTOCOL mRpiFirmwarePro= tocol =3D { RPiFirmwareGetModelInstalledMB, RpiFirmwareNotifyXhciReset, RpiFirmwareGetCurrentClockState, - RpiFirmwareSetClockState, + RpiFirmwareSetClockState, RpiFirmwareNotifyGpioSetCfg }; =20 --=20 2.13.7 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#81378): https://edk2.groups.io/g/devel/message/81378 Mute This Topic: https://groups.io/mt/86014862/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sat May 18 20:37:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+81379+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81379+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1633135969; cv=none; d=zohomail.com; s=zohoarc; b=hHq4BXx5WtbqPoQGuth/Q60nveqrEVcNOFy2JvrOXo8ZPlUvUCEitzmpZycWN/54nlTSJpjA8W5eQjE55jVJ5ADvGFeHBNcWCNvqBLRaI4JiS2Gqn5LGWVgdWUG+nYpW930vF4u8re+nFnTD2BASBONsPk3X7zFbdZCXlqKJSh0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633135969; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=4s5V80iYxD80AW+o2+GmSb9tVh7mUbgXaLTCviVvpF4=; b=diMJQp1rC2kqT+hu+wZ3koyqQHzhNGA7rqEU02SfjH9l8BxU64X3dxP9XP/dA5fGof6B00fEzvt+rqZgWbzeZOAk01xJf2Sqh+kkNPdGw/IVvuRv+iAxoTiktQFwK5he5+PvIrIoMfppkfRXQE/GRkmKmb1elwqUTxaddL16ooQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81379+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1633135969069549.8351425632283; Fri, 1 Oct 2021 17:52:49 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id H4dLYY1788612xdS3GUXya6T; Fri, 01 Oct 2021 17:52:48 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.5603.1633135967577786677 for ; Fri, 01 Oct 2021 17:52:47 -0700 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 39787113E; Fri, 1 Oct 2021 17:52:47 -0700 (PDT) X-Received: from u200856.usa.arm.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E262A3F766; Fri, 1 Oct 2021 17:52:46 -0700 (PDT) From: "Jeremy Linton" To: devel@edk2.groups.io Cc: pete@akeo.ie, ardb+tianocore@kernel.org, leif@nuviainc.com, awarkentin@vmware.com, Sunny.Wang@arm.com, samer.el-haj-mahmoud@arm.com, Jeremy Linton Subject: [edk2-devel] [PATCH 3/5] Platform/RaspberryPi: Update Linux quirk name Date: Fri, 1 Oct 2021 19:52:36 -0500 Message-Id: <20211002005238.40280-4-jeremy.linton@arm.com> In-Reply-To: <20211002005238.40280-1-jeremy.linton@arm.com> References: <20211002005238.40280-1-jeremy.linton@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,jeremy.linton@arm.com X-Gm-Message-State: Z7H446LTBRAKWePGCdDifjKMx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1633135968; bh=QHgmU0c4aX3b6HtWJSnrRg9oVzaaABZEkQkjMLnyRwg=; h=Cc:Date:From:Reply-To:Subject:To; b=qnv+Y/Y09OlTzpXOw6VFmWs+k0uE43MeZROsH2XTibOM7ig3finNNBk4OeZ+pNvszaX Zu8LyN2cMHnPid1MovxM6CWZ+y1eZ9ub/3vqLuMOuVR850N794nXI6agwV2kXYZCWubTM D3WTgjL2rc6T0FifL0q898MzJFQG9kVmPeU= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1633135970359100011 Content-Type: text/plain; charset="utf-8" During review/merge of the linux ecam quirk, some logic was added to require the quirk name to be exactly 6 characters, matching the MADT field its overriding. As such, the rpi quirk here needed to be shorted by a character to avoid confusion. Signed-off-by: Jeremy Linton Reviewed-by: Andrei Warkentin --- Platform/RaspberryPi/AcpiTables/Pci.asl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Platform/RaspberryPi/AcpiTables/Pci.asl b/Platform/RaspberryPi= /AcpiTables/Pci.asl index ee37b7a21e..e5fe755923 100644 --- a/Platform/RaspberryPi/AcpiTables/Pci.asl +++ b/Platform/RaspberryPi/AcpiTables/Pci.asl @@ -65,7 +65,7 @@ DefinitionBlock (__FILE__, "SSDT", 5, "RPIFDN", "RPI4PCIE= ", 2) Name (_DSD, Package () { ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), Package () { - Package () { "linux-ecam-quirk-id", "bcm2711" }, + Package () { "linux-ecam-quirk-id", "bc2711" }, } }) =20 --=20 2.13.7 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#81379): https://edk2.groups.io/g/devel/message/81379 Mute This Topic: https://groups.io/mt/86014863/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sat May 18 20:37:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+81380+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81380+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1633135969; cv=none; d=zohomail.com; s=zohoarc; b=mYYqL43dEz3GY3mLqFIRTeOUKJFPhlkoxi/k+ck+soUR3fzm/e0Z7c5HGaDDShf9V7pnBkWnvJzY21tqpTI+6MybZeC/Q6E/Egvfb/HBGRdOh1nAxLacTD3uKU1yS5xgzLQ+0r6BKKz3tKzb9GQj911DWXkXhJO7X1cWThuzm5Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633135969; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=Xtj7v6fBGAg02g0wDPO7bYIZJ0JpFNrpeXcNZcEauro=; b=YElGHeHF+xJLkrw0XfID2VQrDihMNn1ctRvQPrg+5T6RsmLG1zqOPXKXsl7ApnaPgmKFLDDXId8Km2monAdUsrBTecUMq78TQCPESEPkHG/QdzHTHIJlTh6SBfPr8EkQY9KePBC6fNxYPaVvo2ks/H72xc/n12CcvJZemaPYHlk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81380+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1633135969536575.9240542898193; Fri, 1 Oct 2021 17:52:49 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id mGuDYY1788612x6tHnevsEne; Fri, 01 Oct 2021 17:52:49 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.5777.1633135968326986995 for ; Fri, 01 Oct 2021 17:52:48 -0700 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0DDB8D6E; Fri, 1 Oct 2021 17:52:48 -0700 (PDT) X-Received: from u200856.usa.arm.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BCF463F766; Fri, 1 Oct 2021 17:52:47 -0700 (PDT) From: "Jeremy Linton" To: devel@edk2.groups.io Cc: pete@akeo.ie, ardb+tianocore@kernel.org, leif@nuviainc.com, awarkentin@vmware.com, Sunny.Wang@arm.com, samer.el-haj-mahmoud@arm.com, Jeremy Linton Subject: [edk2-devel] [PATCH 4/5] Platform/RaspberryPi: Normal memory should not be marked as uncached Date: Fri, 1 Oct 2021 19:52:37 -0500 Message-Id: <20211002005238.40280-5-jeremy.linton@arm.com> In-Reply-To: <20211002005238.40280-1-jeremy.linton@arm.com> References: <20211002005238.40280-1-jeremy.linton@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,jeremy.linton@arm.com X-Gm-Message-State: UAyq3GKzTmaLHk6S6cAFdY9Nx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1633135969; bh=GYu3RZG5ctxJosVn51Mg5dIBLab7iRs+6W/mR/fv9G8=; h=Cc:Date:From:Reply-To:Subject:To; b=oLLHQkd0WkV/iX1zJBk06/1JBSvfAAm9QHKlK8QY6AWXWfkV/oaxYo6khu+5KXfIBKl kXMQajD/qASzHrYzDhP7pfcxUEqmoJDO+B2JVv93ccmxAuGfwBdFtLN33i7E1Jp3Rd/CA pD11TiyCUy8NwsyfdM4yPUqd6EYJyNffXRw= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1633135970363100013 Content-Type: text/plain; charset="utf-8" The efi spec seems to indicate that the efi uncacheable attribute should be mapped to device memory rather than normal-nc. This means that the uefi mem attribute for the >3G ram doesn't match the remainder of the RAM in the machine. So, lets remove the uncacheable attribute to make it more consistent. Signed-off-by: Jeremy Linton --- Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/= RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c index 2ef7da67bd..415d99fadb 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c @@ -499,7 +499,7 @@ ApplyVariables ( =20 Status =3D gDS->AddMemorySpace (EfiGcdMemoryTypeSystemMemory, 3UL * BA= SE_1GB, SystemMemorySizeBelow4GB - (3UL * SIZE_1GB), - EFI_MEMORY_UC | EFI_MEMORY_WC | EFI_MEMORY_WT | EFI_ME= MORY_WB); + EFI_MEMORY_WC | EFI_MEMORY_WT | EFI_MEMORY_WB); ASSERT_EFI_ERROR (Status); Status =3D gDS->SetMemorySpaceAttributes (3UL * BASE_1GB, SystemMemorySizeBelow4GB - (3UL * SIZE_1GB), EFI_MEMOR= Y_WB); @@ -511,7 +511,7 @@ ApplyVariables ( // Status =3D gDS->AddMemorySpace (EfiGcdMemoryTypeSystemMemory, 4UL * = BASE_1GB, SystemMemorySize - (4UL * SIZE_1GB), - EFI_MEMORY_UC | EFI_MEMORY_WC | EFI_MEMORY_WT | EFI_= MEMORY_WB); + EFI_MEMORY_WC | EFI_MEMORY_WT | EFI_MEMORY_WB); ASSERT_EFI_ERROR (Status); Status =3D gDS->SetMemorySpaceAttributes (4UL * BASE_1GB, SystemMemorySize - (4UL * SIZE_1GB), EFI_MEMORY_WB); --=20 2.13.7 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#81380): https://edk2.groups.io/g/devel/message/81380 Mute This Topic: https://groups.io/mt/86014864/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sat May 18 20:37:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+81381+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81381+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1633135970; cv=none; d=zohomail.com; s=zohoarc; b=JaaPO6hBklIFyKchQE0dV5Aa/1qsmU40/crAB1t3zic3r+jGWES3i67GRKfuHXGI7/55zL9rt0wKuvY+HF6myCxI3YZ6cEFdMYTgTgknyaRaL86+oF8i93dunbPtEB7dPnLHReFCgOGTQXGVsrrWrG1LCt6MstaUKN/nIFWHTeY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633135970; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=cGw2TKZBtvCu2xXOknnPSiYiWeIVKAS1uR1qxM3YWYA=; b=lbIHIyR3y86R/fWe9yzc4SgFPFFIv9H6RPaiIKKbzCJTD2NoPCaQdPXAYS0s2GllZs7+VZJa9MWlvQoU6337AfeBmlaALPBRtPhK3LrPLcqJTKB2p95veujNUaJhEKGDGU+41qMa6sLBIbS0J1R6yieHwJlK/ud6+EHrD3ToBsg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81381+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1633135970570248.87296499872696; Fri, 1 Oct 2021 17:52:50 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id K0AWYY1788612xWvL4atGljv; Fri, 01 Oct 2021 17:52:50 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web09.5730.1633135969349559094 for ; Fri, 01 Oct 2021 17:52:49 -0700 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E54F5113E; Fri, 1 Oct 2021 17:52:48 -0700 (PDT) X-Received: from u200856.usa.arm.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A01123F766; Fri, 1 Oct 2021 17:52:48 -0700 (PDT) From: "Jeremy Linton" To: devel@edk2.groups.io Cc: pete@akeo.ie, ardb+tianocore@kernel.org, leif@nuviainc.com, awarkentin@vmware.com, Sunny.Wang@arm.com, samer.el-haj-mahmoud@arm.com, Jeremy Linton Subject: [edk2-devel] [PATCH 5/5] Platform/RaspberryPi: Disconnect/shutdown all drivers before reboot Date: Fri, 1 Oct 2021 19:52:38 -0500 Message-Id: <20211002005238.40280-6-jeremy.linton@arm.com> In-Reply-To: <20211002005238.40280-1-jeremy.linton@arm.com> References: <20211002005238.40280-1-jeremy.linton@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,jeremy.linton@arm.com X-Gm-Message-State: Z7Qr8aHwZDKZU0ydwDoePoNIx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1633135970; bh=7KJQWRCU5/UHvjkKQ3OOnQWg7EOITlhYMi2q9ZAVTsA=; h=Cc:Date:From:Reply-To:Subject:To; b=lTJ/NKkz68fYJla016k9NCMM9EaztFZPdDhsW594TBGXiDOjIr1S0NaGf0442xfthJE vR8+j6m974aoIdKdV7xDkbF2hSGaK2tiDRWmcAatP7BC+148VTBRXbkiQHylqCzBt0Qg1 hzTwHLAwBbdK6zjQQ4FbSn026jLbTJMAUKA= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1633135972372100023 Content-Type: text/plain; charset="utf-8" In theory we should be properly cleaning up all the device drivers before pulling the big switch. Particularly the partition mgr will issue flush commands to attached disks as it goes down. This assures that devices running in WB mode (that correctly handle flush/sync/etc) commands are persisted to physical media before we hit reset. Without this, there are definitly cases where the relevant specifications don't guarantee persistence of data in their buffers in the face of reset conditions. We can't really do anything about the many devices that don't honor persistance requests but we can start here. Signed-off-by: Jeremy Linton Reviewed-by: Andrei Warkentin --- Platform/RaspberryPi/Library/ResetLib/ResetLib.c | 44 ++++++++++++++++++++= ++++ 1 file changed, 44 insertions(+) diff --git a/Platform/RaspberryPi/Library/ResetLib/ResetLib.c b/Platform/Ra= spberryPi/Library/ResetLib/ResetLib.c index a70eee485d..036f619cb5 100644 --- a/Platform/RaspberryPi/Library/ResetLib/ResetLib.c +++ b/Platform/RaspberryPi/Library/ResetLib/ResetLib.c @@ -19,11 +19,54 @@ #include #include #include +#include #include #include =20 #include =20 + +/** + Disconnect everything. + Modified from the UEFI 2.3 spec (May 2009 version) + + @retval EFI_SUCCESS The operation was successful. + +**/ +EFI_STATUS +DisconnectAll( + VOID + ) +{ + EFI_STATUS Status; + UINTN HandleCount; + EFI_HANDLE *HandleBuffer; + UINTN HandleIndex; + + // + // Retrieve the list of all handles from the handle database + // + Status =3D gBS->LocateHandleBuffer ( + AllHandles, + NULL, + NULL, + &HandleCount, + &HandleBuffer + ); + if (!EFI_ERROR (Status)) { + for (HandleIndex =3D 0; HandleIndex < HandleCount; HandleIndex++) { + Status =3D gBS->DisconnectController ( + HandleBuffer[HandleIndex], + NULL, + NULL + ); + } + gBS->FreePool(HandleBuffer); + } + return (EFI_SUCCESS); +} + + /** Resets the entire platform. =20 @@ -57,6 +100,7 @@ LibResetSystem ( if (Delay !=3D 0) { DEBUG ((DEBUG_INFO, "Platform will be reset in %d.%d seconds...\n", Delay / 1000000, (Delay % 1000000) / 100000)); + DisconnectAll (); MicroSecondDelay (Delay); } } --=20 2.13.7 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#81381): https://edk2.groups.io/g/devel/message/81381 Mute This Topic: https://groups.io/mt/86014865/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-