Mark 1 GB instead of 512 MB at 3 GB as UC.
Add PNP BIOS dummy support by Sebsatian
This commit is contained in:
parent
3365b50e92
commit
327a4ab5db
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: biossums.c,v 1.4 2007-05-28 08:09:13 vruppert Exp $
|
||||
* $Id: biossums.c,v 1.5 2010-01-18 20:04:44 sshwarts Exp $
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@ -83,6 +83,15 @@ byte chksum__pir_calc_value( byte* data, long offset );
|
||||
byte chksum__pir_get_value( byte* data, long offset );
|
||||
void chksum__pir_set_value( byte* data, long offset, byte value );
|
||||
|
||||
#define _PNP_LEN 5
|
||||
#define _PNP_CHKSUM 8
|
||||
|
||||
#define _PNP_MINHDR 32
|
||||
|
||||
long chksum__pnp_get_offset( byte *data, long offset );
|
||||
byte chksum__pnp_calc_value( byte* data, long offset );
|
||||
byte chksum__pnp_get_value( byte* data, long offset );
|
||||
void chksum__pnp_set_value( byte* data, long offset, byte value );
|
||||
|
||||
byte bios_data[LEN_BIOS_DATA];
|
||||
long bios_len;
|
||||
@ -210,6 +219,28 @@ int main(int argc, char* argv[]) {
|
||||
}
|
||||
|
||||
|
||||
hits = 0;
|
||||
offset = 0L;
|
||||
while( (tmp_offset = chksum__pnp_get_offset( bios_data, offset )) != -1L ) {
|
||||
offset = tmp_offset;
|
||||
cur_val = chksum__pnp_get_value( bios_data, offset );
|
||||
new_val = chksum__pnp_calc_value( bios_data, offset );
|
||||
printf( "\n\n$PnP header at: 0x%4lX\n", offset );
|
||||
printf( "Current checksum: 0x%02X\n", cur_val );
|
||||
printf( "Calculated checksum: 0x%02X\n ", new_val );
|
||||
hits++;
|
||||
}
|
||||
if( hits == 1 && cur_val != new_val ) {
|
||||
printf( "Setting checksum." );
|
||||
chksum__pnp_set_value( bios_data, offset, new_val );
|
||||
}
|
||||
if( hits >= 2 ) {
|
||||
printf( "Warning! Multiple $PnP headers. No checksum set." );
|
||||
}
|
||||
if( hits ) {
|
||||
printf( "\n" );
|
||||
}
|
||||
|
||||
offset = 0L;
|
||||
offset = chksum_bios_get_offset( bios_data, offset );
|
||||
cur_val = chksum_bios_get_value( bios_data, offset );
|
||||
@ -502,3 +533,57 @@ void chksum__pir_set_value( byte* data, long offset, byte value ) {
|
||||
*( data + offset + _PIR_CHKSUM ) = value;
|
||||
}
|
||||
|
||||
|
||||
byte chksum__pnp_calc_value( byte* data, long offset ) {
|
||||
|
||||
int i;
|
||||
int len;
|
||||
byte sum;
|
||||
|
||||
check( offset + _PNP_MINHDR <= MAX_OFFSET, "$PnP header out of bounds" );
|
||||
len = *( data + offset + _PNP_LEN );
|
||||
check( offset + len <= MAX_OFFSET, "$PnP header-length out of bounds" );
|
||||
sum = 0;
|
||||
for( i = 0; i < len; i++ ) {
|
||||
if( i != _PNP_CHKSUM ) {
|
||||
sum = sum + *( data + offset + i );
|
||||
}
|
||||
}
|
||||
sum = -sum;
|
||||
return( sum );
|
||||
}
|
||||
|
||||
|
||||
long chksum__pnp_get_offset( byte* data, long offset ) {
|
||||
|
||||
long result = -1L;
|
||||
|
||||
offset = offset + 0x0F;
|
||||
offset = offset & ~( 0x0F );
|
||||
while( offset + 16 < MAX_OFFSET ) {
|
||||
offset = offset + 16;
|
||||
if( *( data + offset + 0 ) == '$' && \
|
||||
*( data + offset + 1 ) == 'P' && \
|
||||
*( data + offset + 2 ) == 'n' && \
|
||||
*( data + offset + 3 ) == 'P' ) {
|
||||
result = offset;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return( result );
|
||||
}
|
||||
|
||||
|
||||
byte chksum__pnp_get_value( byte* data, long offset ) {
|
||||
|
||||
check( offset + _PNP_CHKSUM <= MAX_OFFSET, "$PnP checksum out of bounds" );
|
||||
return( *( data + offset + _PNP_CHKSUM ) );
|
||||
}
|
||||
|
||||
|
||||
void chksum__pnp_set_value( byte* data, long offset, byte value ) {
|
||||
|
||||
check( offset + _PNP_CHKSUM <= MAX_OFFSET, "$PnP checksum out of bounds" );
|
||||
*( data + offset + _PNP_CHKSUM ) = value;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: rombios.c,v 1.243 2010-01-14 07:04:39 sshwarts Exp $
|
||||
// $Id: rombios.c,v 1.244 2010-01-18 20:04:44 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -143,6 +143,7 @@
|
||||
#define BX_FLOPPY_ON_CNT 37 /* 2 seconds */
|
||||
#define BX_PCIBIOS 1
|
||||
#define BX_APM 1
|
||||
#define BX_PNPBIOS 1
|
||||
|
||||
#define BX_USE_ATADRV 1
|
||||
#define BX_ELTORITO_BOOT 1
|
||||
@ -927,7 +928,7 @@ Bit16u cdrom_boot();
|
||||
|
||||
#endif // BX_ELTORITO_BOOT
|
||||
|
||||
static char bios_cvs_version_string[] = "$Revision: 1.243 $ $Date: 2010-01-14 07:04:39 $";
|
||||
static char bios_cvs_version_string[] = "$Revision: 1.244 $ $Date: 2010-01-18 20:04:44 $";
|
||||
|
||||
#define BIOS_COPYRIGHT_STRING "(c) 2002 MandrakeSoft S.A. Written by Kevin Lawton & the Bochs team."
|
||||
|
||||
@ -1925,6 +1926,9 @@ print_bios_banner()
|
||||
#if BX_PCIBIOS
|
||||
"pcibios "
|
||||
#endif
|
||||
#if BX_PNPBIOS
|
||||
"pnpbios "
|
||||
#endif
|
||||
#if BX_ELTORITO_BOOT
|
||||
"eltorito "
|
||||
#endif
|
||||
@ -10271,13 +10275,53 @@ checksum_out:
|
||||
ret
|
||||
|
||||
|
||||
;; We need a copy of this string, but we are not actually a PnP BIOS,
|
||||
;; so make sure it is *not* aligned, so OSes will not see it if they scan.
|
||||
.align 16
|
||||
#if !BX_PNPBIOS
|
||||
;; Make sure the pnpbios structure is *not* aligned, so OSes will not see it if
|
||||
;; they scan.
|
||||
db 0
|
||||
pnp_string:
|
||||
#endif
|
||||
pnpbios_structure:
|
||||
.ascii "$PnP"
|
||||
db 0x10 ;; version
|
||||
db 0x21 ;; length
|
||||
dw 0x0 ;; control field
|
||||
db 0xd1 ;; checksum
|
||||
dd 0xf0000 ;; event notification flag address
|
||||
dw pnpbios_real ;; real mode 16 bit offset
|
||||
dw 0xf000 ;; real mode 16 bit segment
|
||||
dw pnpbios_prot ;; 16 bit protected mode offset
|
||||
dd 0xf0000 ;; 16 bit protected mode segment base
|
||||
dd 0x0 ;; OEM device identifier
|
||||
dw 0xf000 ;; real mode 16 bit data segment
|
||||
dd 0xf0000 ;; 16 bit protected mode segment base
|
||||
|
||||
pnpbios_prot:
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
jmp pnpbios_code
|
||||
pnpbios_real:
|
||||
push ebp
|
||||
movzx ebp, sp
|
||||
pnpbios_code:
|
||||
mov ax, 8[ebp]
|
||||
cmp ax, #0x60 ;; Get Version and Installation Check
|
||||
jnz pnpbios_fail
|
||||
push ds
|
||||
push di
|
||||
mov ds, 12[bp]
|
||||
mov di, 10[bp]
|
||||
mov ax, #0x0101
|
||||
mov [di], ax
|
||||
pop di
|
||||
pop ds
|
||||
xor ax, ax ;; SUCCESS
|
||||
jmp pnpbios_exit
|
||||
pnpbios_fail:
|
||||
mov ax, #0x82 ;; FUNCTION_NOT_SUPPORTED
|
||||
pnpbios_exit:
|
||||
pop ebp
|
||||
retf
|
||||
|
||||
rom_scan:
|
||||
;; Scan for existence of valid expansion ROMS.
|
||||
@ -10322,7 +10366,7 @@ block_count_rounded:
|
||||
;; That should stop it grabbing INT 19h; we will use its BEV instead.
|
||||
mov ax, #0xf000
|
||||
mov es, ax
|
||||
lea di, pnp_string
|
||||
lea di, pnpbios_structure
|
||||
|
||||
mov bp, sp ;; Call ROM init routine using seg:off on stack
|
||||
db 0xff ;; call_far ss:[bp+0]
|
||||
@ -10355,7 +10399,7 @@ block_count_rounded:
|
||||
;; Point ES:DI at "$PnP", which tells the ROM that we are a PnP BIOS.
|
||||
mov bx, #0xf000
|
||||
mov es, bx
|
||||
lea di, pnp_string
|
||||
lea di, pnpbios_structure
|
||||
/* jump to BCV function entry pointer */
|
||||
mov bp, sp ;; Call ROM BCV routine using seg:off on stack
|
||||
db 0xff ;; call_far ss:[bp+0]
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: rombios32.c,v 1.62 2010-01-14 07:04:40 sshwarts Exp $
|
||||
// $Id: rombios32.c,v 1.63 2010-01-18 20:04:44 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 32 bit Bochs BIOS init code
|
||||
@ -574,7 +574,7 @@ void setup_mtrr(void)
|
||||
/* Mark 3-4GB as UC, anything not specified defaults to WB */
|
||||
wrmsr_smp(MTRRphysBase_MSR(0), 0xc0000000 | MTRR_MEMTYPE_UC);
|
||||
/* Make sure no reserved bit set to '1 in MTRRphysMask_MSR */
|
||||
wrmsr_smp(MTRRphysMask_MSR(0), (uint32_t)(~(0x20000000 - 1)) | 0x800);
|
||||
wrmsr_smp(MTRRphysMask_MSR(0), (uint32_t)(~(0x40000000 - 1)) | 0x800);
|
||||
wrmsr_smp(MSR_MTRRdefType, 0xc00 | MTRR_MEMTYPE_WB);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user