public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* Physical Address of buffer
@ 2022-06-13 19:39 M.T.
  2022-06-13 21:51 ` [edk2-devel] " Pedro Falcato
  0 siblings, 1 reply; 2+ messages in thread
From: M.T. @ 2022-06-13 19:39 UTC (permalink / raw)
  To: devel

[-- Attachment #1: Type: text/plain, Size: 1197 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 1489 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [edk2-devel] Physical Address of buffer
  2022-06-13 19:39 Physical Address of buffer M.T.
@ 2022-06-13 21:51 ` Pedro Falcato
  0 siblings, 0 replies; 2+ messages in thread
From: Pedro Falcato @ 2022-06-13 21:51 UTC (permalink / raw)
  To: edk2-devel-groups-io, xzavierpower

[-- Attachment #1: Type: text/plain, Size: 1487 bytes --]

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. <xzavierpower@gmail.com> 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

[-- Attachment #2: Type: text/html, Size: 2258 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-13 21:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-13 19:39 Physical Address of buffer M.T.
2022-06-13 21:51 ` [edk2-devel] " Pedro Falcato

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox