Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 29 → Rev 30

/SPARTAN/trunk/arch/ia32/include/bios/bios.h
0,0 → 1,40
/*
* Copyright (C) 2005 Jakub Jermar
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
#ifndef __BIOS_H__
#define __BIOS_H__
 
#include <arch/types.h>
 
#define BIOS_EBDA_PTR 0x40e
 
extern __address ebda;
 
extern void bios_init(void);
 
#endif /* __BIOS_H__ */
/SPARTAN/trunk/arch/ia32/Makefile.inc
24,6 → 24,7
arch/asm.s \
arch/proc/scheduler.c \
arch/acpi/acpi.c \
arch/bios/bios.c \
arch/smp/ap.S \
arch/smp/apic.c \
arch/smp/mp.c \
/SPARTAN/trunk/arch/ia32/src/ia32.c
67,6 → 67,7
write_dr0(config.cpu_active - 1);
 
if (config.cpu_active == 1) {
bios_init();
i8042_init(); /* a20 bit */
i8259_init(); /* PIC */
i8254_init(); /* hard clock */
/SPARTAN/trunk/arch/ia32/src/bios/bios.c
0,0 → 1,38
/*
* Copyright (C) 2005 Jakub Jermar
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
#include <arch/bios/bios.h>
#include <arch/types.h>
 
__address ebda = 0;
 
void bios_init(void)
{
/* Copy the EBDA out from BIOS Data Area */
ebda = *((__u16 *) BIOS_EBDA_PTR) * 0x10;
}
/SPARTAN/trunk/arch/ia32/src/smp/mp.c
46,6 → 46,7
#include <cpu.h>
#include <arch/i8259.h>
#include <arch/asm.h>
#include <arch/bios/bios.h>
#include <arch/acpi/madt.h>
 
/*
132,21 → 133,10
 
/*
* First place to search the MP Floating Pointer Structure is the Extended
* BIOS Data Area. We have to read EBDA segment address from the BIOS Data
* Area. Unfortunatelly, this memory is in page 0, which has intentionally no
* mapping.
*/
frame = frame_alloc(FRAME_KA);
map_page_to_frame(frame,0,PAGE_CACHEABLE,0);
addr = *((__u16 *) (frame + 0x40e)) * 16;
map_page_to_frame(frame,frame,PAGE_CACHEABLE,0);
frame_free(frame);
 
/*
* EBDA can be undefined. In that case addr would be 0.
*/
if (addr >= 0x1000) {
addr = ebda;
if (addr) {
cnt = 1024;
while (addr = __u32_search(addr,cnt,FS_SIGNATURE)) {
if (mp_fs_check((__u8 *) addr))
155,18 → 145,19
cnt--;
}
}
/*
* Second place where the MP Floating Pointer Structure may live is the last
* kilobyte of base memory.
*/
addr = 639*1024;
cnt = 1024;
while (addr = __u32_search(addr,cnt,FS_SIGNATURE)) {
if (mp_fs_check((__u8 *) addr))
goto fs_found;
addr++;
cnt--;
else {
/*
* Second place where the MP Floating Pointer Structure may live is the last
* kilobyte of base memory.
*/
addr = 639*1024;
cnt = 1024;
while (addr = __u32_search(addr,cnt,FS_SIGNATURE)) {
if (mp_fs_check((__u8 *) addr))
goto fs_found;
addr++;
cnt--;
}
}
 
/*