mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 12:54:27 +00:00
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
This commit is contained in:
parent
473c0b44ae
commit
a931b85a09
|
@ -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 @@ uart_cpu_acpi_spcr(int devtype, struct uart_devinfo *di)
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -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_ */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue