intelmetool: Do small cosmetic changes
Refining some of the code indentations and cosmetics to build upon and import some in-review changes. Change-Id: I0038a146bd899f150518c4832258a42792abaabb Signed-off-by: Maximilian Schander <maxschander@googlemail.com> Reviewed-on: https://review.coreboot.org/22216 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
This commit is contained in:
parent
1812311645
commit
df5b83fe2b
|
@ -63,7 +63,8 @@ static void dumpmemfile(uint8_t *phys, uint32_t size)
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rehide_me() {
|
static void rehide_me(void)
|
||||||
|
{
|
||||||
if (fd2 & 0x2) {
|
if (fd2 & 0x2) {
|
||||||
printf("Re-hiding MEI device...");
|
printf("Re-hiding MEI device...");
|
||||||
fd2 = *(uint32_t *)(rcba + FD2);
|
fd2 = *(uint32_t *)(rcba + FD2);
|
||||||
|
@ -78,7 +79,8 @@ static void rehide_me() {
|
||||||
* Real ME memory is located around top of memory minus 64MB. (I think)
|
* Real ME memory is located around top of memory minus 64MB. (I think)
|
||||||
* so we avoid cloning to this part.
|
* so we avoid cloning to this part.
|
||||||
*/
|
*/
|
||||||
static void dump_me_memory() {
|
static void dump_me_memory(void)
|
||||||
|
{
|
||||||
uintptr_t me_clone = 0x60000000;
|
uintptr_t me_clone = 0x60000000;
|
||||||
uint8_t *dump;
|
uint8_t *dump;
|
||||||
|
|
||||||
|
@ -107,7 +109,8 @@ static void dump_me_memory() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pci_platform_scan() {
|
static int pci_platform_scan(void)
|
||||||
|
{
|
||||||
struct pci_access *pacc;
|
struct pci_access *pacc;
|
||||||
struct pci_dev *dev;
|
struct pci_dev *dev;
|
||||||
char namebuf[1024];
|
char namebuf[1024];
|
||||||
|
@ -125,7 +128,7 @@ static int pci_platform_scan() {
|
||||||
PCI_LOOKUP_DEVICE, dev->vendor_id, dev->device_id);
|
PCI_LOOKUP_DEVICE, dev->vendor_id, dev->device_id);
|
||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
name = "<unknown>";
|
name = "<unknown>";
|
||||||
if (dev->vendor_id == 0x8086) {
|
if (dev->vendor_id == PCI_VENDOR_ID_INTEL) {
|
||||||
if (PCI_DEV_HAS_ME_DISABLE(dev->device_id)) {
|
if (PCI_DEV_HAS_ME_DISABLE(dev->device_id)) {
|
||||||
printf(CGRN "Good news, you have a `%s` so ME is present but can be disabled, continuing...\n\n" RESET, name);
|
printf(CGRN "Good news, you have a `%s` so ME is present but can be disabled, continuing...\n\n" RESET, name);
|
||||||
break;
|
break;
|
||||||
|
@ -145,10 +148,10 @@ static int pci_platform_scan() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dev != NULL &&
|
if (dev != NULL &&
|
||||||
!PCI_DEV_HAS_ME_DISABLE(dev->device_id) &&
|
!PCI_DEV_HAS_ME_DISABLE(dev->device_id) &&
|
||||||
!PCI_DEV_HAS_ME_DIFFICULT(dev->device_id) &&
|
!PCI_DEV_HAS_ME_DIFFICULT(dev->device_id) &&
|
||||||
!PCI_DEV_CAN_DISABLE_ME_IF_PRESENT(dev->device_id) &&
|
!PCI_DEV_CAN_DISABLE_ME_IF_PRESENT(dev->device_id) &&
|
||||||
!PCI_DEV_ME_NOT_SURE(dev->device_id)) {
|
!PCI_DEV_ME_NOT_SURE(dev->device_id)) {
|
||||||
printf(CCYN "ME is not present on your board or unkown\n\n" RESET);
|
printf(CCYN "ME is not present on your board or unkown\n\n" RESET);
|
||||||
pci_cleanup(pacc);
|
pci_cleanup(pacc);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -159,7 +162,9 @@ static int pci_platform_scan() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct pci_dev *pci_me_interface_scan(const char **name, char *namebuf, int namebuf_size) {
|
static struct pci_dev *pci_me_interface_scan(const char **name, char *namebuf,
|
||||||
|
int namebuf_size)
|
||||||
|
{
|
||||||
struct pci_access *pacc;
|
struct pci_access *pacc;
|
||||||
struct pci_dev *dev;
|
struct pci_dev *dev;
|
||||||
int me = 0;
|
int me = 0;
|
||||||
|
@ -174,7 +179,7 @@ static struct pci_dev *pci_me_interface_scan(const char **name, char *namebuf, i
|
||||||
pci_fill_info(dev, PCI_FILL_IDENT | PCI_FILL_BASES | PCI_FILL_SIZES | PCI_FILL_CLASS);
|
pci_fill_info(dev, PCI_FILL_IDENT | PCI_FILL_BASES | PCI_FILL_SIZES | PCI_FILL_CLASS);
|
||||||
*name = pci_lookup_name(pacc, namebuf, namebuf_size,
|
*name = pci_lookup_name(pacc, namebuf, namebuf_size,
|
||||||
PCI_LOOKUP_DEVICE, dev->vendor_id, dev->device_id);
|
PCI_LOOKUP_DEVICE, dev->vendor_id, dev->device_id);
|
||||||
if (dev->vendor_id == 0x8086) {
|
if (dev->vendor_id == PCI_VENDOR_ID_INTEL) {
|
||||||
if (PCI_DEV_HAS_SUPPORTED_ME(dev->device_id)) {
|
if (PCI_DEV_HAS_SUPPORTED_ME(dev->device_id)) {
|
||||||
me = 1;
|
me = 1;
|
||||||
break;
|
break;
|
||||||
|
@ -193,7 +198,8 @@ static struct pci_dev *pci_me_interface_scan(const char **name, char *namebuf, i
|
||||||
return dev;
|
return dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int activate_me() {
|
static int activate_me(void)
|
||||||
|
{
|
||||||
struct pci_access *pacc;
|
struct pci_access *pacc;
|
||||||
struct pci_dev *sb;
|
struct pci_dev *sb;
|
||||||
uint32_t rcba_phys;
|
uint32_t rcba_phys;
|
||||||
|
@ -236,7 +242,8 @@ static int activate_me() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dump_me_info() {
|
static void dump_me_info(void)
|
||||||
|
{
|
||||||
struct pci_dev *dev;
|
struct pci_dev *dev;
|
||||||
uint32_t stat, stat2;
|
uint32_t stat, stat2;
|
||||||
char namebuf[1024];
|
char namebuf[1024];
|
||||||
|
@ -257,6 +264,7 @@ static void dump_me_info() {
|
||||||
|
|
||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
name = "<unknown>";
|
name = "<unknown>";
|
||||||
|
|
||||||
printf("MEI found: [%x:%x] %s\n\n", dev->vendor_id, dev->device_id, name);
|
printf("MEI found: [%x:%x] %s\n\n", dev->vendor_id, dev->device_id, name);
|
||||||
stat = pci_read_long(dev, 0x40);
|
stat = pci_read_long(dev, 0x40);
|
||||||
printf("ME Status : 0x%x\n", stat);
|
printf("ME Status : 0x%x\n", stat);
|
||||||
|
@ -268,7 +276,7 @@ static void dump_me_info() {
|
||||||
intel_me_extend_valid(dev);
|
intel_me_extend_valid(dev);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
if ((stat & 0xf000) >> 12 != 0) {
|
if (stat & 0xf000) {
|
||||||
printf("ME: has a broken implementation on your board with this BIOS\n");
|
printf("ME: has a broken implementation on your board with this BIOS\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -328,8 +336,8 @@ int main(int argc, char *argv[])
|
||||||
};
|
};
|
||||||
|
|
||||||
while ((opt = getopt_long(argc, argv, "vh?sd",
|
while ((opt = getopt_long(argc, argv, "vh?sd",
|
||||||
long_options, &option_index)) != EOF) {
|
long_options, &option_index)) != EOF) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'v':
|
case 'v':
|
||||||
print_version();
|
print_version();
|
||||||
exit(0);
|
exit(0);
|
||||||
|
@ -346,8 +354,8 @@ int main(int argc, char *argv[])
|
||||||
print_usage(argv[0]);
|
print_usage(argv[0]);
|
||||||
exit(0);
|
exit(0);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(__FreeBSD__)
|
#if defined(__FreeBSD__)
|
||||||
if (open("/dev/io", O_RDWR) < 0) {
|
if (open("/dev/io", O_RDWR) < 0) {
|
||||||
|
@ -376,12 +384,12 @@ int main(int argc, char *argv[])
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch(cmd_exec) {
|
switch(cmd_exec) {
|
||||||
case 1:
|
case 1:
|
||||||
dump_me_info();
|
dump_me_info();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
print_usage(argv[0]);
|
print_usage(argv[0]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -50,6 +50,8 @@
|
||||||
|
|
||||||
extern int debug;
|
extern int debug;
|
||||||
|
|
||||||
|
#define PCI_VENDOR_ID_INTEL 0x8086
|
||||||
|
|
||||||
// Definitely has ME and can be disabled
|
// Definitely has ME and can be disabled
|
||||||
#define PCI_DEVICE_ID_INTEL_ICH8ME 0x2811
|
#define PCI_DEVICE_ID_INTEL_ICH8ME 0x2811
|
||||||
#define PCI_DEVICE_ID_INTEL_ICH9ME 0x2917
|
#define PCI_DEVICE_ID_INTEL_ICH9ME 0x2917
|
||||||
|
|
|
@ -53,7 +53,8 @@ static void mei_dump(void *ptr, int dword, int offset, const char *type)
|
||||||
switch (offset) {
|
switch (offset) {
|
||||||
case MEI_H_CSR:
|
case MEI_H_CSR:
|
||||||
case MEI_ME_CSR_HA:
|
case MEI_ME_CSR_HA:
|
||||||
/* csr = ptr;
|
/*
|
||||||
|
csr = ptr;
|
||||||
if (!csr) {
|
if (!csr) {
|
||||||
printf("%-9s[%02x] : ", type, offset);
|
printf("%-9s[%02x] : ", type, offset);
|
||||||
printf("ERROR: 0x%08x\n", dword);
|
printf("ERROR: 0x%08x\n", dword);
|
||||||
|
@ -61,11 +62,13 @@ static void mei_dump(void *ptr, int dword, int offset, const char *type)
|
||||||
}
|
}
|
||||||
printf("%-9s[%02x] : ", type, offset);
|
printf("%-9s[%02x] : ", type, offset);
|
||||||
printf("depth=%u read=%02u write=%02u ready=%u "
|
printf("depth=%u read=%02u write=%02u ready=%u "
|
||||||
"reset=%u intgen=%u intstatus=%u intenable=%u\n", csr->buffer_depth,
|
"reset=%u intgen=%u intstatus=%u intenable=%u\n",
|
||||||
csr->buffer_read_ptr, csr->buffer_write_ptr,
|
csr->buffer_depth, csr->buffer_read_ptr,
|
||||||
csr->ready, csr->reset, csr->interrupt_generate,
|
csr->buffer_write_ptr, csr->ready, csr->reset,
|
||||||
csr->interrupt_status, csr->interrupt_enable);
|
csr->interrupt_generate, csr->interrupt_status,
|
||||||
*/ break;
|
csr->interrupt_enable);
|
||||||
|
*/
|
||||||
|
break;
|
||||||
case MEI_ME_CB_RW:
|
case MEI_ME_CB_RW:
|
||||||
case MEI_H_CB_WW:
|
case MEI_H_CB_WW:
|
||||||
printf("%-9s[%02x] : ", type, offset);
|
printf("%-9s[%02x] : ", type, offset);
|
||||||
|
@ -463,12 +466,10 @@ int mkhi_get_fwcaps(void)
|
||||||
print_cap("Small business technology ", fwcaps.cap.caps_sku.small_business);
|
print_cap("Small business technology ", fwcaps.cap.caps_sku.small_business);
|
||||||
print_cap("Level III manageability ", fwcaps.cap.caps_sku.l3manageability);
|
print_cap("Level III manageability ", fwcaps.cap.caps_sku.l3manageability);
|
||||||
print_cap("IntelR Anti-Theft (AT) ", fwcaps.cap.caps_sku.intel_at);
|
print_cap("IntelR Anti-Theft (AT) ", fwcaps.cap.caps_sku.intel_at);
|
||||||
print_cap("IntelR Capability Licensing Service (CLS) ",
|
print_cap("IntelR Capability Licensing Service (CLS) ", fwcaps.cap.caps_sku.intel_cls);
|
||||||
fwcaps.cap.caps_sku.intel_cls);
|
print_cap("IntelR Power Sharing Technology (MPC) ", fwcaps.cap.caps_sku.intel_mpc);
|
||||||
print_cap("IntelR Power Sharing Technology (MPC) ",
|
|
||||||
fwcaps.cap.caps_sku.intel_mpc);
|
|
||||||
print_cap("ICC Over Clocking ", fwcaps.cap.caps_sku.icc_over_clocking);
|
print_cap("ICC Over Clocking ", fwcaps.cap.caps_sku.icc_over_clocking);
|
||||||
print_cap("Protected Audio Video Path (PAVP) ", fwcaps.cap.caps_sku.pavp);
|
print_cap("Protected Audio Video Path (PAVP) ", fwcaps.cap.caps_sku.pavp);
|
||||||
print_cap("IPV6 ", fwcaps.cap.caps_sku.ipv6);
|
print_cap("IPV6 ", fwcaps.cap.caps_sku.ipv6);
|
||||||
print_cap("KVM Remote Control (KVM) ", fwcaps.cap.caps_sku.kvm);
|
print_cap("KVM Remote Control (KVM) ", fwcaps.cap.caps_sku.kvm);
|
||||||
print_cap("Outbreak Containment Heuristic (OCH) ", fwcaps.cap.caps_sku.och);
|
print_cap("Outbreak Containment Heuristic (OCH) ", fwcaps.cap.caps_sku.och);
|
||||||
|
@ -580,7 +581,8 @@ uint32_t intel_mei_setup(struct pci_dev *dev)
|
||||||
|
|
||||||
mei_base_address = dev->base_addr[0] & ~0xf;
|
mei_base_address = dev->base_addr[0] & ~0xf;
|
||||||
pagerounded = mei_base_address & ~0xfff;
|
pagerounded = mei_base_address & ~0xfff;
|
||||||
mei_mmap = map_physical(pagerounded, 0x2000) + mei_base_address - pagerounded;
|
mei_mmap = map_physical(pagerounded, 0x2000);
|
||||||
|
mei_mmap += mei_base_address - pagerounded;
|
||||||
if (mei_mmap == NULL) {
|
if (mei_mmap == NULL) {
|
||||||
printf("Could not map ME setup memory\n");
|
printf("Could not map ME setup memory\n");
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -142,42 +142,41 @@ void intel_me_status(uint32_t hfs, uint32_t gmes)
|
||||||
{
|
{
|
||||||
/* Check Current States */
|
/* Check Current States */
|
||||||
printf("ME: FW Partition Table : %s\n",
|
printf("ME: FW Partition Table : %s\n",
|
||||||
((hfs & 0x20) >> 5) ? "BAD" : "OK");
|
((hfs & 0x20) >> 5) ? "BAD" : "OK");
|
||||||
printf("ME: Bringup Loader Failure : %s\n",
|
printf("ME: Bringup Loader Failure : %s\n",
|
||||||
((hfs & 0x400) >> 10) ? "YES" : "NO");
|
((hfs & 0x400) >> 10) ? "YES" : "NO");
|
||||||
printf("ME: Firmware Init Complete : %s\n",
|
printf("ME: Firmware Init Complete : %s\n",
|
||||||
((hfs & 0x200) >> 9) ? "YES" : "NO");
|
((hfs & 0x200) >> 9) ? "YES" : "NO");
|
||||||
printf("ME: Manufacturing Mode : %s\n",
|
printf("ME: Manufacturing Mode : %s\n",
|
||||||
((hfs & 0x10) >> 4) ? "YES" : "NO");
|
((hfs & 0x10) >> 4) ? "YES" : "NO");
|
||||||
printf("ME: Boot Options Present : %s\n",
|
printf("ME: Boot Options Present : %s\n",
|
||||||
((hfs & 0x1000000) >> 24) ? "YES" : "NO");
|
((hfs & 0x1000000) >> 24) ? "YES" : "NO");
|
||||||
printf("ME: Update In Progress : %s\n",
|
printf("ME: Update In Progress : %s\n",
|
||||||
((hfs & 0x800) >> 11) ? "YES" : "NO");
|
((hfs & 0x800) >> 11) ? "YES" : "NO");
|
||||||
printf("ME: Current Working State : %s\n",
|
printf("ME: Current Working State : %s\n",
|
||||||
me_cws_values[hfs & 0xf]);
|
me_cws_values[hfs & 0xf]);
|
||||||
printf("ME: Current Operation State : %s\n",
|
printf("ME: Current Operation State : %s\n",
|
||||||
me_opstate_values[(hfs & 0x1c0) >> 6]);
|
me_opstate_values[(hfs & 0x1c0) >> 6]);
|
||||||
printf("ME: Current Operation Mode : %s\n",
|
printf("ME: Current Operation Mode : %s\n",
|
||||||
me_opmode_values[(hfs & 0xf0000) >> 16]);
|
me_opmode_values[(hfs & 0xf0000) >> 16]);
|
||||||
printf("ME: Error Code : %s\n",
|
printf("ME: Error Code : %s\n",
|
||||||
me_error_values[(hfs & 0xf000) >> 12]);
|
me_error_values[(hfs & 0xf000) >> 12]);
|
||||||
printf("ME: Progress Phase : %s\n",
|
printf("ME: Progress Phase : %s\n",
|
||||||
me_progress_values[(gmes & 0xf0000000) >> 28]);
|
me_progress_values[(gmes & 0xf0000000) >> 28]);
|
||||||
printf("ME: Power Management Event : %s\n",
|
printf("ME: Power Management Event : %s\n",
|
||||||
me_pmevent_values[(gmes & 0xf000000) >> 24]);
|
me_pmevent_values[(gmes & 0xf000000) >> 24]);
|
||||||
|
|
||||||
printf("ME: Progress Phase State : ");
|
printf("ME: Progress Phase State : ");
|
||||||
switch ((gmes & 0xf0000000) >> 28) {
|
switch ((gmes & 0xf0000000) >> 28) {
|
||||||
case ME_GMES_PHASE_ROM: /* ROM Phase */
|
case ME_GMES_PHASE_ROM: /* ROM Phase */
|
||||||
printf("%s",
|
printf("%s", me_progress_rom_values[(gmes & 0xff0000) >> 16]);
|
||||||
me_progress_rom_values[(gmes & 0xff0000) >> 16]);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ME_GMES_PHASE_BUP: /* Bringup Phase */
|
case ME_GMES_PHASE_BUP: /* Bringup Phase */
|
||||||
if ((gmes & 0xff0000) >> 16 < ARRAY_SIZE(me_progress_bup_values)
|
if ((gmes & 0xff0000) >> 16 < ARRAY_SIZE(me_progress_bup_values)
|
||||||
&& me_progress_bup_values[(gmes & 0xff0000) >> 16])
|
&& me_progress_bup_values[(gmes & 0xff0000) >> 16])
|
||||||
printf("%s",
|
printf("%s",
|
||||||
me_progress_bup_values[(gmes & 0xff0000) >> 16]);
|
me_progress_bup_values[(gmes & 0xff0000) >> 16]);
|
||||||
else
|
else
|
||||||
printf("0x%02x", (gmes & 0xff0000) >> 16);
|
printf("0x%02x", (gmes & 0xff0000) >> 16);
|
||||||
break;
|
break;
|
||||||
|
@ -186,7 +185,7 @@ void intel_me_status(uint32_t hfs, uint32_t gmes)
|
||||||
if ((gmes & 0xff0000) >> 16 < ARRAY_SIZE(me_progress_policy_values)
|
if ((gmes & 0xff0000) >> 16 < ARRAY_SIZE(me_progress_policy_values)
|
||||||
&& me_progress_policy_values[(gmes & 0xff0000) >> 16])
|
&& me_progress_policy_values[(gmes & 0xff0000) >> 16])
|
||||||
printf("%s",
|
printf("%s",
|
||||||
me_progress_policy_values[(gmes & 0xff0000) >> 16]);
|
me_progress_policy_values[(gmes & 0xff0000) >> 16]);
|
||||||
else
|
else
|
||||||
printf("0x%02x", (gmes & 0xff0000) >> 16);
|
printf("0x%02x", (gmes & 0xff0000) >> 16);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -20,40 +20,43 @@
|
||||||
#ifndef __DARWIN__
|
#ifndef __DARWIN__
|
||||||
int fd_mem;
|
int fd_mem;
|
||||||
|
|
||||||
void *map_physical_exact(off_t phys_addr, void *mapto, size_t len) {
|
void *map_physical_exact(off_t phys_addr, void *mapto, size_t len)
|
||||||
void *virt_addr;
|
{
|
||||||
int err;
|
void *virt_addr;
|
||||||
|
int err;
|
||||||
|
|
||||||
virt_addr = mmap(mapto, len, PROT_WRITE | PROT_READ,
|
virt_addr = mmap(mapto, len, PROT_WRITE | PROT_READ,
|
||||||
MAP_SHARED | MAP_FIXED, fd_mem, phys_addr);
|
MAP_SHARED | MAP_FIXED, fd_mem, phys_addr);
|
||||||
|
|
||||||
if (virt_addr == MAP_FAILED) {
|
if (virt_addr == MAP_FAILED) {
|
||||||
err = errno;
|
err = errno;
|
||||||
printf("Error mapping physical memory 0x%016jd [0x%zx] ERRNO=%d %s\n",
|
printf("Error mapping physical memory 0x%016jd [0x%zx] ERRNO=%d %s\n",
|
||||||
(intmax_t)phys_addr, len, err, strerror(err));
|
(intmax_t)phys_addr, len, err, strerror(err));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return virt_addr;
|
return virt_addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *map_physical(off_t phys_addr, size_t len) {
|
void *map_physical(off_t phys_addr, size_t len)
|
||||||
void *virt_addr;
|
{
|
||||||
int err;
|
void *virt_addr;
|
||||||
|
int err;
|
||||||
|
|
||||||
virt_addr = mmap(NULL, len, PROT_WRITE | PROT_READ, MAP_SHARED, fd_mem, phys_addr);
|
virt_addr = mmap(NULL, len, PROT_WRITE | PROT_READ, MAP_SHARED, fd_mem, phys_addr);
|
||||||
|
|
||||||
if (virt_addr == MAP_FAILED) {
|
if (virt_addr == MAP_FAILED) {
|
||||||
err = errno;
|
err = errno;
|
||||||
printf("Error mapping physical memory 0x%016jd [0x%zx] ERRNO=%d %s\n",
|
printf("Error mapping physical memory 0x%016jd [0x%zx] ERRNO=%d %s\n",
|
||||||
(intmax_t)phys_addr, len, err, strerror(err));
|
(intmax_t)phys_addr, len, err, strerror(err));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return virt_addr;
|
return virt_addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void unmap_physical(void *virt_addr, size_t len) {
|
void unmap_physical(void *virt_addr, size_t len)
|
||||||
munmap(virt_addr, len);
|
{
|
||||||
|
munmap(virt_addr, len);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue