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)
340 ***********************************************************
341 * BIOS interrupt 15h -- Miscellaneous services
342 ***********************************************************
345 gs movw OFFS_AX(%bp), %ax
356 Lfunc_c0h: /* Return System Configuration Parameters (PS2 only) */
357 gs movw OFFS_FLAGS(%bp), %ax
358 orw $1, %ax /* return carry -- function not supported */
359 gs movw %ax, OFFS_FLAGS(%bp)
364 gs movw OFFS_AX(%bp), %ax
368 gs movw OFFS_FLAGS(%bp), %ax
369 orw $1, %ax /* return carry -- function not supported */
370 gs movw %ax, OFFS_FLAGS(%bp)
374 Lfunc_e801h: /* Get memory size for >64M Configurations */
375 cs movw ram_in_64kb_chunks, %ax
377 ja e801_more_than_16mb
378 shlw $6, %ax /* multiply by 64 */
379 subw $0x400, %ax /* 1st meg does not count */
381 gs movw %ax, OFFS_AX(%bp) /* return memory size between 1M and 16M in 1kb chunks in AX and CX */
382 gs movw %ax, OFFS_CX(%bp)
383 gs movw $0, OFFS_BX(%bp) /* set BX and DX to 0*/
384 gs movw $0, OFFS_DX(%bp)
385 gs movw OFFS_FLAGS(%bp), %ax
386 andw $0xfffe, %ax /* clear carry -- function succeeded */
387 gs movw %ax, OFFS_FLAGS(%bp)
392 subw $0x100, %ax /* subtract 16MB */
394 gs movw $0x3c00, OFFS_AX(%bp) /* return 0x3c00 (16MB-1MB) in AX and CX */
395 gs movw $0x3c00, OFFS_CX(%bp)
396 gs movw %ax, OFFS_BX(%bp) /* set BX and DX to number of 64kb chunks above 16MB */
397 gs movw %ax, OFFS_DX(%bp)
399 gs movw OFFS_FLAGS(%bp), %ax
400 andw $0xfffe, %ax /* clear carry -- function succeeded */
401 gs movw %ax, OFFS_FLAGS(%bp)
406 cs movw ram_in_64kb_chunks, %ax
408 jna b88_not_more_than16
412 subw $0x400, %ax /* 1st meg does not count */
414 gs movw %ax, OFFS_AX(%bp) /* return number of kilobytes between 16MB and 16MB in ax */
416 gs movw OFFS_FLAGS(%bp), %ax
417 andw $0xfffe, %ax /* clear carry -- function succeeded */
418 gs movw %ax, OFFS_FLAGS(%bp)
425 ************************************************************
426 * BIOS interrupt 16h -- keyboard services
427 ************************************************************
430 gs movw OFFS_AX(%bp), %ax
437 xorw %ax, %ax /* do nothing -- function not supported */
441 ************************************************************
442 * BIOS interrupt 1ah -- PCI bios
443 ************************************************************
446 gs movw OFFS_AX(%bp), %ax
452 call realmode_pci_bios
453 xorw %ax, %ax /* do nothing -- function not supported */
457 .globl ram_in_64kb_chunks
461 .globl bios_equipment