1*99a2dd95SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause 2*99a2dd95SBruce Richardson * Copyright (c) 2020 Dmitry Kozlyuk 3*99a2dd95SBruce Richardson */ 4*99a2dd95SBruce Richardson 5*99a2dd95SBruce Richardson /** 6*99a2dd95SBruce Richardson * @file virt2phys driver interface 7*99a2dd95SBruce Richardson */ 8*99a2dd95SBruce Richardson 9*99a2dd95SBruce Richardson /** 10*99a2dd95SBruce Richardson * Driver device interface GUID {539c2135-793a-4926-afec-d3a1b61bbc8a}. 11*99a2dd95SBruce Richardson */ 12*99a2dd95SBruce Richardson DEFINE_GUID(GUID_DEVINTERFACE_VIRT2PHYS, 13*99a2dd95SBruce Richardson 0x539c2135, 0x793a, 0x4926, 14*99a2dd95SBruce Richardson 0xaf, 0xec, 0xd3, 0xa1, 0xb6, 0x1b, 0xbc, 0x8a); 15*99a2dd95SBruce Richardson 16*99a2dd95SBruce Richardson /** 17*99a2dd95SBruce Richardson * Driver device type for IO control codes. 18*99a2dd95SBruce Richardson */ 19*99a2dd95SBruce Richardson #define VIRT2PHYS_DEVTYPE 0x8000 20*99a2dd95SBruce Richardson 21*99a2dd95SBruce Richardson /** 22*99a2dd95SBruce Richardson * Translate a valid non-paged virtual address to a physical address. 23*99a2dd95SBruce Richardson * 24*99a2dd95SBruce Richardson * Note: A physical address zero (0) is reported if input address 25*99a2dd95SBruce Richardson * is paged out or not mapped. However, if input is a valid mapping 26*99a2dd95SBruce Richardson * of I/O port 0x0000, output is also zero. There is no way 27*99a2dd95SBruce Richardson * to distinguish between these cases by return value only. 28*99a2dd95SBruce Richardson * 29*99a2dd95SBruce Richardson * Input: a non-paged virtual address (PVOID). 30*99a2dd95SBruce Richardson * 31*99a2dd95SBruce Richardson * Output: the corresponding physical address (LARGE_INTEGER). 32*99a2dd95SBruce Richardson */ 33*99a2dd95SBruce Richardson #define IOCTL_VIRT2PHYS_TRANSLATE CTL_CODE( \ 34*99a2dd95SBruce Richardson VIRT2PHYS_DEVTYPE, 0x800, METHOD_BUFFERED, FILE_ANY_ACCESS) 35