#
# This file may be distributed under the terms of the GNU GPLv3 license.
-# Don't compile ACPI DSDT by default
-# Uncomment the below line in case you want to compile DSDT yourself.
-# Note: "iasl" package is required to compile.
-#BUILD_ACPI = 1
-BUILD_ACPI = 0
-
# Output directory
OUT=out/
# Source files
SRC16=floppy.c disk.c system.c clock.c serial.c kbd.c mouse.c output.c \
boot.c ata.c cdrom.c apm.c
-SRC32=post.c output.c smbios.c acpi.c smm.c smp.c pci.c
+SRC32=post.c output.c
TABLESRC=font.c cbt.c floppy_dbt.c
cc-option = $(shell if test -z "`$(1) $(2) -S -o /dev/null -xc \
CFLAGS16 = $(CFLAGS16INC) -g
TABLETMP=$(addprefix $(OUT), $(patsubst %.c,%.16.s,$(TABLESRC)))
-
all: $(OUT) $(OUT)rom.bin $(TABLETMP)
# Run with "make V=1" to see the actual compile commands
@echo " Extracting binary $@"
$(Q)objcopy -O binary $< $@
-$(OUT)romlayout32.o: $(OUT)acpi-dsdt.hex $(OUT)rom16.offset.auto.h ; $(call whole-compile, $(CFLAGS), $(addprefix src/, $(SRC32)),$@)
-
-ifeq ($(BUILD_ACPI), 1)
-$(OUT)acpi-dsdt.hex: src/acpi-dsdt.dsl
- iasl -tc -p $@ $<
-else
-$(OUT)acpi-dsdt.hex: src/acpi-dsdt.hex
- cp src/acpi-dsdt.hex $(OUT)
-endif
+$(OUT)romlayout32.o: $(OUT)rom16.offset.auto.h ; $(call whole-compile, $(CFLAGS), $(addprefix src/, $(SRC32)),$@)
$(OUT)rom32.o: $(OUT)romlayout32.o $(OUT)rombios32.lds
@echo " Linking $@"
$(Q)./tools/buildrom.py
####### Generic rules
-.PHONY : clean
clean:
rm -rf $(OUT)
#define __CONFIG_H
// Configuration definitions.
-//#define QEMU_SUPPORT
-
-#ifdef QEMU_SUPPORT
-#define CONFIG_BIOS_NAME "QEMU"
-#else
-#define CONFIG_BIOS_NAME "Bochs"
-#endif
-
#define CONFIG_FLOPPY_SUPPORT 1
#define CONFIG_PS2_MOUSE 1
#define CONFIG_ATA 1
#define CONFIG_SUBMODEL_ID 0x00
#define CONFIG_BIOS_REVISION 0x01
-/* define it if the (emulated) hardware supports SMM mode */
-#define CONFIG_SMM 1
-
-/* if true, put the MP float table and ACPI RSDT in EBDA and the MP
- table in RAM. Unfortunately, Linux has bugs with that, so we prefer
- to modify the BIOS in shadow RAM */
-#define CONFIG_USE_EBDA_TABLES 0
-
#endif // config.h
#include "util.h" // memset
#include "biosvar.h" // struct bios_data_area_s
-#include "acpi.h"
-#include "smbios.h"
-#include "smp.h"
-#include "pci.h"
-
-u32 cpuid_signature;
-u32 cpuid_features;
-u32 cpuid_ext_features;
-unsigned long ram_size;
-unsigned long bios_table_cur_addr;
-unsigned long bios_table_end_addr;
-
-#ifdef CONFIG_USE_EBDA_TABLES
-unsigned long ebda_cur_addr;
-#endif
-
-#define cpuid(index, eax, ebx, ecx, edx) \
- asm volatile ("cpuid" \
- : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) \
- : "0" (index))
-
#define bda ((struct bios_data_area_s *)0)
#define ebda ((struct extended_bios_data_area_s *)(EBDA_SEG<<4))
#define ipl ((struct ipl_s *)(IPL_SEG<<4))
}
}
-static void
-ram_probe(void)
-{
- if (inb_cmos(CMOS_MEM_EXTMEM2_LOW) | inb_cmos(CMOS_MEM_EXTMEM2_HIGH))
- ram_size = (inb_cmos(CMOS_MEM_EXTMEM2_LOW) | (inb_cmos(CMOS_MEM_EXTMEM2_HIGH) << 8)) *
- 64 * 1024 + 16 * 1024 * 1024;
- else
- ram_size = (inb_cmos(CMOS_MEM_BASE_LOW) | (inb_cmos(CMOS_MEM_BASE_HIGH) << 8)) * 1024;
-#ifdef CONFIG_USE_EBDA_TABLES
- ebda_cur_addr = ((*(u16 *)(0x40e)) << 4) + 0x380;
-#endif
-
- BX_INFO("ram_size=0x%08lx\n", ram_size);
-}
-
-static void
-cpu_probe(void)
-{
- u32 eax, ebx, ecx, edx;
-
- cpuid(1, eax, ebx, ecx, edx);
- cpuid_signature = eax;
- cpuid_features = edx;
- cpuid_ext_features = ecx;
-}
-
static void
post()
{
init_boot_vectors();
rom_scan(0xc8000, 0xe0000);
- ram_probe();
- cpu_probe();
- smp_probe();
- //pci_bios_init();
-
- if (bios_table_cur_addr != 0) {
- mptable_init();
-
- smbios_init();
-
- if (acpi_enabled)
- acpi_bios_init();
-
- bios_lock_shadow_ram();
-
- BX_INFO("bios_table_cur_addr: 0x%08lx\n", bios_table_cur_addr);
- if (bios_table_cur_addr > bios_table_end_addr)
- BX_PANIC("bios_table_end_addr overflow!\n");
- }
-
callrom(SEG_BIOS, OFFSET_begin_boot);
}
//
// This file may be distributed under the terms of the GNU GPLv3 license.
-#include "acpi.h"
#include "util.h" // irq_restore
#include "biosvar.h" // CONFIG_BIOS_TABLE
#include "ioport.h" // inb
set_cf(regs, 0);
}
+#define ACPI_DATA_SIZE 0x00010000L
+
static void
set_e820_range(u16 DI, u32 start, u32 end, u16 type)
{
typedef unsigned int u32;
typedef signed int s32;
typedef u32 size_t;
-typedef unsigned long long u64;
#define __VISIBLE __attribute__((externally_visible))
#ifdef MODE16
((char *)s)[--n] = c;
}
-static inline void
-memcpy(void *d, void *s, size_t n)
-{
- while (n) {
- ((char *)d)[n-1] = ((char *)s)[n-1];
- n--;
- }
-}
-
static inline void
eoi_master_pic()
{
set_cf(regs, code);
}
-unsigned long
-align(unsigned long addr, unsigned long v)
-{
- return (addr + v - 1) & ~(v - 1);
-}
-
#endif // util.h