From nobody Fri Oct 11 18:06:59 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XQF2C3WQvz5ZCjC; Fri, 11 Oct 2024 18:06:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XQF2C2GN9z41Vf; Fri, 11 Oct 2024 18:06:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728670019; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=x9MchnS2u3fu85zvN2CIepWU8QtXBvZcA+YKhI5KG+4=; b=m7VFd5Qy7D8IEeuzHbrbNCxM0C3K/n3HGLlIvwc+0mG13XLWnDjxZPwHLIfzzLCSLfcCX9 N7AoK2ZD3g2nQrh4jWZ5SSf2DtOK0L0Oa0XK+mVRmhGdsl5NhI/48tzIw9m/CvYYYQLXLy KskBJxF+62YZC2RXH/rBpuga3cECtkXwoeadM92PYuEFnUHi9WNqvfMkABWHbjfJhxtqKc 2xRdHPyQhzgZJWEoZ0T3PgOKP7fB5uAg4YmLWGRZmPTj7UFIB/IAu61h73a94ChwCXA2E6 syWk12WtQ1HmZSjcvLpVOI2G5rLga0a1VNEfVGFrC+aYOzm5s0qqwCSNzZw++w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728670019; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=x9MchnS2u3fu85zvN2CIepWU8QtXBvZcA+YKhI5KG+4=; b=i5rFmTFrtPdcwbBT1ZAegzZj5Mb8ZAF+17deyvRxlVpgC9Kawz3zDsrtTAEp/4kV7cIy/m VpCzx4d2cxeCNsCGOBpSmoOf9bgL7n7KQc2zyT7exXKu5x7cyFl9EcjJNCdNMGW6K0H3dR olozyd09BGdeKgUfrkH08Unx+V603hF0L7NAvnWfcgUoOOCSdsfiev2bJDRkEjBsxEf4rh Hvvvbjj9175RDcwMWrbfvdBlNqcwWNbWQdHWoQclBbkvuBoDRVg1EyYvsvnROnU3R1RMmP ZpPQ2nCQZxXb+EP5ubHbkivzjjGxTrwKHJup6wMDYmQnJLyYDPq6915bXMhNTw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1728670019; a=rsa-sha256; cv=none; b=JIPhAIS29c5puzs1MpL/F+5k0VFByzpLF68Ox5Z/aPGbYWfvdaGnvUjdt0sdAbYVGwS46i 9JAEUorvh5JXnmfjWTZOAimBj4ZO1o2aGqwY1HOec4UNH4zIcFa9IT9xUqRjh3QJUUXJSp PPyGd5tgnnLuP287/1oa8wjsFELwLejTPRiushjte8M8OuRC5F5QiwoOQl0BXYd5KztZ7C ppXtXAGgYGfzEAKD1baIpuNhAVBBNy6bDtJ3YIgP0Z6vSlrxelauQJdKSizBbRU9Aq6DRi Ipi0/eTRaF9atUO1N6cBr5XAsI+2WNxnOkuknpyFACXQlRIG1cZbDdvaBWdaig== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XQF2C1tlgzrwd; Fri, 11 Oct 2024 18:06:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49BI6xUI011744; Fri, 11 Oct 2024 18:06:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49BI6xUj011741; Fri, 11 Oct 2024 18:06:59 GMT (envelope-from git) Date: Fri, 11 Oct 2024 18:06:59 GMT Message-Id: <202410111806.49BI6xUj011741@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: ca9e31eead41 - main - Revert "apcidump: Add dumping SPCR" List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ca9e31eead41ff1b5d2fcf8989ab527c89485a90 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=ca9e31eead41ff1b5d2fcf8989ab527c89485a90 commit ca9e31eead41ff1b5d2fcf8989ab527c89485a90 Author: Warner Losh AuthorDate: 2024-10-11 17:52:59 +0000 Commit: Warner Losh CommitDate: 2024-10-11 18:06:33 +0000 Revert "apcidump: Add dumping SPCR" This reverts commit 593d7a1634b5: In preparation for importing new SPCR definitions, back out my hack since it conflicts with the new definitions. Sponsored by: Netflix --- usr.sbin/acpi/acpidump/acpi.c | 170 +------------------------------------- usr.sbin/acpi/acpidump/acpidump.8 | 1 - 2 files changed, 3 insertions(+), 168 deletions(-) diff --git a/usr.sbin/acpi/acpidump/acpi.c b/usr.sbin/acpi/acpidump/acpi.c index 95ecb42825eb..fe68b5062351 100644 --- a/usr.sbin/acpi/acpidump/acpi.c +++ b/usr.sbin/acpi/acpidump/acpi.c @@ -1257,180 +1257,18 @@ acpi_handle_tcpa(ACPI_TABLE_HEADER *sdp) printf(END_COMMENT); } - static void acpi_handle_tpm2(ACPI_TABLE_HEADER *sdp) { ACPI_TABLE_TPM2 *tpm2; - + printf (BEGIN_COMMENT); acpi_print_sdt(sdp); tpm2 = (ACPI_TABLE_TPM2 *) sdp; printf ("\t\tControlArea=%jx\n", tpm2->ControlAddress); - printf ("\t\tStartMethod=%x\n", tpm2->StartMethod); - printf (END_COMMENT); -} - -static int spcr_xlate_baud(uint8_t r) -{ - static int rates[] = { 9600, 19200, -1, 57600, 115200 }; - _Static_assert(nitems(rates) == 7 - 3 + 1, "rates array size incorrect"); - - if (r == 0) - return (0); - - if (r < 3 || r > 7) - return (-1); - - return (rates[r - 3]); -} - -static const char *spcr_interface_type(int ift) -{ - static const char *if_names[] = { - [0x00] = "Fully 16550-compatible", - [0x01] = "16550 subset compatible with DBGP Revision 1", - [0x02] = "MAX311xE SPI UART", - [0x03] = "Arm PL011 UART", - [0x04] = "MSM8x60 (e.g. 8960)", - [0x05] = "Nvidia 16550", - [0x06] = "TI OMAP", - [0x07] = "Reserved (Do Not Use)", - [0x08] = "APM88xxxx", - [0x09] = "MSM8974", - [0x0a] = "SAM5250", - [0x0b] = "Intel USIF", - [0x0c] = "i.MX 6", - [0x0d] = "(deprecated) Arm SBSA (2.x only) Generic UART supporting only 32-bit accesses", - [0x0e] = "Arm SBSA Generic UART", - [0x0f] = "Arm DCC", - [0x10] = "BCM2835", - [0x11] = "SDM845 with clock rate of 1.8432 MHz", - [0x12] = "16550-compatible with parameters defined in Generic Address Structure", - [0x13] = "SDM845 with clock rate of 7.372 MHz", - [0x14] = "Intel LPSS", - [0x15] = "RISC-V SBI console (any supported SBI mechanism)", - }; - - if (ift >= (int)nitems(if_names) || if_names[ift] == NULL) - return ("Reserved"); - return (if_names[ift]); -} - -static const char *spcr_interrupt_type(int ift) -{ - static char buf[100]; - -#define APPEND(b,s) \ - if ((ift & (b)) != 0) { \ - if (strlen(buf) > 0) \ - strlcat(buf, ",", sizeof(buf)); \ - strlcat(buf, s, sizeof(buf)); \ - } - - *buf = '\0'; - APPEND(0x01, "PC/AT IRQ"); - APPEND(0x02, "I/O APIC"); - APPEND(0x04, "I/O SAPIC"); - APPEND(0x08, "ARMH GIC"); - APPEND(0x10, "RISC-V PLIC/APLIC"); - -#undef APPEND - - return (buf); -} - -static const char *spcr_terminal_type(int type) -{ - static const char *term_names[] = { - [0] = "VT100", - [1] = "Extended VT100", - [2] = "VT-UTF8", - [3] = "ANSI", - }; - - if (type >= (int)nitems(term_names) || term_names[type] == NULL) - return ("Reserved"); - return (term_names[type]); -} - -/* - * Serial Port Console Redirection version 3 and 4 are too new to have proper - * definitions in ACPI headers, so provide them. - */ -#pragma pack(1) -struct SPCR_3 -{ - ACPI_TABLE_SPCR spcr2; - UINT32 UARTClockFrequency; -}; - -struct SPCR_4 -{ - struct SPCR_3 spcr3; - UINT32 PreciseBaudRate; - UINT16 NamespaceStringLength; - UINT16 NamespaceStringOffset; -}; -#pragma pack() - -static void acpi_handle_spcr(ACPI_TABLE_HEADER *sdp) -{ - ACPI_TABLE_SPCR *spcr; - - printf (BEGIN_COMMENT); - acpi_print_sdt(sdp); - - /* Rev 1 and 2 are the same size */ - spcr = (ACPI_TABLE_SPCR *) sdp; - printf ("\tInterfaceType=%d (%s)\n", spcr->InterfaceType, - spcr_interface_type(spcr->InterfaceType)); - printf ("\tSerialPort="); - acpi_print_gas(&spcr->SerialPort); - printf ("\n\tInterruptType=%#x (%s)\n", spcr->InterruptType, - spcr_interrupt_type(spcr->InterruptType)); - printf ("\tPcInterrupt=%d (%s)\n", spcr->PcInterrupt, - (spcr->InterruptType & 0x1) ? "Valid" : "Invalid"); - printf ("\tInterrupt=%d\n", spcr->Interrupt); - printf ("\tBaudRate=%d (%d)\n", spcr_xlate_baud(spcr->BaudRate), spcr->BaudRate); - printf ("\tParity=%d\n", spcr->Parity); - printf ("\tStopBits=%d\n", spcr->StopBits); - printf ("\tFlowControl=%d\n", spcr->FlowControl); - printf ("\tTerminalType=%d (%s)\n", spcr->TerminalType, - spcr_terminal_type(spcr->TerminalType)); - printf ("\tPciDeviceId=%#04x\n", spcr->PciDeviceId); - printf ("\tPciVendorId=%#04x\n", spcr->PciVendorId); - printf ("\tPciBus=%d\n", spcr->PciBus); - printf ("\tPciDevice=%d\n", spcr->PciDevice); - printf ("\tPciFunction=%d\n", spcr->PciFunction); - printf ("\tPciFlags=%d\n", spcr->PciFlags); - printf ("\tPciSegment=%d\n", spcr->PciSegment); - - /* Rev 3 added UARTClockFrequency */ - if (sdp->Revision >= 3) { - struct SPCR_3 *spcr3 = (struct SPCR_3 *)sdp; - - printf("\tUARTClockFrequency=%jd", - (uintmax_t)spcr3->UARTClockFrequency); - } - - /* Rev 4 added PreciseBaudRate and Namespace* */ - if (sdp->Revision >= 4) { - struct SPCR_4 *spcr4 = (struct SPCR_4 *)sdp; - - printf("\tPreciseBaudRate=%jd", - (uintmax_t)spcr4->PreciseBaudRate); - if (spcr4->NamespaceStringLength > 0 && - spcr4->NamespaceStringOffset >= sizeof(*spcr4) && - sdp->Length >= spcr4->NamespaceStringOffset + - spcr4->NamespaceStringLength) { - printf ("\tNamespaceString='%s'\n", - (char *)sdp + spcr4->NamespaceStringOffset); - } - } - + printf ("\t\tStartMethod=%x\n", tpm2->StartMethod); printf (END_COMMENT); } - + static const char * devscope_type2str(int type) { @@ -2630,8 +2468,6 @@ acpi_handle_rsdt(ACPI_TABLE_HEADER *rsdp) acpi_handle_lpit(sdp); else if (!memcmp(sdp->Signature, ACPI_SIG_TPM2, 4)) acpi_handle_tpm2(sdp); - else if (!memcmp(sdp->Signature, ACPI_SIG_SPCR, 4)) - acpi_handle_spcr(sdp); else { printf(BEGIN_COMMENT); acpi_print_sdt(sdp); diff --git a/usr.sbin/acpi/acpidump/acpidump.8 b/usr.sbin/acpi/acpidump/acpidump.8 index 9703741f418f..f193b9a3511a 100644 --- a/usr.sbin/acpi/acpidump/acpidump.8 +++ b/usr.sbin/acpi/acpidump/acpidump.8 @@ -112,7 +112,6 @@ utility dumps contents of the following tables: .It RSD PTR .It RSDT .It SLIT -.It SPCR Serial Port Console Redirection .It SRAT .It TCPA .It TPM2