From nobody Mon Mar 18 16:37:56 2024 X-Original-To: dev-commits-src-main@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 4Tz0s05Lrrz5F3WG; Mon, 18 Mar 2024 16:37:56 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Tz0s03VW7z4lFw; Mon, 18 Mar 2024 16:37:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1710779876; 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=KY4hjZsxQ7Pmpz7Pppyv7npDgHbvUYLh6m3D1sbt0xU=; b=v7uXBNKkW3ZwfV1XUU4TJk0SKD0CL83JxBlnhth7S4KcosSBcVTNm2FNaoZVaJTSQ13L4q hMKnMRjgELeg3whcnMzWyDIbc7nS771vj8xdTo9F8MAS2A9WA0wOnDMcoZJEmUDZo6CUYd pdqms6fRFHiuhSCOPJpPGrBV5OFEpqC5tiuPUepyRd3mU6qHbBbO4n1iMYIo8MRHqUaCYH 9TFjjQMHakiPwv0GNIjVFxDITPoKMPZ06KJCRzfF+gh8G1x6sAQMX+0a2dNR3CNtn2Akpt s9lHTOOImteZrmuo9hpzC5DYY0N0OxgZE1iKSltXPtiw32bi6giUltyxTPbSKg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1710779876; a=rsa-sha256; cv=none; b=EEd2BuX3MPkJWvIluOIxcXhUVu4XUCu5uNWgzhYgoeinWpV7NujIsp5dMSTiXBUPmJksuu IFNgRcUDe9MPjHSG3lW+Hf749NchGKUitZDvtf08WR54rmhP1PvR8bxoYxE2zaRYuqwCZV XBLymC0TFGqjYSOdO92YRbg+GTiBeCH2V4r2+i3swFKy4/f4CE+WFHh9mpvrMk9OadXdmG UEh1z2pW/5zWPM9ily19uYGYJ2kOZS+UR8O0Tj9OSFh3PYrev8hcX9XzFTsHnPt7dfrJ1S 4M2pKfofJoG09eSKlMD6Z7fn/Iz2+bu1eoX1v9sLiiecZWEice5g7xTEL1IP+w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1710779876; 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=KY4hjZsxQ7Pmpz7Pppyv7npDgHbvUYLh6m3D1sbt0xU=; b=fKFwXlW9h/L5UU2kqYvbid93BG8eh/EYvgSw7ItNRgfV+Y5VDRm0EAHPHMYSauHttSxp4B 3smAywwCBkbWr26jfK/QNDbuTK9wZHW1ndLsno5nhK5M6+nyOFFqWIMqS7dtZUiaghXdLk MJ+5QUuU9T2J+On+nxOSL1NjxNhLSOXXZZ7UU3iCFT/sEo5hY/AJZACpjMWNiZXu5f6Jzq uwaLTo2PB7BBA2t9YdRXDdRrLZJN2JgrVQSPwlnw32NRFnh+r091+Oa82Mn9yrisBON6hh tpLl8p6nbYdoGt7sbPW46iQ47UxUZAcqXLO23piu9az3nSVLeECQzr0dQvbszQ== 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 4Tz0s031StzWPq; Mon, 18 Mar 2024 16:37:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 42IGbuH0071085; Mon, 18 Mar 2024 16:37:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 42IGbuUo071082; Mon, 18 Mar 2024 16:37:56 GMT (envelope-from git) Date: Mon, 18 Mar 2024 16:37:56 GMT Message-Id: <202403181637.42IGbuUo071082@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: a931b85a0966 - main - uart: Add uart_cpu_acpi_setup to setup the uart List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a931b85a0966a6efd6b6105b3e4176d2c98340de Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=a931b85a0966a6efd6b6105b3e4176d2c98340de commit a931b85a0966a6efd6b6105b3e4176d2c98340de Author: Andrew Turner AuthorDate: 2024-03-14 16:43:28 +0000 Commit: Andrew Turner CommitDate: 2024-03-18 16:20:52 +0000 uart: Add uart_cpu_acpi_setup to setup the uart In preperation for adding debug port support add a generic function to setup the uart from ACPI tables. Reviewed by: imp Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D44358 --- sys/dev/uart/uart_cpu_acpi.c | 16 +++++++++++----- sys/dev/uart/uart_cpu_acpi.h | 4 ++-- sys/dev/uart/uart_cpu_arm64.c | 2 +- sys/dev/uart/uart_cpu_x86.c | 2 +- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/sys/dev/uart/uart_cpu_acpi.c b/sys/dev/uart/uart_cpu_acpi.c index 09f69e951e81..9c9ffc1e3194 100644 --- a/sys/dev/uart/uart_cpu_acpi.c +++ b/sys/dev/uart/uart_cpu_acpi.c @@ -138,7 +138,7 @@ uart_cpu_acpi_init_devinfo(struct uart_devinfo *di, struct uart_class *class, return (0); } -int +static int uart_cpu_acpi_spcr(int devtype, struct uart_devinfo *di) { vm_paddr_t spcr_physaddr; @@ -147,10 +147,6 @@ uart_cpu_acpi_spcr(int devtype, struct uart_devinfo *di) struct uart_class *class; int error = ENXIO; - /* SPCR only tells us about consoles. */ - if (devtype != UART_DEV_CONSOLE) - return (error); - /* Look for the SPCR table. */ spcr_physaddr = acpi_find_table(ACPI_SIG_SPCR); if (spcr_physaddr == 0) @@ -213,3 +209,13 @@ out: acpi_unmap_table(spcr); return (error); } + +int +uart_cpu_acpi_setup(int devtype, struct uart_devinfo *di) +{ + switch(devtype) { + case UART_DEV_CONSOLE: + return (uart_cpu_acpi_spcr(devtype, di)); + } + return (ENXIO); +} diff --git a/sys/dev/uart/uart_cpu_acpi.h b/sys/dev/uart/uart_cpu_acpi.h index 816644eb08ba..94329e1f1349 100644 --- a/sys/dev/uart/uart_cpu_acpi.h +++ b/sys/dev/uart/uart_cpu_acpi.h @@ -64,7 +64,7 @@ SET_DECLARE(uart_acpi_class_set, struct acpi_uart_compat_data); #define UART_ACPI_CLASS(data) \ DATA_SET(uart_acpi_class_set, data) -/* Try to initialize UART device from SPCR data. */ -int uart_cpu_acpi_spcr(int devtype, struct uart_devinfo *di); +/* Try to initialize UART device from ACPI tables */ +int uart_cpu_acpi_setup(int devtype, struct uart_devinfo *di); #endif /* _DEV_UART_CPU_ACPI_H_ */ diff --git a/sys/dev/uart/uart_cpu_arm64.c b/sys/dev/uart/uart_cpu_arm64.c index 51b195783636..80e67e65697c 100644 --- a/sys/dev/uart/uart_cpu_arm64.c +++ b/sys/dev/uart/uart_cpu_arm64.c @@ -125,7 +125,7 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di) #ifdef DEV_ACPI /* Check if SPCR can tell us what console to use. */ - if (uart_cpu_acpi_spcr(devtype, di) == 0) + if (uart_cpu_acpi_setup(devtype, di) == 0) return (0); #endif #ifdef FDT diff --git a/sys/dev/uart/uart_cpu_x86.c b/sys/dev/uart/uart_cpu_x86.c index 63f68245f589..d152d5059786 100644 --- a/sys/dev/uart/uart_cpu_x86.c +++ b/sys/dev/uart/uart_cpu_x86.c @@ -70,7 +70,7 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di) * !late_console, we haven't set up our own page tables yet, so we * can't map ACPI tables to look at them. */ - if (late_console && uart_cpu_acpi_spcr(devtype, di) == 0) + if (late_console && uart_cpu_acpi_setup(devtype, di) == 0) return (0); #endif