arch/powerpc/kernel/btext.c
Source file repositories/reference/linux-study-clean/arch/powerpc/kernel/btext.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/kernel/btext.c- Extension
.c- Size
- 13701 bytes
- Lines
- 586
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/string.hlinux/hex.hlinux/init.hlinux/export.hlinux/font.hlinux/memblock.hlinux/pgtable.hlinux/of.hasm/sections.hasm/btext.hasm/page.hasm/mmu.hasm/io.hasm/processor.hasm/udbg.hasm/setup.h
Detected Declarations
function rmci_maybe_onfunction rmci_maybe_offfunction identify_machinefunction btext_setup_displayfunction btext_unmapfunction btext_mapfunction btext_initializefunction btext_find_displayfunction for_each_node_by_typefunction calc_basefunction btext_update_displayfunction btext_clearscreenfunction btext_flushscreenfunction btext_flushlinefunction scrollscreenfunction draw_byte_32function draw_byte_16function draw_byte_8function draw_bytefunction btext_drawcharfunction btext_drawstringfunction btext_drawtextfunction btext_drawhexfunction udbg_init_btextexport btext_update_display
Annotated Snippet
if (of_property_read_bool(np, "linux,opened")) {
printk("trying %pOF ...\n", np);
rc = btext_initialize(np);
printk("result: %d\n", rc);
}
if (rc == 0) {
of_node_put(np);
break;
}
}
return rc;
}
/* Calc the base address of a given point (x,y) */
static unsigned char * calc_base(int x, int y)
{
unsigned char *base;
base = logicalDisplayBase;
if (!base)
base = dispDeviceBase;
base += (x + dispDeviceRect[0]) * (dispDeviceDepth >> 3);
base += (y + dispDeviceRect[1]) * dispDeviceRowBytes;
return base;
}
/* Adjust the display to a new resolution */
void btext_update_display(unsigned long phys, int width, int height,
int depth, int pitch)
{
if (!dispDeviceBase)
return;
/* check it's the same frame buffer (within 256MB) */
if ((phys ^ (unsigned long)dispDeviceBase) & 0xf0000000)
return;
dispDeviceBase = (__u8 *) phys;
dispDeviceRect[0] = 0;
dispDeviceRect[1] = 0;
dispDeviceRect[2] = width;
dispDeviceRect[3] = height;
dispDeviceDepth = depth;
dispDeviceRowBytes = pitch;
if (boot_text_mapped) {
iounmap(logicalDisplayBase);
boot_text_mapped = 0;
}
btext_map();
g_loc_X = 0;
g_loc_Y = 0;
g_max_loc_X = width / 8;
g_max_loc_Y = height / 16;
}
EXPORT_SYMBOL(btext_update_display);
void __init btext_clearscreen(void)
{
unsigned int *base = (unsigned int *)calc_base(0, 0);
unsigned long width = ((dispDeviceRect[2] - dispDeviceRect[0]) *
(dispDeviceDepth >> 3)) >> 2;
int i,j;
rmci_maybe_on();
for (i=0; i<(dispDeviceRect[3] - dispDeviceRect[1]); i++)
{
unsigned int *ptr = base;
for(j=width; j; --j)
*(ptr++) = 0;
base += (dispDeviceRowBytes >> 2);
}
rmci_maybe_off();
}
void __init btext_flushscreen(void)
{
unsigned int *base = (unsigned int *)calc_base(0, 0);
unsigned long width = ((dispDeviceRect[2] - dispDeviceRect[0]) *
(dispDeviceDepth >> 3)) >> 2;
int i,j;
for (i=0; i < (dispDeviceRect[3] - dispDeviceRect[1]); i++)
{
unsigned int *ptr = base;
for(j = width; j > 0; j -= 8) {
__asm__ __volatile__ ("dcbst 0,%0" :: "r" (ptr));
ptr += 8;
}
base += (dispDeviceRowBytes >> 2);
}
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/string.h`, `linux/hex.h`, `linux/init.h`, `linux/export.h`, `linux/font.h`, `linux/memblock.h`, `linux/pgtable.h`.
- Detected declarations: `function rmci_maybe_on`, `function rmci_maybe_off`, `function identify_machine`, `function btext_setup_display`, `function btext_unmap`, `function btext_map`, `function btext_initialize`, `function btext_find_display`, `function for_each_node_by_type`, `function calc_base`.
- Atlas domain: Architecture Layer / arch/powerpc.
- Implementation status: integration 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.