coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
functions.c
Go to the documentation of this file.
1
/****************************************************************************
2
* YABEL BIOS Emulator
3
*
4
* Copyright (c) 2008 Pattrick Hueper <phueper@hueper.net>
5
*
6
* All rights reserved.
7
*
8
* Redistribution and use in source and binary forms, with or without
9
* modification, are permitted provided that the following conditions are
10
* met:
11
*
12
* Redistributions of source code must retain the above copyright
13
* notice, this list of conditions and the following disclaimer.
14
*
15
* Redistributions in binary form must reproduce the above copyright
16
* notice, this list of conditions and the following disclaimer
17
* in the documentation and/or other materials provided with the
18
* distribution.
19
*
20
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
*
32
****************************************************************************/
33
34
/* this file contains functions provided by SLOF, that the current biosemu implementation needs
35
* they should go away in the future...
36
*/
37
38
#include <types.h>
39
#include <
device/device.h
>
40
#include "../debug.h"
41
#include "../biosemu.h"
42
#include <
vbe.h
>
43
#include "../compat/time.h"
44
45
#define VMEM_SIZE (1024 * 1024)
/* 1 MB */
46
47
#if !CONFIG(YABEL_DIRECTHW)
48
#if CONFIG_YABEL_VIRTMEM_LOCATION
49
u8
*
vmem
= (
u8
*) CONFIG_YABEL_VIRTMEM_LOCATION;
50
#else
51
u8
*
vmem
= (
u8
*) (16*1024*1024);
/* default to 16MB */
52
#endif
53
#else
54
u8
*
vmem
=
NULL
;
55
#endif
56
57
extern
u8
*
biosmem
;
58
59
void
run_bios
(
struct
device
* dev,
unsigned
long
addr
)
60
{
61
biosmem
=
vmem
;
62
63
biosemu
(
vmem
,
VMEM_SIZE
, dev,
addr
);
64
65
#if CONFIG(FRAMEBUFFER_SET_VESA_MODE)
66
vbe_set_graphics
();
67
#endif
68
}
69
70
unsigned
long
tb_freq
= 0;
71
72
u64
get_time
(
void
)
73
{
74
u64
act = 0;
75
#if ENV_X86
76
u32
eax, edx;
77
78
__asm__ __volatile__(
79
"rdtsc"
80
:
"=a"
(eax),
"=d"
(edx)
81
:
/* no inputs, no clobber */
);
82
act = ((
u64
) edx << 32) | eax;
83
#endif
84
return
act;
85
}
biosemu
u32 biosemu(u8 *biosmem, u32 biosmem_size, struct device *dev, unsigned long rom_addr)
Definition:
biosemu.c:87
addr
static u32 addr
Definition:
cirrus.c:14
vmem
u8 * vmem
Definition:
functions.c:51
run_bios
void run_bios(struct device *dev, unsigned long addr)
Definition:
functions.c:59
biosmem
u8 * biosmem
Definition:
vbe.c:74
tb_freq
unsigned long tb_freq
Definition:
functions.c:70
VMEM_SIZE
#define VMEM_SIZE
Definition:
functions.c:45
get_time
u64 get_time(void)
Definition:
functions.c:72
device.h
NULL
#define NULL
Definition:
stddef.h:19
u64
uint64_t u64
Definition:
stdint.h:54
u32
uint32_t u32
Definition:
stdint.h:51
u8
uint8_t u8
Definition:
stdint.h:45
device
Definition:
device.h:107
vbe.h
vbe_set_graphics
void vbe_set_graphics(void)
src
device
oprom
yabel
compat
functions.c
Generated by
1.9.1