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
251 * All interrupt jumptable entries jump to here
252 * after pushing the interrupt vector number onto the
258 gs movw OFFS_VECTOR(%bp), %ax
275 Lint_10h: /* VGA BIOS services */
284 Lint_13h: /* BIOS disk services */
287 Lint_15h: /* Misc. BIOS services */
290 Lint_16h: /* keyboard services */
293 Lint_1ah: /* PCI bios */
300 /* Insert code for unhandeled INTs here.
302 * ROLO prints a message to the console
303 * (we could do that but then we're in 16bit mode
304 * so we'll have to get back into 32bit mode
305 * to use the console I/O routines (if we do this
306 * we shuls make int 0x10 and int 0x16 work as well))
309 RESTORE_CALLERS_STACK
310 addw $2,%sp /* dump vector number */
311 iret /* return from interrupt */
315 ************************************************************
316 * BIOS interrupt 10h -- VGA services
317 ************************************************************
320 gs movw OFFS_AX(%bp), %ax
330 Lcur_pos: /* Read Cursor Position and Size */
331 gs movw $0, OFFS_CX(%bp)
332 gs movw $0, OFFS_DX(%bp)
335 Lvid_state: /* Get Video State */
336 gs movw $(80 << 8|0x03), OFFS_AX(%bp) /* 80 columns, 80x25, 16 colors */
337 gs movw $0, OFFS_BX(%bp)
340 Lvid_cfg: /* Video Subsystem Configuration (EGA/VGA) */
341 gs movw $0x10, OFFS_BX(%bp) /* indicate CGA/MDA/HGA */
347 ************************************************************
348 * BIOS interrupt 11h -- Equipment determination
349 ************************************************************
353 cs movw bios_equipment, %ax
354 gs movw %ax, OFFS_AX(%bp)
360 ************************************************************
361 * BIOS interrupt 12h -- Get Memory Size
362 ************************************************************
365 cs movw ram_in_64kb_chunks, %ax
367 ja b12_more_than_640k
373 gs movw %ax, OFFS_AX(%bp) /* return number of kilobytes in ax */
375 gs movw OFFS_FLAGS(%bp), %ax
376 andw $0xfffe, %ax /* clear carry -- function succeeded */
377 gs movw %ax, OFFS_FLAGS(%bp)
384 ************************************************************
385 * BIOS interrupt 13h -- Disk services
386 ************************************************************
389 gs movw OFFS_AX(%bp), %ax
396 gs movw OFFS_AX(%bp), %ax
397 andw $0xff, %ax /* return AH=0->drive not present */
398 gs movw %ax, OFFS_AX(%bp)
404 ***********************************************************
405 * BIOS interrupt 15h -- Miscellaneous services
406 ***********************************************************
409 gs movw OFFS_AX(%bp), %ax
420 Lfunc_c0h: /* Return System Configuration Parameters (PS2 only) */
421 gs movw OFFS_FLAGS(%bp), %ax
422 orw $1, %ax /* return carry -- function not supported */
423 gs movw %ax, OFFS_FLAGS(%bp)
428 gs movw OFFS_AX(%bp), %ax
432 gs movw OFFS_FLAGS(%bp), %ax
433 orw $1, %ax /* return carry -- function not supported */
434 gs movw %ax, OFFS_FLAGS(%bp)
438 Lfunc_e801h: /* Get memory size for >64M Configurations */
439 cs movw ram_in_64kb_chunks, %ax
441 ja e801_more_than_16mb
442 shlw $6, %ax /* multiply by 64 */
443 subw $0x400, %ax /* 1st meg does not count */
445 gs movw %ax, OFFS_AX(%bp) /* return memory size between 1M and 16M in 1kb chunks in AX and CX */
446 gs movw %ax, OFFS_CX(%bp)
447 gs movw $0, OFFS_BX(%bp) /* set BX and DX to 0*/
448 gs movw $0, OFFS_DX(%bp)
449 gs movw OFFS_FLAGS(%bp), %ax
450 andw $0xfffe, %ax /* clear carry -- function succeeded */
451 gs movw %ax, OFFS_FLAGS(%bp)
456 subw $0x100, %ax /* subtract 16MB */
458 gs movw $0x3c00, OFFS_AX(%bp) /* return 0x3c00 (16MB-1MB) in AX and CX */
459 gs movw $0x3c00, OFFS_CX(%bp)
460 gs movw %ax, OFFS_BX(%bp) /* set BX and DX to number of 64kb chunks above 16MB */
461 gs movw %ax, OFFS_DX(%bp)
463 gs movw OFFS_FLAGS(%bp), %ax
464 andw $0xfffe, %ax /* clear carry -- function succeeded */
465 gs movw %ax, OFFS_FLAGS(%bp)
470 cs movw ram_in_64kb_chunks, %ax
472 jna b88_not_more_than16
476 subw $0x400, %ax /* 1st meg does not count */
478 gs movw %ax, OFFS_AX(%bp) /* return number of kilobytes between 16MB and 16MB in ax */
480 gs movw OFFS_FLAGS(%bp), %ax
481 andw $0xfffe, %ax /* clear carry -- function succeeded */
482 gs movw %ax, OFFS_FLAGS(%bp)
489 ************************************************************
490 * BIOS interrupt 16h -- keyboard services
491 ************************************************************
494 gs movw OFFS_AX(%bp), %ax
501 xorw %ax, %ax /* do nothing -- function not supported */
505 ************************************************************
506 * BIOS interrupt 1ah -- PCI bios
507 ************************************************************
510 gs movw OFFS_AX(%bp), %ax
516 call realmode_pci_bios
517 xorw %ax, %ax /* do nothing -- function not supported */
521 .globl ram_in_64kb_chunks
522 .hidden ram_in_64kb_chunks
523 .type ram_in_64kb_chunks, @function
527 .globl bios_equipment
528 .hidden bios_equipment
529 .type bios_equipment, @function