tty.c (75bf465f0bc33e9b776a46d6a1b9b990f5fb7c37) tty.c (33def8498fdde180023444b08e12b72a9efed41d)
1// SPDX-License-Identifier: GPL-2.0-only
2/* -*- linux-c -*- ------------------------------------------------------- *
3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds
5 * Copyright 2007 rPath, Inc. - All Rights Reserved
6 * Copyright 2009 Intel Corporation; author H. Peter Anvin
7 *
8 * ----------------------------------------------------------------------- */

--- 11 unchanged lines hidden (view full) ---

20#define TXR 0 /* Transmit register (WRITE) */
21#define LSR 5 /* Line Status */
22
23/*
24 * These functions are in .inittext so they can be used to signal
25 * error during initialization.
26 */
27
1// SPDX-License-Identifier: GPL-2.0-only
2/* -*- linux-c -*- ------------------------------------------------------- *
3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds
5 * Copyright 2007 rPath, Inc. - All Rights Reserved
6 * Copyright 2009 Intel Corporation; author H. Peter Anvin
7 *
8 * ----------------------------------------------------------------------- */

--- 11 unchanged lines hidden (view full) ---

20#define TXR 0 /* Transmit register (WRITE) */
21#define LSR 5 /* Line Status */
22
23/*
24 * These functions are in .inittext so they can be used to signal
25 * error during initialization.
26 */
27
28static void __attribute__((section(".inittext"))) serial_putchar(int ch)
28static void __section(".inittext") serial_putchar(int ch)
29{
30 unsigned timeout = 0xffff;
31
32 while ((inb(early_serial_base + LSR) & XMTRDY) == 0 && --timeout)
33 cpu_relax();
34
35 outb(ch, early_serial_base + TXR);
36}
37
29{
30 unsigned timeout = 0xffff;
31
32 while ((inb(early_serial_base + LSR) & XMTRDY) == 0 && --timeout)
33 cpu_relax();
34
35 outb(ch, early_serial_base + TXR);
36}
37
38static void __attribute__((section(".inittext"))) bios_putchar(int ch)
38static void __section(".inittext") bios_putchar(int ch)
39{
40 struct biosregs ireg;
41
42 initregs(&ireg);
43 ireg.bx = 0x0007;
44 ireg.cx = 0x0001;
45 ireg.ah = 0x0e;
46 ireg.al = ch;
47 intcall(0x10, &ireg, NULL);
48}
49
39{
40 struct biosregs ireg;
41
42 initregs(&ireg);
43 ireg.bx = 0x0007;
44 ireg.cx = 0x0001;
45 ireg.ah = 0x0e;
46 ireg.al = ch;
47 intcall(0x10, &ireg, NULL);
48}
49
50void __attribute__((section(".inittext"))) putchar(int ch)
50void __section(".inittext") putchar(int ch)
51{
52 if (ch == '\n')
53 putchar('\r'); /* \n -> \r\n */
54
55 bios_putchar(ch);
56
57 if (early_serial_base != 0)
58 serial_putchar(ch);
59}
60
51{
52 if (ch == '\n')
53 putchar('\r'); /* \n -> \r\n */
54
55 bios_putchar(ch);
56
57 if (early_serial_base != 0)
58 serial_putchar(ch);
59}
60
61void __attribute__((section(".inittext"))) puts(const char *str)
61void __section(".inittext") puts(const char *str)
62{
63 while (*str)
64 putchar(*str++);
65}
66
67/*
68 * Read the CMOS clock through the BIOS, and return the
69 * seconds in BCD.

--- 68 unchanged lines hidden ---
62{
63 while (*str)
64 putchar(*str++);
65}
66
67/*
68 * Read the CMOS clock through the BIOS, and return the
69 * seconds in BCD.

--- 68 unchanged lines hidden ---