34 #include "prot-domains.h"
36 #include "uart-16x50.h"
48 #define UART_LCR_7_DLAB BIT(7)
52 #define UART_LCR_8BITS 0x03
55 #define UART_FCR_0_FIFOE BIT(0)
56 #define UART_FCR_1_RFIFOR BIT(1)
57 #define UART_FCR_2_XFIFOR BIT(2)
62 #define UART_LSR_5_THRE BIT(5)
65 typedef struct uart_16x50_regs {
66 volatile uint32_t rbr_thr_dll, ier_dlh, iir_fcr, lcr;
67 volatile uint32_t mcr, lsr, msr, scr, usr, htx, dmasa;
70 #if X86_CONF_PROT_DOMAINS == X86_CONF_PROT_DOMAINS__PAGING
75 #define UART_MMIO_SZ MIN_PAGE_SIZE
82 #define UART_MMIO_SZ sizeof(uart_16x50_regs_t)
90 uart_16x50_regs_t ATTR_MMIO_ADDR_SPACE *regs =
91 (uart_16x50_regs_t ATTR_MMIO_ADDR_SPACE *)PROT_DOMAINS_MMIO(c_this);
93 prot_domains_enable_mmio();
96 MMIO_WRITEL(regs->lcr, UART_LCR_7_DLAB);
101 MMIO_WRITEL(regs->rbr_thr_dll, dl & UINT8_MAX);
102 MMIO_WRITEL(regs->ier_dlh, dl >> 8);
107 MMIO_WRITEL(regs->lcr, UART_LCR_8BITS);
110 MMIO_WRITEL(regs->iir_fcr,
111 UART_FCR_0_FIFOE | UART_FCR_1_RFIFOR | UART_FCR_2_XFIFOR);
113 prot_domains_disable_mmio();
127 uart_16x50_regs_t ATTR_MMIO_ADDR_SPACE *regs =
128 (uart_16x50_regs_t ATTR_MMIO_ADDR_SPACE *)PROT_DOMAINS_MMIO(c_this);
130 prot_domains_enable_mmio();
134 MMIO_READL(ready, regs->lsr);
135 }
while((ready & UART_LSR_5_THRE) == 0);
138 MMIO_WRITEL(regs->rbr_thr_dll, c);
140 prot_domains_disable_mmio();
159 pci_init(c_this, pci_addr, UART_MMIO_SZ, 0, 0);
160 SYSCALLS_INIT(uart_16x50_setup);
161 SYSCALLS_AUTHZ(uart_16x50_setup, *c_this);
162 SYSCALLS_INIT(uart_16x50_tx);
163 SYSCALLS_AUTHZ(uart_16x50_tx, *c_this);
165 prot_domains_copy_dcd(&loc_c_this, c_this);
167 uart_16x50_setup(loc_c_this, dl);
PCI configuration address.
Data associated with each protection domain that is owned by clients of that domain and used to ident...