- Fix the definition of the linuxbios table so all of the compilers

will generate the struct lb_memory_range the same.
- Add a few pci_ids.
- Small readabiltiy clean ups to debug_dev


git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1818 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Eric Biederman
2004-12-10 20:50:43 +00:00
parent a7dd869706
commit ec01aa98d0
7 changed files with 144 additions and 84 deletions

View File

@@ -9,6 +9,22 @@
#include <stdlib.h>
#include <string.h>
static inline uint64_t unpack_lb64(struct lb_uint64 value)
{
uint64_t result;
result = value.hi;
result = (result << 32) + value.lo;
return result;
}
static inline struct lb_uint64 pack_lb64(uint64_t value)
{
struct lb_uint64 result;
result.lo = (value >> 0) & 0xffffffff;
result.hi = (value >> 32) & 0xffffffff;
return result;
}
/* Maximum physical address we can use for the linuxBIOS bounce buffer.
*/
#ifndef MAX_ADDR
@@ -120,14 +136,14 @@ static unsigned long get_bounce_buffer(struct lb_memory *mem)
unsigned long tbuffer;
if (mem->map[i].type != LB_MEM_RAM)
continue;
if (mem->map[i].start > MAX_ADDR)
if (unpack_lb64(mem->map[i].start) > MAX_ADDR)
continue;
if (mem->map[i].size < lb_size)
if (unpack_lb64(mem->map[i].size) < lb_size)
continue;
mstart = mem->map[i].start;
mstart = unpack_lb64(mem->map[i].start);
msize = MAX_ADDR - mstart +1;
if (msize > mem->map[i].size)
msize = mem->map[i].size;
if (msize > unpack_lb64(mem->map[i].size))
msize = unpack_lb64(mem->map[i].size);
mend = mstart + msize;
tbuffer = mend - lb_size;
if (tbuffer < buffer)
@@ -222,8 +238,8 @@ static int valid_area(struct lb_memory *mem, unsigned long buffer,
uint64_t mstart, mend;
uint32_t mtype;
mtype = mem->map[i].type;
mstart = mem->map[i].start;
mend = mstart + mem->map[i].size;
mstart = unpack_lb64(mem->map[i].start);
mend = mstart + unpack_lb64(mem->map[i].size);
if ((mtype == LB_MEM_RAM) && (start < mend) && (end > mstart)) {
break;
}
@@ -236,8 +252,8 @@ static int valid_area(struct lb_memory *mem, unsigned long buffer,
uint64_t mstart, mend;
uint32_t mtype;
mtype = mem->map[i].type;
mstart = mem->map[i].start;
mend = mstart + mem->map[i].size;
mstart = unpack_lb64(mem->map[i].start);
mend = mstart + unpack_lb64(mem->map[i].size);
printk_err(" [0x%016lx, 0x%016lx) %s\n",
(unsigned long)mstart,
(unsigned long)mend,