#include <Library/IoLib.h>
#include "UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.h"
VOID
MmIndexIoWrite (
IN UINT64 Address,
IN UINT64 Value
)
{
UINT64 IndexPort;
UINT64 DataPort;
UINT64 Index;
//Address = iiiiddddrrrr i = indexport d = dataport r = offset
DataPort = (Address / 0x10000 - 0x10000 * (Address / 0x100000000));
IndexPort = (Address / 0x100000000);
Index = (Address - IndexPort * 0x100000000 - DataPort * 0x10000);
//Print (L"%lx %lx %lx\r\n",IndexPort, DataPort, Index);
IoWrite16((UINT16)IndexPort, (UINT16)Index);
IoWrite16((UINT16)DataPort, (UINT8)Value);
}
VOID
MmIndexIoRead (
IN UINT64 Address,
IN UINT64 Value
)
{
UINT8 Num;
//UINT8 Count;
UINT64 IndexPort;
UINT64 DataPort;
UINT64 Index;
UINT8
UEFI应用与编程--IndexIo
最新推荐文章于 2022-10-17 21:29:34 发布
本文档介绍了如何在UEFI环境中进行内存映射I/O(MMIO)的索引端口读写操作。通过示例函数`MmIndexIoWrite`和`MmIndexIoRead`,详细阐述了地址转换和端口操作的过程,以实现对特定硬件寄存器的高效访问。
摘要由CSDN通过智能技术生成