Print 64-bit addresses cleary with leading zeros to avoid confusions.

MFC after:	1 week
This commit is contained in:
Jung-uk Kim 2015-04-09 21:32:40 +00:00
parent f5746f593c
commit 7d369c6e2f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=281335

View File

@ -168,12 +168,18 @@ acpi_print_gas(ACPI_GENERIC_ADDRESS *gas)
{ {
switch(gas->SpaceId) { switch(gas->SpaceId) {
case ACPI_GAS_MEMORY: case ACPI_GAS_MEMORY:
printf("0x%08lx:%u[%u] (Memory)", (u_long)gas->Address, if (gas->BitWidth <= 32)
gas->BitOffset, gas->BitWidth); printf("0x%08x:%u[%u] (Memory)",
(u_int)gas->Address, gas->BitOffset,
gas->BitWidth);
else
printf("0x%016jx:%u[%u] (Memory)",
(uintmax_t)gas->Address, gas->BitOffset,
gas->BitWidth);
break; break;
case ACPI_GAS_IO: case ACPI_GAS_IO:
printf("0x%02lx:%u[%u] (IO)", (u_long)gas->Address, printf("0x%02x:%u[%u] (IO)", (u_int)gas->Address,
gas->BitOffset, gas->BitWidth); gas->BitOffset, gas->BitWidth);
break; break;
case ACPI_GAS_PCI: case ACPI_GAS_PCI:
printf("%x:%x+0x%x (PCI)", (uint16_t)(gas->Address >> 32), printf("%x:%x+0x%x (PCI)", (uint16_t)(gas->Address >> 32),
@ -194,7 +200,7 @@ acpi_print_gas(ACPI_GENERIC_ADDRESS *gas)
case ACPI_GAS_DATATABLE: case ACPI_GAS_DATATABLE:
case ACPI_GAS_FIXED: case ACPI_GAS_FIXED:
default: default:
printf("0x%08lx (?)", (u_long)gas->Address); printf("0x%016jx (?)", (uintmax_t)gas->Address);
break; break;
} }
} }
@ -831,7 +837,7 @@ acpi_handle_dmar_drhd(ACPI_DMAR_HARDWARE_UNIT *drhd)
#undef PRINTFLAG #undef PRINTFLAG
printf("\tSegment=%d\n", drhd->Segment); printf("\tSegment=%d\n", drhd->Segment);
printf("\tAddress=0x%0jx\n", (uintmax_t)drhd->Address); printf("\tAddress=0x%016jx\n", (uintmax_t)drhd->Address);
remaining = drhd->Header.Length - sizeof(ACPI_DMAR_HARDWARE_UNIT); remaining = drhd->Header.Length - sizeof(ACPI_DMAR_HARDWARE_UNIT);
if (remaining > 0) if (remaining > 0)
@ -856,8 +862,8 @@ acpi_handle_dmar_rmrr(ACPI_DMAR_RESERVED_MEMORY *rmrr)
printf("\tType=RMRR\n"); printf("\tType=RMRR\n");
printf("\tLength=%d\n", rmrr->Header.Length); printf("\tLength=%d\n", rmrr->Header.Length);
printf("\tSegment=%d\n", rmrr->Segment); printf("\tSegment=%d\n", rmrr->Segment);
printf("\tBaseAddress=0x%0jx\n", (uintmax_t)rmrr->BaseAddress); printf("\tBaseAddress=0x%016jx\n", (uintmax_t)rmrr->BaseAddress);
printf("\tLimitAddress=0x%0jx\n", (uintmax_t)rmrr->EndAddress); printf("\tLimitAddress=0x%016jx\n", (uintmax_t)rmrr->EndAddress);
remaining = rmrr->Header.Length - sizeof(ACPI_DMAR_RESERVED_MEMORY); remaining = rmrr->Header.Length - sizeof(ACPI_DMAR_RESERVED_MEMORY);
if (remaining > 0) if (remaining > 0)
@ -912,7 +918,7 @@ acpi_handle_dmar_rhsa(ACPI_DMAR_RHSA *rhsa)
printf("\n"); printf("\n");
printf("\tType=RHSA\n"); printf("\tType=RHSA\n");
printf("\tLength=%d\n", rhsa->Header.Length); printf("\tLength=%d\n", rhsa->Header.Length);
printf("\tBaseAddress=0x%0jx\n", (uintmax_t)rhsa->BaseAddress); printf("\tBaseAddress=0x%016jx\n", (uintmax_t)rhsa->BaseAddress);
printf("\tProximityDomain=0x%08x\n", rhsa->ProximityDomain); printf("\tProximityDomain=0x%08x\n", rhsa->ProximityDomain);
} }
@ -1074,7 +1080,6 @@ acpi_print_rsdt(ACPI_TABLE_HEADER *rsdp)
ACPI_TABLE_RSDT *rsdt; ACPI_TABLE_RSDT *rsdt;
ACPI_TABLE_XSDT *xsdt; ACPI_TABLE_XSDT *xsdt;
int i, entries; int i, entries;
u_long addr;
rsdt = (ACPI_TABLE_RSDT *)rsdp; rsdt = (ACPI_TABLE_RSDT *)rsdp;
xsdt = (ACPI_TABLE_XSDT *)rsdp; xsdt = (ACPI_TABLE_XSDT *)rsdp;
@ -1086,10 +1091,10 @@ acpi_print_rsdt(ACPI_TABLE_HEADER *rsdp)
if (i > 0) if (i > 0)
printf(", "); printf(", ");
if (addr_size == 4) if (addr_size == 4)
addr = le32toh(rsdt->TableOffsetEntry[i]); printf("0x%08x", le32toh(rsdt->TableOffsetEntry[i]));
else else
addr = le64toh(xsdt->TableOffsetEntry[i]); printf("0x%016jx",
printf("0x%08lx", addr); (uintmax_t)le64toh(xsdt->TableOffsetEntry[i]));
} }
printf(" }\n"); printf(" }\n");
printf(END_COMMENT); printf(END_COMMENT);
@ -1205,8 +1210,8 @@ acpi_print_fadt(ACPI_TABLE_HEADER *sdp)
printf(", RESET_VALUE=%#x\n", fadt->ResetValue); printf(", RESET_VALUE=%#x\n", fadt->ResetValue);
} }
if (acpi_get_fadt_revision(fadt) > 1) { if (acpi_get_fadt_revision(fadt) > 1) {
printf("\tX_FACS=0x%08lx, ", (u_long)fadt->XFacs); printf("\tX_FACS=0x%016jx, ", (uintmax_t)fadt->XFacs);
printf("X_DSDT=0x%08lx\n", (u_long)fadt->XDsdt); printf("X_DSDT=0x%016jx\n", (uintmax_t)fadt->XDsdt);
printf("\tX_PM1a_EVT_BLK="); printf("\tX_PM1a_EVT_BLK=");
acpi_print_gas(&fadt->XPm1aEventBlock); acpi_print_gas(&fadt->XPm1aEventBlock);
if (fadt->XPm1bEventBlock.Address != 0) { if (fadt->XPm1bEventBlock.Address != 0) {
@ -1261,10 +1266,9 @@ acpi_print_facs(ACPI_TABLE_FACS *facs)
printf("S4BIOS"); printf("S4BIOS");
printf("\n"); printf("\n");
if (facs->XFirmwareWakingVector != 0) { if (facs->XFirmwareWakingVector != 0)
printf("\tX_Firm_Wake_Vec=%08lx\n", printf("\tX_Firm_Wake_Vec=%016jx\n",
(u_long)facs->XFirmwareWakingVector); (uintmax_t)facs->XFirmwareWakingVector);
}
printf("\tVersion=%u\n", facs->Version); printf("\tVersion=%u\n", facs->Version);
printf(END_COMMENT); printf(END_COMMENT);
@ -1314,8 +1318,8 @@ acpi_print_rsd_ptr(ACPI_TABLE_RSDP *rp)
printf("\tRSDT=0x%08x, cksum=%u\n", rp->RsdtPhysicalAddress, printf("\tRSDT=0x%08x, cksum=%u\n", rp->RsdtPhysicalAddress,
rp->Checksum); rp->Checksum);
} else { } else {
printf("\tXSDT=0x%08lx, length=%u, cksum=%u\n", printf("\tXSDT=0x%016jx, length=%u, cksum=%u\n",
(u_long)rp->XsdtPhysicalAddress, rp->Length, (uintmax_t)rp->XsdtPhysicalAddress, rp->Length,
rp->ExtendedChecksum); rp->ExtendedChecksum);
} }
printf(END_COMMENT); printf(END_COMMENT);