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 !!
49 /* a call to f000:0 should warmboot */
54 .type rm_int00, @function
60 .type rm_int01, @function
66 .type rm_int02, @function
72 .type rm_int03, @function
78 .type rm_int04, @function
84 .type rm_int05, @function
90 .type rm_int06, @function
96 .type rm_int07, @function
102 .type rm_int08, @function
108 .type rm_int09, @function
114 .type rm_int0a, @function
120 .type rm_int0b, @function
126 .type rm_int0c, @function
132 .type rm_int0d, @function
138 .type rm_int0e, @function
144 .type rm_int0f, @function
150 .type rm_int10, @function
156 .type rm_int11, @function
162 .type rm_int12, @function
168 .type rm_int13, @function
174 .type rm_int14, @function
180 .type rm_int15, @function
186 .type rm_int16, @function
192 .type rm_int17, @function
198 .type rm_int18, @function
204 .type rm_int19, @function
210 .type rm_int1a, @function
216 .type rm_int1b, @function
222 .type rm_int1c, @function
228 .type rm_int1d, @function
234 .type rm_int1e, @function
240 .type rm_int1f, @function
246 .type rm_def_int, @function
252 * All interrupt jumptable entries jump to here
253 * after pushing the interrupt vector number onto the
259 gs movw OFFS_VECTOR(%bp), %ax
276 Lint_10h: /* VGA BIOS services */
285 Lint_13h: /* BIOS disk services */
288 Lint_15h: /* Misc. BIOS services */
291 Lint_16h: /* keyboard services */
294 Lint_1ah: /* PCI bios */
301 /* Insert code for unhandeled INTs here.
303 * ROLO prints a message to the console
304 * (we could do that but then we're in 16bit mode
305 * so we'll have to get back into 32bit mode
306 * to use the console I/O routines (if we do this
307 * we shuls make int 0x10 and int 0x16 work as well))
310 RESTORE_CALLERS_STACK
311 addw $2,%sp /* dump vector number */
312 iret /* return from interrupt */
316 ************************************************************
317 * BIOS interrupt 10h -- VGA services
318 ************************************************************
321 gs movw OFFS_AX(%bp), %ax
331 Lcur_pos: /* Read Cursor Position and Size */
332 gs movw $0, OFFS_CX(%bp)
333 gs movw $0, OFFS_DX(%bp)
336 Lvid_state: /* Get Video State */
337 gs movw $(80 << 8|0x03), OFFS_AX(%bp) /* 80 columns, 80x25, 16 colors */
338 gs movw $0, OFFS_BX(%bp)
341 Lvid_cfg: /* Video Subsystem Configuration (EGA/VGA) */
342 gs movw $0x10, OFFS_BX(%bp) /* indicate CGA/MDA/HGA */
348 ************************************************************
349 * BIOS interrupt 11h -- Equipment determination
350 ************************************************************
354 cs movw bios_equipment, %ax
355 gs movw %ax, OFFS_AX(%bp)
361 ************************************************************
362 * BIOS interrupt 12h -- Get Memory Size
363 ************************************************************
366 cs movw ram_in_64kb_chunks, %ax
368 ja b12_more_than_640k
374 gs movw %ax, OFFS_AX(%bp) /* return number of kilobytes in ax */
376 gs movw OFFS_FLAGS(%bp), %ax
377 andw $0xfffe, %ax /* clear carry -- function succeeded */
378 gs movw %ax, OFFS_FLAGS(%bp)
385 ************************************************************
386 * BIOS interrupt 13h -- Disk services
387 ************************************************************
390 gs movw OFFS_AX(%bp), %ax
397 gs movw OFFS_AX(%bp), %ax
398 andw $0xff, %ax /* return AH=0->drive not present */
399 gs movw %ax, OFFS_AX(%bp)
405 ***********************************************************
406 * BIOS interrupt 15h -- Miscellaneous services
407 ***********************************************************
410 gs movw OFFS_AX(%bp), %ax
421 Lfunc_c0h: /* Return System Configuration Parameters (PS2 only) */
422 gs movw OFFS_FLAGS(%bp), %ax
423 orw $1, %ax /* return carry -- function not supported */
424 gs movw %ax, OFFS_FLAGS(%bp)
429 gs movw OFFS_AX(%bp), %ax
433 gs movw OFFS_FLAGS(%bp), %ax
434 orw $1, %ax /* return carry -- function not supported */
435 gs movw %ax, OFFS_FLAGS(%bp)
439 Lfunc_e801h: /* Get memory size for >64M Configurations */
440 cs movw ram_in_64kb_chunks, %ax
442 ja e801_more_than_16mb
443 shlw $6, %ax /* multiply by 64 */
444 subw $0x400, %ax /* 1st meg does not count */
446 gs movw %ax, OFFS_AX(%bp) /* return memory size between 1M and 16M in 1kb chunks in AX and CX */
447 gs movw %ax, OFFS_CX(%bp)
448 gs movw $0, OFFS_BX(%bp) /* set BX and DX to 0*/
449 gs movw $0, OFFS_DX(%bp)
450 gs movw OFFS_FLAGS(%bp), %ax
451 andw $0xfffe, %ax /* clear carry -- function succeeded */
452 gs movw %ax, OFFS_FLAGS(%bp)
457 subw $0x100, %ax /* subtract 16MB */
459 gs movw $0x3c00, OFFS_AX(%bp) /* return 0x3c00 (16MB-1MB) in AX and CX */
460 gs movw $0x3c00, OFFS_CX(%bp)
461 gs movw %ax, OFFS_BX(%bp) /* set BX and DX to number of 64kb chunks above 16MB */
462 gs movw %ax, OFFS_DX(%bp)
464 gs movw OFFS_FLAGS(%bp), %ax
465 andw $0xfffe, %ax /* clear carry -- function succeeded */
466 gs movw %ax, OFFS_FLAGS(%bp)
471 cs movw ram_in_64kb_chunks, %ax
473 jna b88_not_more_than16
477 subw $0x400, %ax /* 1st meg does not count */
479 gs movw %ax, OFFS_AX(%bp) /* return number of kilobytes between 16MB and 16MB in ax */
481 gs movw OFFS_FLAGS(%bp), %ax
482 andw $0xfffe, %ax /* clear carry -- function succeeded */
483 gs movw %ax, OFFS_FLAGS(%bp)
490 ************************************************************
491 * BIOS interrupt 16h -- keyboard services
492 ************************************************************
495 gs movw OFFS_AX(%bp), %ax
502 xorw %ax, %ax /* do nothing -- function not supported */
506 ************************************************************
507 * BIOS interrupt 1ah -- PCI bios
508 ************************************************************
511 gs movw OFFS_AX(%bp), %ax
517 call realmode_pci_bios
518 xorw %ax, %ax /* do nothing -- function not supported */
522 .globl ram_in_64kb_chunks
523 .hidden ram_in_64kb_chunks
524 .type ram_in_64kb_chunks, @function
528 .globl bios_equipment
529 .hidden bios_equipment
530 .type bios_equipment, @function