2 * -----------------------------------------------------------------------
4 * Copyright 1994-2008 H. Peter Anvin - All Rights Reserved
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, Inc., 53 Temple Place Ste 330,
9 * Boston MA 02111-1307, USA; either version 2 of the License, or
10 * (at your option) any later version; incorporated herein by reference.
12 * -----------------------------------------------------------------------
17 * Header file for the BIOS data structures etc.
28 #define BIOS_timer_hook (4 * 0x1C)
29 #define fdctab (4 * 0x1E)
30 #define fdctab1 fdctab
31 #define fdctab2 (fdctab + 2)
33 #define SERIAL_BASE 0x0400 /* Base address for 4 serial ports */
34 #define BIOS_fbm 0x0413 /* Free Base Memory (kilobytes) */
35 #define BIOS_page 0x0462 /* Current video page */
36 #define BIOS_timer 0x046C /* Timer ticks */
37 #define BIOS_magic 0x0472 /* BIOS reset magic */
38 #define BIOS_vidrows 0x0484 /* Number of screen rows */
40 static inline uint16_t bios_fbm(void)
42 return *(volatile uint16_t *)BIOS_fbm
;
45 static inline void set_bios_fbm(uint16_t mem
)
47 *(volatile uint16_t *)BIOS_fbm
= mem
;
50 #define serial_buf_size 4096
51 #define IO_DELAY_PORT 0x80 /* Invalid port (we hope!) */
53 static inline void io_delay(void)
55 outb(0x0, IO_DELAY_PORT
);
56 outb(0x0, IO_DELAY_PORT
);
60 * Sometimes we need to access screen coordinates as separate 8-bit
61 * entities and sometimes we need to use them as 16-bit entities. Using
62 * this structure allows the compiler to do it for us.
66 uint8_t col
; /* Cursor column for message file */
67 uint8_t row
; /* Cursor row for message file */
71 extern union screen _cursor
;
72 extern union screen _screensize
;
74 #define CursorDX _cursor.dx
75 #define CursorCol _cursor.b.col
76 #define CursorRow _cursor.b.row
78 #define ScreenSize _screensize.dx
79 #define VidCols _screensize.b.col
80 #define VidRows _screensize.b.row
83 extern void use_font(void);
84 extern void bios_adjust_screen(void);
87 extern char *SerialHead
;
88 extern char *SerialTail
;
90 extern void bios_init(void);
92 static inline uint16_t get_serial_port(uint16_t port
)
94 /* Magic array in BIOS memory, contains four entries */
95 const uint16_t * const serial_ports
= (const uint16_t *)SERIAL_BASE
;
98 * If port > 3 then the port is simply the I/O base address
103 /* Get the I/O port from the BIOS */
104 return serial_ports
[port
];