Skip to content

Commit

Permalink
Make the getmemsize() prototype available in memsizes.h, for code that
Browse files Browse the repository at this point in the history
doesn't want to go to the hassle of processing a full memory map.
  • Loading branch information
Michael Brown committed Jan 14, 2007
1 parent c1fd6e8 commit b9f9985
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 44 deletions.
19 changes: 5 additions & 14 deletions src/arch/i386/firmware/pcbios/memmap.c
Expand Up @@ -20,6 +20,7 @@
#include <errno.h>
#include <realmode.h>
#include <bios.h>
#include <memsizes.h>
#include <gpxe/memmap.h>

/**
Expand Down Expand Up @@ -51,19 +52,6 @@ struct e820_entry {
static struct e820_entry __data16 ( e820buf );
#define e820buf __use_data16 ( e820buf )

/**
* Get size of base memory from BIOS free base memory counter
*
* @ret basemem Base memory size, in kB
*/
static unsigned int basememsize ( void ) {
uint16_t basemem;

get_real ( basemem, BDA_SEG, 0x0013 );
DBG ( "Base memory size %dkB\n", basemem );
return basemem;
}

/**
* Get size of extended memory via INT 15,e801
*
Expand Down Expand Up @@ -120,8 +108,11 @@ static unsigned int extmemsize_88 ( void ) {
* Get size of extended memory
*
* @ret extmem Extended memory size, in kB
*
* Note that this is only an approximation; for an accurate picture,
* use the E820 memory map obtained via get_memmap();
*/
static unsigned int extmemsize ( void ) {
unsigned int extmemsize ( void ) {
unsigned int extmem;

/* Try INT 15,e801 first, then fall back to INT 15,88 */
Expand Down
1 change: 1 addition & 0 deletions src/arch/i386/image/nbi.c
Expand Up @@ -2,6 +2,7 @@
#include <assert.h>
#include <realmode.h>
#include <gateA20.h>
#include <memsizes.h>
#include <gpxe/uaccess.h>
#include <gpxe/segment.h>
#include <gpxe/image.h>
Expand Down
41 changes: 11 additions & 30 deletions src/arch/i386/include/memsizes.h
@@ -1,36 +1,17 @@
#ifndef MEMSIZES_H
#define MEMSIZES_H
#ifndef _MEMSIZES_H
#define _MEMSIZES_H

#warning "This header is no longer functional; use memmap.h instead"
#include <basemem.h>

/*
* These structures seem to be very i386 (and, in fact, PCBIOS)
* specific, so I've moved them out of etherboot.h.
/**
* Get size of base memory from BIOS free base memory counter
*
* @ret basemem Base memory size, in kB
*/
static inline unsigned int basememsize ( void ) {
return get_fbms();
}

struct e820entry {
uint64_t addr;
uint64_t size;
uint32_t type;
#define E820_RAM 1
#define E820_RESERVED 2
#define E820_ACPI 3 /* usable as RAM once ACPI tables have been read */
#define E820_NVS 4
} __attribute__ (( packed ));
#define E820ENTRY_SIZE 20
#define E820MAX 32
extern unsigned int extmemsize ( void );

struct meminfo {
uint16_t basememsize;
uint16_t pad;
uint32_t memsize;
uint32_t map_count;
struct e820entry map[E820MAX];
} __attribute__ (( packed ));

extern struct meminfo meminfo;

extern void get_memsizes ( void );

#endif /* MEMSIZES_H */
#endif /* _MEMSIZES_H */

0 comments on commit b9f9985

Please sign in to comment.