term/ns8250: Add base support for MMIO UARTs

This adds the ability for the driver to access UARTs via MMIO instead
of PIO selectively at runtime, and exposes a new function to add an
MMIO port.

In an ideal world, MMIO accessors would be generic and have architecture
specific memory barriers. However, existing drivers don't have them and
most of those "bare metal" drivers tend to be for x86 which doesn't need
them. If necessary, those can be added later.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
Benjamin Herrenschmidt authored and Daniel Kiper committed 2023-01-19 17:36:25 +01:00
1 parent 55604aaad2
commit 9fb22d0478
2 files changed
+74 -17

No files matched your search

+10 -1
View File
@@ -86,9 +86,17 @@ struct grub_serial_port
*/
union
{
struct
{
bool mmio;
union
{
#if defined(__mips__) || defined (__i386__) || defined (__x86_64__)
grub_port_t port;
grub_port_t port;
#endif
grub_addr_t mmio_base;
};
};
struct
{
grub_usb_device_t usbdev;
@@ -178,6 +186,7 @@ grub_serial_config_defaults (struct grub_serial_port *port)
#if defined(__mips__) || defined (__i386__) || defined (__x86_64__)
void grub_ns8250_init (void);
char *grub_serial_ns8250_add_port (grub_port_t port);
char *grub_serial_ns8250_add_mmio (grub_addr_t addr);
#endif
#ifdef GRUB_MACHINE_IEEE1275
void grub_ofserial_init (void);