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 */
186 * All interrupt jumptable entries jump to here
187 * after pushing the interrupt vector number onto the
193 gs movw OFFS_VECTOR(%bp), %ax
210 Lint_10h: /* VGA BIOS services */
219 Lint_13h: /* BIOS disk services */
222 Lint_15h: /* Misc. BIOS services */
225 Lint_16h: /* keyboard services */
228 Lint_1ah: /* PCI bios */
235 /* Insert code for unhandeled INTs here.
237 * ROLO prints a message to the console
238 * (we could do that but then we're in 16bit mode
239 * so we'll have to get back into 32bit mode
240 * to use the console I/O routines (if we do this
241 * we shuls make int 0x10 and int 0x16 work as well))
244 RESTORE_CALLERS_STACK
245 addw $2,%sp /* dump vector number */
246 iret /* return from interrupt */
250 ************************************************************
251 * BIOS interrupt 10h -- VGA services
252 ************************************************************
255 gs movw OFFS_AX(%bp), %ax
265 Lcur_pos: /* Read Cursor Position and Size */
266 gs movw $0, OFFS_CX(%bp)
267 gs movw $0, OFFS_DX(%bp)
270 Lvid_state: /* Get Video State */
271 gs movw $(80 << 8|0x03), OFFS_AX(%bp) /* 80 columns, 80x25, 16 colors */
272 gs movw $0, OFFS_BX(%bp)
275 Lvid_cfg: /* Video Subsystem Configuration (EGA/VGA) */
276 gs movw $0x10, OFFS_BX(%bp) /* indicate CGA/MDA/HGA */
282 ************************************************************
283 * BIOS interrupt 11h -- Equipment determination
284 ************************************************************
288 cs movw bios_equipment, %ax
289 gs movw %ax, OFFS_AX(%bp)
295 ************************************************************
296 * BIOS interrupt 12h -- Get Memory Size
297 ************************************************************
300 cs movw ram_in_64kb_chunks, %ax
302 ja b12_more_than_640k
308 gs movw %ax, OFFS_AX(%bp) /* return number of kilobytes in ax */
310 gs movw OFFS_FLAGS(%bp), %ax
311 andw $0xfffe, %ax /* clear carry -- function succeeded */
312 gs movw %ax, OFFS_FLAGS(%bp)
319 ************************************************************
320 * BIOS interrupt 13h -- Disk services
321 ************************************************************
324 gs movw OFFS_AX(%bp), %ax
331 gs movw OFFS_AX(%bp), %ax
332 andw $0xff, %ax /* return AH=0->drive not present */
333 gs movw %ax, OFFS_AX(%bp)
339 ***********************************************************
340 * BIOS interrupt 15h -- Miscellaneous services
341 ***********************************************************
344 gs movw OFFS_AX(%bp), %ax
355 Lfunc_c0h: /* Return System Configuration Parameters (PS2 only) */
356 gs movw OFFS_FLAGS(%bp), %ax
357 orw $1, %ax /* return carry -- function not supported */
358 gs movw %ax, OFFS_FLAGS(%bp)
363 gs movw OFFS_AX(%bp), %ax
367 gs movw OFFS_FLAGS(%bp), %ax
368 orw $1, %ax /* return carry -- function not supported */
369 gs movw %ax, OFFS_FLAGS(%bp)
373 Lfunc_e801h: /* Get memory size for >64M Configurations */
374 cs movw ram_in_64kb_chunks, %ax
376 ja e801_more_than_16mb
377 shlw $6, %ax /* multiply by 64 */
378 subw $0x400, %ax /* 1st meg does not count */
380 gs movw %ax, OFFS_AX(%bp) /* return memory size between 1M and 16M in 1kb chunks in AX and CX */
381 gs movw %ax, OFFS_CX(%bp)
382 gs movw $0, OFFS_BX(%bp) /* set BX and DX to 0*/
383 gs movw $0, OFFS_DX(%bp)
384 gs movw OFFS_FLAGS(%bp), %ax
385 andw $0xfffe, %ax /* clear carry -- function succeeded */
386 gs movw %ax, OFFS_FLAGS(%bp)
391 subw $0x100, %ax /* subtract 16MB */
393 gs movw $0x3c00, OFFS_AX(%bp) /* return 0x3c00 (16MB-1MB) in AX and CX */
394 gs movw $0x3c00, OFFS_CX(%bp)
395 gs movw %ax, OFFS_BX(%bp) /* set BX and DX to number of 64kb chunks above 16MB */
396 gs movw %ax, OFFS_DX(%bp)
398 gs movw OFFS_FLAGS(%bp), %ax
399 andw $0xfffe, %ax /* clear carry -- function succeeded */
400 gs movw %ax, OFFS_FLAGS(%bp)
405 cs movw ram_in_64kb_chunks, %ax
407 jna b88_not_more_than16
411 subw $0x400, %ax /* 1st meg does not count */
413 gs movw %ax, OFFS_AX(%bp) /* return number of kilobytes between 16MB and 16MB in ax */
415 gs movw OFFS_FLAGS(%bp), %ax
416 andw $0xfffe, %ax /* clear carry -- function succeeded */
417 gs movw %ax, OFFS_FLAGS(%bp)
424 ************************************************************
425 * BIOS interrupt 16h -- keyboard services
426 ************************************************************
429 gs movw OFFS_AX(%bp), %ax
436 xorw %ax, %ax /* do nothing -- function not supported */
440 ************************************************************
441 * BIOS interrupt 1ah -- PCI bios
442 ************************************************************
445 gs movw OFFS_AX(%bp), %ax
451 call realmode_pci_bios
452 xorw %ax, %ax /* do nothing -- function not supported */
456 .globl ram_in_64kb_chunks
460 .globl bios_equipment