3 * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25 * Based on msbios.c from rolo 1.6:
26 *----------------------------------------------------------------------
28 * Sysgo Real-Time Solutions GmbH
29 * Klein-Winternheim, Germany
30 *----------------------------------------------------------------------
36 * During it's initialization phase, before switching to protected
37 * mode, the Linux Kernel makes a few BIOS calls. This won't work
38 * if the board does not have a BIOS.
40 * This is a very minimalisic BIOS that supplies just enough
41 * functionality to keep the Linux Kernel happy. It is NOT
42 * a general purpose replacement for a real BIOS !!
48 /* a call to f000:0 should warmboot */
53 .type rm_int00, @function
59 .type rm_int01, @function
65 .type rm_int02, @function
71 .type rm_int03, @function
77 .type rm_int04, @function
83 .type rm_int05, @function
89 .type rm_int06, @function
95 .type rm_int07, @function
101 .type rm_int08, @function
107 .type rm_int09, @function
113 .type rm_int0a, @function
119 .type rm_int0b, @function
125 .type rm_int0c, @function
131 .type rm_int0d, @function
137 .type rm_int0e, @function
143 .type rm_int0f, @function
149 .type rm_int10, @function
155 .type rm_int11, @function
161 .type rm_int12, @function
167 .type rm_int13, @function
173 .type rm_int14, @function
179 .type rm_int15, @function
185 .type rm_int16, @function
191 .type rm_int17, @function
197 .type rm_int18, @function
203 .type rm_int19, @function
209 .type rm_int1a, @function
215 .type rm_int1b, @function
221 .type rm_int1c, @function
227 .type rm_int1d, @function
233 .type rm_int1e, @function
239 .type rm_int1f, @function
245 .type rm_def_int, @function
250 * All interrupt jumptable entries jump to here after pushing the
251 * interrupt vector number onto the stack.
256 gs movw OFFS_VECTOR(%bp), %ax
274 /* VGA BIOS services */
284 /* BIOS disk services */
288 /* Misc. BIOS services */
292 /* keyboard services */
304 * Insert code for unhandeled INTs here.
306 * ROLO prints a message to the console we could do that but then
307 * we're in 16bit mode so we'll have to get back into 32bit mode
308 * to use the console I/O routines (if we do this we should make
309 * int 0x10 and int 0x16 work as well)
312 RESTORE_CALLERS_STACK
314 /* dump vector number */
317 /* return from interrupt */
321 ************************************************************
322 * BIOS interrupt 10h -- VGA services
323 ************************************************************
326 gs movw OFFS_AX(%bp), %ax
337 /* Read Cursor Position and Size */
338 gs movw $0, OFFS_CX(%bp)
339 gs movw $0, OFFS_DX(%bp)
343 /* Get Video State - 80 columns, 80x25, 16 colors */
344 gs movw $(80 << 8|0x03), OFFS_AX(%bp)
345 gs movw $0, OFFS_BX(%bp)
349 /* Video Subsystem Configuration (EGA/VGA) - indicate CGA/MDA/HGA */
350 gs movw $0x10, OFFS_BX(%bp)
355 ************************************************************
356 * BIOS interrupt 11h -- Equipment determination
357 ************************************************************
361 cs movw bios_equipment, %ax
362 gs movw %ax, OFFS_AX(%bp)
367 ************************************************************
368 * BIOS interrupt 12h -- Get Memory Size
369 ************************************************************
372 cs movw ram_in_64kb_chunks, %ax
374 ja b12_more_than_640k
380 /* return number of kilobytes in ax */
381 gs movw %ax, OFFS_AX(%bp)
383 gs movw OFFS_FLAGS(%bp), %ax
385 /* clear carry -- function succeeded */
387 gs movw %ax, OFFS_FLAGS(%bp)
393 ************************************************************
394 * BIOS interrupt 13h -- Disk services
395 ************************************************************
398 gs movw OFFS_AX(%bp), %ax
405 gs movw OFFS_AX(%bp), %ax
407 /* return AH=0->drive not present */
409 gs movw %ax, OFFS_AX(%bp)
414 ***********************************************************
415 * BIOS interrupt 15h -- Miscellaneous services
416 ***********************************************************
419 gs movw OFFS_AX(%bp), %ax
431 /* Return System Configuration Parameters (PS2 only) */
432 gs movw OFFS_FLAGS(%bp), %ax
434 /* return carry -- function not supported */
436 gs movw %ax, OFFS_FLAGS(%bp)
441 gs movw OFFS_AX(%bp), %ax
445 gs movw OFFS_FLAGS(%bp), %ax
447 /* return carry -- function not supported */
449 gs movw %ax, OFFS_FLAGS(%bp)
454 /* Get memory size for >64M Configurations */
455 cs movw ram_in_64kb_chunks, %ax
457 ja e801_more_than_16mb
462 /* 1st meg does not count */
465 /* return memory size between 1M and 16M in 1kb chunks in AX and CX */
466 gs movw %ax, OFFS_AX(%bp)
467 gs movw %ax, OFFS_CX(%bp)
469 /* set BX and DX to 0*/
470 gs movw $0, OFFS_BX(%bp)
471 gs movw $0, OFFS_DX(%bp)
472 gs movw OFFS_FLAGS(%bp), %ax
474 /* clear carry -- function succeeded */
476 gs movw %ax, OFFS_FLAGS(%bp)
484 /* return 0x3c00 (16MB-1MB) in AX and CX */
485 gs movw $0x3c00, OFFS_AX(%bp)
486 gs movw $0x3c00, OFFS_CX(%bp)
488 /* set BX and DX to number of 64kb chunks above 16MB */
489 gs movw %ax, OFFS_BX(%bp)
490 gs movw %ax, OFFS_DX(%bp)
492 gs movw OFFS_FLAGS(%bp), %ax
494 /* clear carry -- function succeeded */
496 gs movw %ax, OFFS_FLAGS(%bp)
501 cs movw ram_in_64kb_chunks, %ax
503 jna b88_not_more_than16
508 /* 1st meg does not count */
511 /* return number of kilobytes between 16MB and 16MB in ax */
512 gs movw %ax, OFFS_AX(%bp)
514 gs movw OFFS_FLAGS(%bp), %ax
516 /* clear carry -- function succeeded */
518 gs movw %ax, OFFS_FLAGS(%bp)
524 ************************************************************
525 * BIOS interrupt 16h -- keyboard services
526 ************************************************************
529 gs movw OFFS_AX(%bp), %ax
536 /* do nothing -- function not supported */
541 ************************************************************
542 * BIOS interrupt 1ah -- PCI bios
543 ************************************************************
546 gs movw OFFS_AX(%bp), %ax
552 call realmode_pci_bios
554 /* do nothing -- function not supported */
559 .globl ram_in_64kb_chunks
560 .hidden ram_in_64kb_chunks
561 .type ram_in_64kb_chunks, @function
565 .globl bios_equipment
566 .hidden bios_equipment
567 .type bios_equipment, @function