arch/mips/boot/compressed/uart-16550.c
Source file repositories/reference/linux-study-clean/arch/mips/boot/compressed/uart-16550.c
File Facts
- System
- Linux kernel
- Corpus path
arch/mips/boot/compressed/uart-16550.c- Extension
.c- Size
- 1188 bytes
- Lines
- 55
- Domain
- Architecture Layer
- Bucket
- arch/mips
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
Dependency Surface
linux/types.hlinux/serial_reg.hasm/addrspace.hdecompress.h
Detected Declarations
function serial_infunction serial_outfunction putc
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* 16550 compatible uart based serial debug support for zboot
*/
#include <linux/types.h>
#include <linux/serial_reg.h>
#include <asm/addrspace.h>
#include "decompress.h"
#if defined(CONFIG_MACH_LOONGSON64) || defined(CONFIG_MIPS_MALTA)
#define UART_BASE 0x1fd003f8
#define PORT(offset) (CKSEG1ADDR(UART_BASE) + (offset))
#endif
#ifdef CONFIG_MACH_INGENIC
#define INGENIC_UART_BASE_ADDR (0x10030000 + 0x1000 * CONFIG_ZBOOT_INGENIC_UART)
#define PORT(offset) (CKSEG1ADDR(INGENIC_UART_BASE_ADDR) + (4 * offset))
#endif
#ifdef CONFIG_ECONET
#define EN75_UART_BASE 0x1fbf0003
#define PORT(offset) (CKSEG1ADDR(EN75_UART_BASE) + (4 * (offset)))
#endif
#ifndef IOTYPE
#define IOTYPE char
#endif
#ifndef PORT
#error please define the serial port address for your own machine
#endif
static inline unsigned int serial_in(int offset)
{
return *((volatile IOTYPE *)PORT(offset)) & 0xFF;
}
static inline void serial_out(int offset, int value)
{
*((volatile IOTYPE *)PORT(offset)) = value & 0xFF;
}
void putc(char c)
{
int timeout = 1000000;
while (((serial_in(UART_LSR) & UART_LSR_THRE) == 0) && (timeout-- > 0))
;
serial_out(UART_TX, c);
}
Annotation
- Immediate include surface: `linux/types.h`, `linux/serial_reg.h`, `asm/addrspace.h`, `decompress.h`.
- Detected declarations: `function serial_in`, `function serial_out`, `function putc`.
- Atlas domain: Architecture Layer / arch/mips.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.