From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ua1-f46.google.com (mail-ua1-f46.google.com [209.85.222.46]) by mx.groups.io with SMTP id smtpd.web10.11800.1655157094838553199 for ; Mon, 13 Jun 2022 14:51:35 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jr4R9CIX; spf=pass (domain: gmail.com, ip: 209.85.222.46, mailfrom: pedro.falcato@gmail.com) Received: by mail-ua1-f46.google.com with SMTP id r9so2610067uaf.13 for ; Mon, 13 Jun 2022 14:51:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=1XeWG18l/GU7P8u1kpZcZZcMnkiFAwgr4JetvktzHdM=; b=jr4R9CIXvGxYWt0BC9Hjkg5YC7Xq/bfm+vgrGX9vlh3hU6DuyOCX9dEz9d+bqorciS SnSVHqOrTrCkEOyDc+u5Nq/I3NGhEXXvI8N2ZL6askXewIwFsxce3WY4iHySStVJ8pZM O13lj6Vt41s5PE4lpspbw9qtyZqUbxuDvBI5NJvU7vHBxsPA4rZINh9uTFO/myooaGRn pAjC+lDEBOtJPgwCnaOEzKRvMC/35jRCKMkXnKMOHGB0arS1FrS4gkpgzcnp/gfwll3B a87oIFMQRnKMvtfL/xevDjG0Qz4LRDlenMjR4e6tviEsfOcR8uiJbBUfBewylLsq7Npw uhaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=1XeWG18l/GU7P8u1kpZcZZcMnkiFAwgr4JetvktzHdM=; b=DfCXEeKsJM/4Z6ZOK26wde4q6xw5XFXfsI2dIjIFhy6L/U0uPNZpTSPr3UwPxYqM/i 3nsW6LeHZa/SOARmHTHmxdquLO1BDXeljXMnbsA1SCshRXRkL7Kw/iQz2Y5S/ILaMhpn esbPk08VqwDdpVxyr2Khv37h7upu9wPVZv1FtUsIvUyg3J5m/+CzxO2UZf1foXOw8pVD NCJaHeMjsq/MtjXZ7vYKVXeiMZ9F4z8mGSrQxXAQNcAVcgi9WYPZElPWu7xuw+ocMjfr eGhr3EGAlue4+RKqVwb8x8svTBF8MQrKlSa/NlbW/IU8v53yJUuOspvH32x8D1DyoPhm EEqg== X-Gm-Message-State: AJIora++3j/Cl8Xh5wqQ0XDCmeQu04OWxfxLwNqPY9L2x12q5G27ILVT c/NKpJ0zyOlBK+kxfAIjnBQtha6+uLnyqP51lWzQawPoXDE= X-Google-Smtp-Source: AGRyM1trH2+TxULOgersRM3r5760BVMkWJhtznDolCZkQ0hG6nnBPB4p1w+RIbP+H1tXHSObQMaLUqwk1xZgZr3VQUo= X-Received: by 2002:ab0:6032:0:b0:378:fc3d:ebd7 with SMTP id n18-20020ab06032000000b00378fc3debd7mr923691ual.40.1655157093839; Mon, 13 Jun 2022 14:51:33 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: "Pedro Falcato" Date: Mon, 13 Jun 2022 22:51:23 +0100 Message-ID: Subject: Re: [edk2-devel] Physical Address of buffer To: edk2-devel-groups-io , xzavierpower@gmail.com Content-Type: multipart/alternative; boundary="000000000000a0378605e15b4a4a" --000000000000a0378605e15b4a4a Content-Type: text/plain; charset="UTF-8" Hi, Does this work for you? https://edk2-docs.gitbook.io/edk-ii-uefi-driver-writer-s-guide/18_pci_driver_design_guidelines/readme.5 On Mon, Jun 13, 2022 at 8:39 PM M.T. wrote: > Hello > > I'm trying to port some code which interacts with memory mapped hardware > registers. > The original code was developed in 2015-18 on edk2, and does not want to > compile anymore. > > The way it works is there are three 32 bit registers. > The first is a status/command register which I read to determine if the > hardware is ready. > The next two are used to pass a 64-bit memory address (hi + lo). > Once the param registers are set, I update the command/status register and > the hardware executes the command returning the results at the address > provided by the two param registers. > > In the original code, the address of the buffer is used to fill in the two > param registers, and as far as I can tell this worked back then. > When I try to do the same, the address in my pointer is only 32 bits long, > a virtual address, not a physical address. > > Is there a way I can convert this 32 bit virtual address to a 64-bit > physical address in a uefi shell app, or would I need a driver to do this? > I did something similar in linux for memory mapped IO, I am guessing I > just haven't found the right function for this yet. > > I would greatly appreciate it if someone could point me in the right > direction. > > Thank you > xp > > > > > > -- Pedro Falcato --000000000000a0378605e15b4a4a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,


On Mon, Jun 13, 2022 at 8:39 PM M.T. <xzavierpower@gmail.com> wrote:
Hello

I'm trying to port some code which interacts with memory mapped hardwa= re registers.
The original code was developed in 2015-18 on edk2,= and does not want to compile anymore.

The way it = works is there are three 32 bit registers.
The first is a status/= command register which I read to determine if the hardware is ready.
<= div>The next two are used to pass a 64-bit memory address (hi=C2=A0+ lo).
Once the param registers are set, I update the command/status regi= ster and the hardware executes the command returning the results at the add= ress provided by the two param registers.

In the o= riginal code, the address of the buffer is used to fill in the two param re= gisters, and as far as I can tell this worked back then.
When I t= ry to do the same, the address in my pointer is only 32 bits long, a virtua= l address, not a physical address.

Is there a way = I can convert this 32 bit virtual address to a 64-bit physical address in= =C2=A0a uefi shell app, or would I need a driver=C2=A0to do this?
I did something similar in linux for memory mapped IO, I am guessing I jus= t haven't found the right function for this yet.

I would greatly appreciate it if someone could point me in the right dir= ection.

Thank you
xp



=20



--
Pedro Falcato
--000000000000a0378605e15b4a4a--