Author: jkim
Date: Thu Apr  9 21:32:40 2015
New Revision: 281335
URL: https://svnweb.freebsd.org/changeset/base/281335

Log:
  Print 64-bit addresses cleary with leading zeros to avoid confusions.
  
  MFC after:    1 week

Modified:
  head/usr.sbin/acpi/acpidump/acpi.c

Modified: head/usr.sbin/acpi/acpidump/acpi.c
==============================================================================
--- head/usr.sbin/acpi/acpidump/acpi.c  Thu Apr  9 21:32:32 2015        
(r281334)
+++ head/usr.sbin/acpi/acpidump/acpi.c  Thu Apr  9 21:32:40 2015        
(r281335)
@@ -168,12 +168,18 @@ acpi_print_gas(ACPI_GENERIC_ADDRESS *gas
 {
        switch(gas->SpaceId) {
        case ACPI_GAS_MEMORY:
-               printf("0x%08lx:%u[%u] (Memory)", (u_long)gas->Address,
-                      gas->BitOffset, gas->BitWidth);
+               if (gas->BitWidth <= 32)
+                       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;
        case ACPI_GAS_IO:
-               printf("0x%02lx:%u[%u] (IO)", (u_long)gas->Address,
-                      gas->BitOffset, gas->BitWidth);
+               printf("0x%02x:%u[%u] (IO)", (u_int)gas->Address,
+                   gas->BitOffset, gas->BitWidth);
                break;
        case ACPI_GAS_PCI:
                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_FIXED:
        default:
-               printf("0x%08lx (?)", (u_long)gas->Address);
+               printf("0x%016jx (?)", (uintmax_t)gas->Address);
                break;
        }
 }
@@ -831,7 +837,7 @@ acpi_handle_dmar_drhd(ACPI_DMAR_HARDWARE
 #undef PRINTFLAG
 
        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);
        if (remaining > 0)
@@ -856,8 +862,8 @@ acpi_handle_dmar_rmrr(ACPI_DMAR_RESERVED
        printf("\tType=RMRR\n");
        printf("\tLength=%d\n", rmrr->Header.Length);
        printf("\tSegment=%d\n", rmrr->Segment);
-       printf("\tBaseAddress=0x%0jx\n", (uintmax_t)rmrr->BaseAddress);
-       printf("\tLimitAddress=0x%0jx\n", (uintmax_t)rmrr->EndAddress);
+       printf("\tBaseAddress=0x%016jx\n", (uintmax_t)rmrr->BaseAddress);
+       printf("\tLimitAddress=0x%016jx\n", (uintmax_t)rmrr->EndAddress);
 
        remaining = rmrr->Header.Length - sizeof(ACPI_DMAR_RESERVED_MEMORY);
        if (remaining > 0)
@@ -912,7 +918,7 @@ acpi_handle_dmar_rhsa(ACPI_DMAR_RHSA *rh
        printf("\n");
        printf("\tType=RHSA\n");
        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);
 }
 
@@ -1074,7 +1080,6 @@ acpi_print_rsdt(ACPI_TABLE_HEADER *rsdp)
        ACPI_TABLE_RSDT *rsdt;
        ACPI_TABLE_XSDT *xsdt;
        int     i, entries;
-       u_long  addr;
 
        rsdt = (ACPI_TABLE_RSDT *)rsdp;
        xsdt = (ACPI_TABLE_XSDT *)rsdp;
@@ -1086,10 +1091,10 @@ acpi_print_rsdt(ACPI_TABLE_HEADER *rsdp)
                if (i > 0)
                        printf(", ");
                if (addr_size == 4)
-                       addr = le32toh(rsdt->TableOffsetEntry[i]);
+                       printf("0x%08x", le32toh(rsdt->TableOffsetEntry[i]));
                else
-                       addr = le64toh(xsdt->TableOffsetEntry[i]);
-               printf("0x%08lx", addr);
+                       printf("0x%016jx",
+                           (uintmax_t)le64toh(xsdt->TableOffsetEntry[i]));
        }
        printf(" }\n");
        printf(END_COMMENT);
@@ -1205,8 +1210,8 @@ acpi_print_fadt(ACPI_TABLE_HEADER *sdp)
                printf(", RESET_VALUE=%#x\n", fadt->ResetValue);
        }
        if (acpi_get_fadt_revision(fadt) > 1) {
-               printf("\tX_FACS=0x%08lx, ", (u_long)fadt->XFacs);
-               printf("X_DSDT=0x%08lx\n", (u_long)fadt->XDsdt);
+               printf("\tX_FACS=0x%016jx, ", (uintmax_t)fadt->XFacs);
+               printf("X_DSDT=0x%016jx\n", (uintmax_t)fadt->XDsdt);
                printf("\tX_PM1a_EVT_BLK=");
                acpi_print_gas(&fadt->XPm1aEventBlock);
                if (fadt->XPm1bEventBlock.Address != 0) {
@@ -1261,10 +1266,9 @@ acpi_print_facs(ACPI_TABLE_FACS *facs)
                printf("S4BIOS");
        printf("\n");
 
-       if (facs->XFirmwareWakingVector != 0) {
-               printf("\tX_Firm_Wake_Vec=%08lx\n",
-                      (u_long)facs->XFirmwareWakingVector);
-       }
+       if (facs->XFirmwareWakingVector != 0)
+               printf("\tX_Firm_Wake_Vec=%016jx\n",
+                   (uintmax_t)facs->XFirmwareWakingVector);
        printf("\tVersion=%u\n", facs->Version);
 
        printf(END_COMMENT);
@@ -1314,8 +1318,8 @@ acpi_print_rsd_ptr(ACPI_TABLE_RSDP *rp)
                printf("\tRSDT=0x%08x, cksum=%u\n", rp->RsdtPhysicalAddress,
                    rp->Checksum);
        } else {
-               printf("\tXSDT=0x%08lx, length=%u, cksum=%u\n",
-                   (u_long)rp->XsdtPhysicalAddress, rp->Length,
+               printf("\tXSDT=0x%016jx, length=%u, cksum=%u\n",
+                   (uintmax_t)rp->XsdtPhysicalAddress, rp->Length,
                    rp->ExtendedChecksum);
        }
        printf(END_COMMENT);
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to