git: ed4d2671efbd - main - acpidump: Add decoding of the MSDM table

From: Adrian Chadd <adrian_at_FreeBSD.org>
Date: Sat, 19 Sep 2026 21:19:10 UTC
The branch main has been updated by adrian:

URL: https://cgit.FreeBSD.org/src/commit/?id=ed4d2671efbd8fa97c0e027e6945340a02d4725f

commit ed4d2671efbd8fa97c0e027e6945340a02d4725f
Author:     Antranig Vartanian <antranigv@freebsd.am>
AuthorDate: 2026-09-19 19:06:07 +0000
Commit:     Adrian Chadd <adrian@FreeBSD.org>
CommitDate: 2026-09-19 19:07:07 +0000

    acpidump: Add decoding of the MSDM table
    
    Add support for dumping the Microsoft Data Management (MSDM) table,
    which contains the Windows product key embedded in firmware by the OEM.
    
    Reviewed by:    kib
    Differential Revision:  https://reviews.freebsd.org/D59662
---
 usr.sbin/acpi/acpidump/acpi.c     | 25 +++++++++++++++++++++++++
 usr.sbin/acpi/acpidump/acpidump.8 |  5 ++++-
 usr.sbin/acpi/acpidump/acpidump.h | 15 +++++++++++++++
 3 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/usr.sbin/acpi/acpidump/acpi.c b/usr.sbin/acpi/acpidump/acpi.c
index 0b125b5591ba..e3fd91909d42 100644
--- a/usr.sbin/acpi/acpidump/acpi.c
+++ b/usr.sbin/acpi/acpidump/acpi.c
@@ -70,6 +70,7 @@ static void	acpi_handle_madt(ACPI_TABLE_HEADER *sdp);
 static void	acpi_handle_ecdt(ACPI_TABLE_HEADER *sdp);
 static void	acpi_handle_hpet(ACPI_TABLE_HEADER *sdp);
 static void	acpi_handle_mcfg(ACPI_TABLE_HEADER *sdp);
+static void	acpi_handle_msdm(ACPI_TABLE_HEADER *sdp);
 static void	acpi_handle_slit(ACPI_TABLE_HEADER *sdp);
 static void	acpi_handle_wddt(ACPI_TABLE_HEADER *sdp);
 static void	acpi_handle_lpit(ACPI_TABLE_HEADER *sdp);
@@ -1121,6 +1122,29 @@ acpi_handle_mcfg(ACPI_TABLE_HEADER *sdp)
 	printf(END_COMMENT);
 }
 
+static void
+acpi_handle_msdm(ACPI_TABLE_HEADER *sdp)
+{
+	struct msdm_body *msdm;
+
+	printf(BEGIN_COMMENT);
+	acpi_print_sdt(sdp);
+	msdm = (struct msdm_body *)((char *)sdp + sizeof(ACPI_TABLE_HEADER));
+	if (sdp->Length < sizeof(ACPI_TABLE_HEADER) +
+	    offsetof(struct msdm_body, data) + msdm->data_length) {
+		warnx("MSDM table is corrupt");
+		printf(END_COMMENT);
+		return;
+	}
+	printf("\tVersion=%u\n", msdm->version);
+	printf("\tDataType=%u\n", msdm->data_type);
+	printf("\tDataLength=%u\n", msdm->data_length);
+	printf("\tData=");
+	acpi_print_string((char *)msdm->data, msdm->data_length);
+	printf("\n");
+	printf(END_COMMENT);
+}
+
 static void
 acpi_handle_slit(ACPI_TABLE_HEADER *sdp)
 {
@@ -2747,6 +2771,7 @@ static const struct {
 	{ ACPI_SIG_LPIT,	acpi_handle_lpit },
 	{ ACPI_SIG_MADT,	acpi_handle_madt },
 	{ ACPI_SIG_MCFG,	acpi_handle_mcfg },
+	{ ACPI_SIG_MSDM,	acpi_handle_msdm },
 	{ ACPI_SIG_NFIT,	acpi_handle_nfit },
 	{ ACPI_SIG_SLIT,	acpi_handle_slit },
 	{ ACPI_SIG_SPCR,	acpi_handle_spcr },
diff --git a/usr.sbin/acpi/acpidump/acpidump.8 b/usr.sbin/acpi/acpidump/acpidump.8
index ec43f36f0895..1d50a57be622 100644
--- a/usr.sbin/acpi/acpidump/acpidump.8
+++ b/usr.sbin/acpi/acpidump/acpidump.8
@@ -27,7 +27,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd October 5, 2024
+.Dd August 2, 2026
 .Dt ACPIDUMP 8
 .Os
 .Sh NAME
@@ -134,6 +134,9 @@ Intel Streamlined Advanced Programmable Interrupt Controller present
 in the system.
 .It MCFG PCI Express Memory-mapped Configuration
 PCI config space base address register.
+.It MSDM Microsoft Data Management Table
+Contains the Microsoft software licensing data, including the
+product key embedded in firmware by the OEM.
 .It NFIT NVDIMM Firmware Interface Table
 NVDIMM information in the system.
 .It RSD PTR
diff --git a/usr.sbin/acpi/acpidump/acpidump.h b/usr.sbin/acpi/acpidump/acpidump.h
index 8755a96dd8af..e271a318fc3f 100644
--- a/usr.sbin/acpi/acpidump/acpidump.h
+++ b/usr.sbin/acpi/acpidump/acpidump.h
@@ -130,6 +130,21 @@ enum TCPApcclient_ids {
 	PCCLIENT_ID_MAX,
 };
 
+/* MSDM */
+/*
+ * ACPICA's ACPI_TABLE_MSDM only defines the common ACPI header; the
+ * body below is the Microsoft-proprietary layout per "Microsoft
+ * Software Licensing Tables (SLIC and MSDM)", November 29, 2011.
+ */
+struct msdm_body {
+	uint32_t	version;
+	uint32_t	reserved;
+	uint32_t	data_type;
+	uint32_t	data_reserved;
+	uint32_t	data_length;
+	uint8_t		data[];
+} __packed;
+
 /*
  * Load the DSDT from a previous save file.  Note that other tables are
  * not saved (i.e. FADT)