This one is going to break all your changes, but fix up a lot of code.

* exchange [u]intXX_t with [us]XX types as we agreed upon.
* drop unneeded btext.h for now
* fix license header in device/pci_ops.c
* fix printk in device/pci_ops.c
* add signed types to arch/types.h
* fix include/elf.h (remove glibc-ism)
* add appropriate copyright notice to lib/delay.c
* add pciconf.h header


Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Ronald G. Minnich <rminnich@gmail.com>



git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@144 f3766cd6-281f-0410-b1cd-43a5c92072e9
This commit is contained in:
Stefan Reinauer 2007-02-27 14:03:20 +00:00
commit be31c46733
19 changed files with 189 additions and 258 deletions

View file

@ -89,7 +89,7 @@ void cardbus_read_resources(device_t dev)
{
resource_t moving_base, moving_limit, moving;
unsigned long type;
uint16_t ctl;
u16 ctl;
unsigned long index;
/* See if needs a card control registers base address */
@ -156,7 +156,7 @@ void cardbus_read_resources(device_t dev)
void cardbus_enable_resources(device_t dev)
{
uint16_t ctrl;
u16 ctrl;
ctrl = pci_read_config16(dev, PCI_CB_BRIDGE_CONTROL);
ctrl |= (dev->link[0].bridge_ctrl & (
PCI_BRIDGE_CTL_PARITY |
@ -185,8 +185,8 @@ unsigned int cardbus_scan_bus(struct bus *bus,
unsigned int cardbus_scan_bridge(device_t dev, unsigned int max)
{
struct bus *bus;
uint32_t buses;
uint16_t cr;
u32 buses;
u16 cr;
printk_spew("%s for %s\n", __func__, dev_path(dev));

View file

@ -115,8 +115,8 @@ struct ht_link {
static int ht_setup_link(struct ht_link *prev, device_t dev, unsigned pos)
{
static const uint8_t link_width_to_pow2[]= { 3, 4, 0, 5, 1, 2, 0, 0 };
static const uint8_t pow2_to_link_width[] = { 0x7, 4, 5, 0, 1, 3 };
static const u8 link_width_to_pow2[]= { 3, 4, 0, 5, 1, 2, 0, 0 };
static const u8 pow2_to_link_width[] = { 0x7, 4, 5, 0, 1, 3 };
struct ht_link cur[1];
unsigned present_width_cap, upstream_width_cap;
unsigned present_freq_cap, upstream_freq_cap;
@ -322,7 +322,7 @@ static void ht_collapse_early_enumeration(struct bus *bus, unsigned offset_uniti
/* Check if is already collapsed */
if((!offset_unitid)|| (offset_unitid && (!((HT_CHAIN_END_UNITID_BASE == 0) && (HT_CHAIN_END_UNITID_BASE <HT_CHAIN_UNITID_BASE))))) {
struct device dummy;
uint32_t id;
u32 id;
dummy.bus = bus;
dummy.path.type = DEVICE_PATH_PCI;
dummy.path.u.pci.devfn = PCI_DEVFN(0, 0);
@ -338,7 +338,7 @@ static void ht_collapse_early_enumeration(struct bus *bus, unsigned offset_uniti
*/
for(devfn = PCI_DEVFN(1, 0); devfn <= 0xff; devfn += 8) {
struct device dummy;
uint32_t id;
u32 id;
unsigned pos, flags;
dummy.bus = bus;
dummy.path.type = DEVICE_PATH_PCI;
@ -379,7 +379,7 @@ unsigned int hypertransport_scan_chain(struct bus *bus,
#if HT_CHAIN_END_UNITID_BASE < HT_CHAIN_UNITID_BASE
//let't record the device of last ht device, So we can set the Unitid to HT_CHAIN_END_UNITID_BASE
unsigned real_last_unitid;
uint8_t real_last_pos;
u8 real_last_pos;
device_t real_last_dev;
#endif
@ -402,8 +402,8 @@ unsigned int hypertransport_scan_chain(struct bus *bus,
last_unitid = min_unitid -1;
next_unitid = min_unitid;
do {
uint8_t pos;
uint16_t flags;
u8 pos;
u16 flags;
unsigned count, static_count;
unsigned ctrl;
@ -520,7 +520,7 @@ unsigned int hypertransport_scan_chain(struct bus *bus,
#if HT_CHAIN_END_UNITID_BASE < HT_CHAIN_UNITID_BASE
if(offset_unitid && (ht_dev_num>0)) {
uint16_t flags;
u16 flags;
int i;
device_t last_func = 0;
flags = pci_read_config16(real_last_dev, real_last_pos + PCI_CAP_FLAGS);

View file

@ -56,9 +56,9 @@
#include <device/cardbus.h>
#endif
uint8_t pci_moving_config8(struct device *dev, unsigned reg)
u8 pci_moving_config8(struct device *dev, unsigned reg)
{
uint8_t value, ones, zeroes;
u8 value, ones, zeroes;
value = pci_read_config8(dev, reg);
pci_write_config8(dev, reg, 0xff);
@ -72,9 +72,9 @@ uint8_t pci_moving_config8(struct device *dev, unsigned reg)
return ones ^ zeroes;
}
uint16_t pci_moving_config16(struct device *dev, unsigned reg)
u16 pci_moving_config16(struct device *dev, unsigned reg)
{
uint16_t value, ones, zeroes;
u16 value, ones, zeroes;
value = pci_read_config16(dev, reg);
pci_write_config16(dev, reg, 0xffff);
@ -88,9 +88,9 @@ uint16_t pci_moving_config16(struct device *dev, unsigned reg)
return ones ^ zeroes;
}
uint32_t pci_moving_config32(struct device *dev, unsigned reg)
u32 pci_moving_config32(struct device *dev, unsigned reg)
{
uint32_t value, ones, zeroes;
u32 value, ones, zeroes;
value = pci_read_config32(dev, reg);
pci_write_config32(dev, reg, 0xffffffff);
@ -398,11 +398,11 @@ static void pci_bridge_read_bases(struct device *dev)
resource_t moving_base, moving_limit, moving;
/* See if the bridge I/O resources are implemented */
moving_base = ((uint32_t)pci_moving_config8(dev, PCI_IO_BASE)) << 8;
moving_base |= ((uint32_t)pci_moving_config16(dev, PCI_IO_BASE_UPPER16)) << 16;
moving_base = ((u32)pci_moving_config8(dev, PCI_IO_BASE)) << 8;
moving_base |= ((u32)pci_moving_config16(dev, PCI_IO_BASE_UPPER16)) << 16;
moving_limit = ((uint32_t)pci_moving_config8(dev, PCI_IO_LIMIT)) << 8;
moving_limit |= ((uint32_t)pci_moving_config16(dev, PCI_IO_LIMIT_UPPER16)) << 16;
moving_limit = ((u32)pci_moving_config8(dev, PCI_IO_LIMIT)) << 8;
moving_limit |= ((u32)pci_moving_config16(dev, PCI_IO_LIMIT_UPPER16)) << 16;
moving = moving_base & moving_limit;
@ -428,8 +428,8 @@ static void pci_bridge_read_bases(struct device *dev)
/* See if the bridge mem resources are implemented */
moving_base = ((uint32_t)pci_moving_config16(dev, PCI_MEMORY_BASE)) << 16;
moving_limit = ((uint32_t)pci_moving_config16(dev, PCI_MEMORY_LIMIT)) << 16;
moving_base = ((u32)pci_moving_config16(dev, PCI_MEMORY_BASE)) << 16;
moving_limit = ((u32)pci_moving_config16(dev, PCI_MEMORY_LIMIT)) << 16;
moving = moving_base & moving_limit;
@ -559,7 +559,7 @@ void pci_dev_set_resources(struct device *dev)
{
struct resource *resource, *last;
unsigned link;
uint8_t line;
u8 line;
last = &dev->resource[dev->resources];
@ -594,7 +594,7 @@ void pci_dev_set_resources(struct device *dev)
void pci_dev_enable_resources(struct device *dev)
{
const struct pci_operations *ops;
uint16_t command;
u16 command;
/* Set the subsystem vendor and device id for mainboard devices */
ops = ops_pci(dev);
@ -619,7 +619,7 @@ void pci_dev_enable_resources(struct device *dev)
void pci_bus_enable_resources(struct device *dev)
{
uint16_t ctrl;
u16 ctrl;
/* enable IO in command register if there is VGA card
* connected with (even it does not claim IO resource) */
if (dev->link[0].bridge_ctrl & PCI_BRIDGE_CTL_VGA)
@ -899,8 +899,8 @@ static struct device *pci_scan_get_dev(struct device **list, unsigned int devfn)
*/
struct device * pci_probe_dev(struct device * dev, struct bus *bus, unsigned devfn)
{
uint32_t id, class;
uint8_t hdr_type;
u32 id, class;
u8 hdr_type;
/* Detect if a device is present */
if (!dev) {
@ -1112,8 +1112,8 @@ unsigned int do_pci_scan_bridge(struct device *dev, unsigned int max,
unsigned min_devfn, unsigned max_devfn, unsigned int max))
{
struct bus *bus;
uint32_t buses;
uint16_t cr;
u32 buses;
u16 cr;
printk(BIOS_SPEW,"%s for %s\n", __func__, dev_path(dev));

View file

@ -1,19 +1,19 @@
/*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
*/
#include <console/console.h>
#include <arch/pciconf.h>
#include <device/pci.h>
@ -27,44 +27,44 @@ static struct bus *get_pbus(struct device * dev)
pbus = pbus->dev->bus;
}
if (!pbus || !pbus->dev || !pbus->dev->ops || !pbus->dev->ops->ops_pci_bus) {
printk_alert("%s Cannot find pci bus operations", dev_path(dev));
printk(BIOS_ALERT,"%s Cannot find pci bus operations", dev_path(dev));
die("");
for(;;);
}
return pbus;
}
uint8_t pci_read_config8(struct device * dev, unsigned where)
u8 pci_read_config8(struct device * dev, unsigned where)
{
struct bus *pbus = get_pbus(dev);
return ops_pci_bus(pbus)->read8(pbus, dev->bus->secondary, dev->path.u.pci.devfn, where);
}
uint16_t pci_read_config16(struct device * dev, unsigned where)
u16 pci_read_config16(struct device * dev, unsigned where)
{
struct bus *pbus = get_pbus(dev);
return ops_pci_bus(pbus)->read16(pbus, dev->bus->secondary, dev->path.u.pci.devfn, where);
}
uint32_t pci_read_config32(struct device * dev, unsigned where)
u32 pci_read_config32(struct device * dev, unsigned where)
{
struct bus *pbus = get_pbus(dev);
return ops_pci_bus(pbus)->read32(pbus, dev->bus->secondary, dev->path.u.pci.devfn, where);
}
void pci_write_config8(struct device * dev, unsigned where, uint8_t val)
void pci_write_config8(struct device * dev, unsigned where, u8 val)
{
struct bus *pbus = get_pbus(dev);
ops_pci_bus(pbus)->write8(pbus, dev->bus->secondary, dev->path.u.pci.devfn, where, val);
}
void pci_write_config16(struct device * dev, unsigned where, uint16_t val)
void pci_write_config16(struct device * dev, unsigned where, u16 val)
{
struct bus *pbus = get_pbus(dev);
ops_pci_bus(pbus)->write16(pbus, dev->bus->secondary, dev->path.u.pci.devfn, where, val);
}
void pci_write_config32(struct device * dev, unsigned where, uint32_t val)
void pci_write_config32(struct device * dev, unsigned where, u32 val)
{
struct bus *pbus = get_pbus(dev);
ops_pci_bus(pbus)->write32(pbus, dev->bus->secondary, dev->path.u.pci.devfn, where, val);

View file

@ -27,13 +27,13 @@
/* PNP fundamental operations */
void pnp_write_config(device_t dev, uint8_t reg, uint8_t value)
void pnp_write_config(device_t dev, u8 reg, u8 value)
{
outb(reg, dev->path.u.pnp.port);
outb(value, dev->path.u.pnp.port + 1);
}
uint8_t pnp_read_config(device_t dev, uint8_t reg)
u8 pnp_read_config(device_t dev, u8 reg)
{
outb(reg, dev->path.u.pnp.port);
return inb(dev->path.u.pnp.port + 1);

View file

@ -74,35 +74,35 @@ int smbus_recv_byte(device_t dev)
{
return ops_smbus_bus(get_pbus_smbus(dev))->recv_byte(dev);
}
int smbus_send_byte(device_t dev, uint8_t byte)
int smbus_send_byte(device_t dev, u8 byte)
{
return ops_smbus_bus(get_pbus_smbus(dev))->send_byte(dev, byte);
}
int smbus_read_byte(device_t dev, uint8_t addr)
int smbus_read_byte(device_t dev, u8 addr)
{
return ops_smbus_bus(get_pbus_smbus(dev))->read_byte(dev, addr);
}
int smbus_write_byte(device_t dev, uint8_t addr, uint8_t val)
int smbus_write_byte(device_t dev, u8 addr, u8 val)
{
return ops_smbus_bus(get_pbus_smbus(dev))->write_byte(dev, addr, val);
}
int smbus_read_word(device_t dev, uint8_t addr)
int smbus_read_word(device_t dev, u8 addr)
{
return ops_smbus_bus(get_pbus_smbus(dev))->read_word(dev, addr);
}
int smbus_write_word(device_t dev, uint8_t addr, uint16_t val)
int smbus_write_word(device_t dev, u8 addr, u16 val)
{
return ops_smbus_bus(get_pbus_smbus(dev))->write_word(dev, addr, val);
}
int smbus_process_call(device_t dev, uint8_t cmd, uint16_t data)
int smbus_process_call(device_t dev, u8 cmd, u16 data)
{
return ops_smbus_bus(get_pbus_smbus(dev))->process_call(dev, cmd, data);
}
int smbus_block_read(device_t dev, uint8_t cmd, uint8_t bytes, uint8_t *buffer)
int smbus_block_read(device_t dev, u8 cmd, u8 bytes, u8 *buffer)
{
return ops_smbus_bus(get_pbus_smbus(dev))->block_read(dev, cmd, bytes, buffer);
}
int smbus_block_write(device_t dev, uint8_t cmd, uint8_t bytes, const uint8_t *buffer)
int smbus_block_write(device_t dev, u8 cmd, u8 bytes, const u8 *buffer)
{
return ops_smbus_bus(get_pbus_smbus(dev))->block_write(dev, cmd, bytes, buffer);
}

View file

@ -25,8 +25,8 @@ static void stage1_superio_setup(void)
{
struct property *superio;
unsigned value;
uint32_t dword;
uint8_t byte;
u32 dword;
u8 byte;
superio = get_property(dtb, "ck804");
/* read dev 1 , function 0, of the superio, */

View file

@ -1,88 +0,0 @@
/*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
* This file describes the structure passed from the BootX application
* (for MacOS) when it is used to boot Linux.
*
* Written by Benjamin Herrenschmidt.
*
* Move to LinuxBIOS by LYH yhlu@tyan.com
*
*/
#ifndef _BTEXT_H__
#define _BTEXT_H__
#define u32 uint32_t
#define u16 uint16_t
#define u8 uint8_t
/* Here are the boot informations that are passed to the bootstrap
* Note that the kernel arguments and the device tree are appended
* at the end of this structure. */
typedef struct boot_infos
{
/* NEW (vers. 2) this holds the current _logical_ base addr of
the frame buffer (for use by early boot message) */
u8* logicalDisplayBase;
/* Some infos about the current MacOS display */
u32 dispDeviceRect[4]; /* left,top,right,bottom */
u32 dispDeviceDepth; /* (8, 16 or 32) */
u8* dispDeviceBase; /* base address (physical) */
u32 dispDeviceRowBytes; /* rowbytes (in bytes) */
u32 dispDeviceColorsOffset; /* Colormap (8 bits only) or 0 (*) */
/* The framebuffer size (optional, currently 0) */
u32 frameBufferSize; /* Represents a max size, can be 0. */
} boot_infos_t;
/* (*) The format of the colormap is 256 * 3 * 2 bytes. Each color index is represented
* by 3 short words containing a 16 bits (unsigned) color component.
* Later versions may contain the gamma table for direct-color devices here.
*/
#define BOOTX_COLORTABLE_SIZE (256UL*3UL*2UL)
/*
* Definitions for using the procedures in btext.c.
*
* Benjamin Herrenschmidt <benh@kernel.crashing.org>
*/
extern void btext_clearscreen(void);
extern boot_infos_t disp_bi;
extern u32 boot_text_mapped;
void btext_setup_display(u32 width, u32 height, u32 depth, u32 pitch,
unsigned long address);
void map_boot_text(void);
void btext_update_display(unsigned long phys, u32 width, u32 height,
u32 depth, u32 pitch);
void btext_drawchar(char c);
void btext_drawstring(const char *str);
void btext_drawhex(u32 v);
#endif /* _BTEXT_H */

View file

@ -0,0 +1,14 @@
#ifndef PCI_CONF_REG_INDEX
// These are defined in the PCI spec, and hence are theoretically
// inclusive of ANYTHING that uses a PCI bus.
#define PCI_CONF_REG_INDEX 0xcf8
#define PCI_CONF_REG_DATA 0xcfc
#if PCI_IO_CFG_EXT == 0
#define CONFIG_ADDR(bus,devfn,where) (((bus) << 16) | ((devfn) << 8) | (where))
#else
#define CONFIG_ADDR(bus,devfn,where) (((bus) << 16) | ((devfn) << 8) | (where & 0xff) | ((where & 0xf00)<<16) )
#endif
#endif

View file

@ -10,4 +10,9 @@ typedef unsigned int u32;
typedef unsigned short u16;
typedef unsigned char u8;
typedef signed long long s64;
typedef signed int s32;
typedef signed short s16;
typedef signed char s8;
#endif

View file

@ -22,8 +22,8 @@
#include <device/pnp_def.h>
/* Primitive pnp resource manipulation */
void pnp_write_config(device_t dev, uint8_t reg, uint8_t value);
uint8_t pnp_read_config(device_t dev, uint8_t reg);
void pnp_write_config(device_t dev, u8 reg, u8 value);
u8 pnp_read_config(device_t dev, u8 reg);
void pnp_set_logical_device(device_t dev);
void pnp_set_enable(device_t dev, int enable);
int pnp_read_enable(device_t dev);

View file

@ -27,14 +27,14 @@ struct smbus_bus_operations {
int (*quick_read) (device_t dev);
int (*quick_write) (device_t dev);
int (*recv_byte) (device_t dev);
int (*send_byte) (device_t dev, uint8_t value);
int (*read_byte) (device_t dev, uint8_t addr);
int (*write_byte) (device_t dev, uint8_t addr, uint8_t value);
int (*read_word) (device_t dev, uint8_t addr);
int (*write_word) (device_t dev, uint8_t addr, uint16_t value);
int (*process_call)(device_t dev, uint8_t cmd, uint16_t data);
int (*block_read) (device_t dev, uint8_t cmd, uint8_t bytes, uint8_t *buffer);
int (*block_write) (device_t dev, uint8_t cmd, uint8_t bytes, const uint8_t *buffer);
int (*send_byte) (device_t dev, u8 value);
int (*read_byte) (device_t dev, u8 addr);
int (*write_byte) (device_t dev, u8 addr, u8 value);
int (*read_word) (device_t dev, u8 addr);
int (*write_word) (device_t dev, u8 addr, u16 value);
int (*process_call)(device_t dev, u8 cmd, u16 data);
int (*block_read) (device_t dev, u8 cmd, u8 bytes, u8 *buffer);
int (*block_write) (device_t dev, u8 cmd, u8 bytes, const u8 *buffer);
};
static inline const struct smbus_bus_operations *ops_smbus_bus(struct bus *bus)
@ -52,14 +52,14 @@ int smbus_set_link(device_t dev);
int smbus_quick_read(device_t dev);
int smbus_quick_write(device_t dev);
int smbus_recv_byte(device_t dev);
int smbus_send_byte(device_t dev, uint8_t byte);
int smbus_read_byte(device_t dev, uint8_t addr);
int smbus_write_byte(device_t dev, uint8_t addr, uint8_t val);
int smbus_read_word(device_t dev, uint8_t addr);
int smbus_write_word(device_t dev, uint8_t addr, uint16_t val);
int smbus_process_call(device_t dev, uint8_t cmd, uint16_t data);
int smbus_block_read(device_t dev, uint8_t cmd, uint8_t bytes, uint8_t *buffer);
int smbus_block_write(device_t dev, uint8_t cmd, uint8_t bytes, const uint8_t *buffer);
int smbus_send_byte(device_t dev, u8 byte);
int smbus_read_byte(device_t dev, u8 addr);
int smbus_write_byte(device_t dev, u8 addr, u8 val);
int smbus_read_word(device_t dev, u8 addr);
int smbus_write_word(device_t dev, u8 addr, u16 val);
int smbus_process_call(device_t dev, u8 cmd, u16 data);
int smbus_block_read(device_t dev, u8 cmd, u8 bytes, u8 *buffer);
int smbus_block_write(device_t dev, u8 cmd, u8 bytes, const u8 *buffer);
#endif /* DEVICE_SMBUS_H */

View file

@ -23,45 +23,43 @@
#ifndef _ELF_H
#define _ELF_H 1
#include <arch/types.h>
#include <stddef.h>
#include <arch/elf.h>
#include <stdint.h>
__BEGIN_DECLS
/* Standard ELF types. */
/* Type for a 16-bit quantity. */
typedef uint16_t Elf32_Half;
typedef uint16_t Elf64_Half;
typedef u16 Elf32_Half;
typedef u16 Elf64_Half;
/* Types for signed and unsigned 32-bit quantities. */
typedef uint32_t Elf32_Word;
typedef int32_t Elf32_Sword;
typedef uint32_t Elf64_Word;
typedef int32_t Elf64_Sword;
typedef u32 Elf32_Word;
typedef s32 Elf32_Sword;
typedef u32 Elf64_Word;
typedef s32 Elf64_Sword;
/* Types for signed and unsigned 64-bit quantities. */
typedef uint64_t Elf32_Xword;
typedef int64_t Elf32_Sxword;
typedef uint64_t Elf64_Xword;
typedef int64_t Elf64_Sxword;
typedef u64 Elf32_Xword;
typedef s64 Elf32_Sxword;
typedef u64 Elf64_Xword;
typedef s64 Elf64_Sxword;
/* Type of addresses. */
typedef uint32_t Elf32_Addr;
typedef uint64_t Elf64_Addr;
typedef u32 Elf32_Addr;
typedef u64 Elf64_Addr;
/* Type of file offsets. */
typedef uint32_t Elf32_Off;
typedef uint64_t Elf64_Off;
typedef u32 Elf32_Off;
typedef u64 Elf64_Off;
/* Type for section indices, which are 16-bit quantities. */
typedef uint16_t Elf32_Section;
typedef uint16_t Elf64_Section;
typedef u16 Elf32_Section;
typedef u16 Elf64_Section;
/* Type of symbol indices. */
typedef uint32_t Elf32_Symndx;
typedef uint64_t Elf64_Symndx;
typedef u32 Elf32_Symndx;
typedef u64 Elf64_Symndx;
/* The ELF file header. This appears at the start of every ELF file. */

View file

@ -39,9 +39,9 @@
#define ELF_HEAD_SIZE (8*1024)
#define ELF_BOOT_MAGIC 0x0E1FB007
typedef uint16_t Elf_Half;
typedef uint32_t Elf_Word;
typedef uint64_t Elf_Xword;
typedef u16 Elf_Half;
typedef u32 Elf_Word;
typedef u64 Elf_Xword;
typedef struct
{

View file

@ -52,7 +52,7 @@
/* Since LinuxBIOS is usually compiled 32bit, gcc will align 64bit
* types to 32bit boundaries. If the LinuxBIOS table is dumped on a
* 64bit system, a uint64_t would be aligned to 64bit boundaries,
* 64bit system, a u64 would be aligned to 64bit boundaries,
* breaking the table format.
*
* lb_uint64 will keep 64bit LinuxBIOS table values aligned to 32bit
@ -63,19 +63,19 @@
*/
struct lb_uint64 {
uint32_t lo;
uint32_t hi;
u32 lo;
u32 hi;
};
static inline uint64_t unpack_lb64(struct lb_uint64 value)
static inline u64 unpack_lb64(struct lb_uint64 value)
{
uint64_t result;
u64 result;
result = value.hi;
result = (result << 32) + value.lo;
return result;
}
static inline struct lb_uint64 pack_lb64(uint64_t value)
static inline struct lb_uint64 pack_lb64(u64 value)
{
struct lb_uint64 result;
result.lo = (value >> 0) & 0xffffffff;
@ -87,12 +87,12 @@ static inline struct lb_uint64 pack_lb64(uint64_t value)
struct lb_header
{
uint8_t signature[4]; /* LBIO */
uint32_t header_bytes;
uint32_t header_checksum;
uint32_t table_bytes;
uint32_t table_checksum;
uint32_t table_entries;
u8 signature[4]; /* LBIO */
u32 header_bytes;
u32 header_checksum;
u32 table_bytes;
u32 table_checksum;
u32 table_entries;
};
/* Every entry in the boot enviroment list will correspond to a boot
@ -102,8 +102,8 @@ struct lb_header
* forward compatibility with records not yet defined.
*/
struct lb_record {
uint32_t tag; /* tag ID */
uint32_t size; /* size of record (in bytes) */
u32 tag; /* tag ID */
u32 size; /* size of record (in bytes) */
};
#define LB_TAG_UNUSED 0x0000
@ -113,32 +113,32 @@ struct lb_record {
struct lb_memory_range {
struct lb_uint64 start;
struct lb_uint64 size;
uint32_t type;
u32 type;
#define LB_MEM_RAM 1 /* Memory anyone can use */
#define LB_MEM_RESERVED 2 /* Don't use this memory region */
#define LB_MEM_TABLE 16 /* Ram configuration tables are kept in */
};
struct lb_memory {
uint32_t tag;
uint32_t size;
u32 tag;
u32 size;
struct lb_memory_range map[0];
};
#define LB_TAG_HWRPB 0x0002
struct lb_hwrpb {
uint32_t tag;
uint32_t size;
uint64_t hwrpb;
u32 tag;
u32 size;
u64 hwrpb;
};
#define LB_TAG_MAINBOARD 0x0003
struct lb_mainboard {
uint32_t tag;
uint32_t size;
uint8_t vendor_idx;
uint8_t part_number_idx;
uint8_t strings[0];
u32 tag;
u32 size;
u8 vendor_idx;
u8 part_number_idx;
u8 strings[0];
};
#define LB_TAG_VERSION 0x0004
@ -152,18 +152,18 @@ struct lb_mainboard {
#define LB_TAG_LINKER 0x000c
#define LB_TAG_ASSEMBLER 0x000d
struct lb_string {
uint32_t tag;
uint32_t size;
uint8_t string[0];
u32 tag;
u32 size;
u8 string[0];
};
/* The following structures are for the cmos definitions table */
#define LB_TAG_CMOS_OPTION_TABLE 200
/* cmos header record */
struct cmos_option_table {
uint32_t tag; /* CMOS definitions table type */
uint32_t size; /* size of the entire table */
uint32_t header_length; /* length of header */
u32 tag; /* CMOS definitions table type */
u32 size; /* size of the entire table */
u32 header_length; /* length of header */
};
/* cmos entry record
@ -175,14 +175,14 @@ struct cmos_option_table {
*/
#define LB_TAG_OPTION 201
struct cmos_entries {
uint32_t tag; /* entry type */
uint32_t size; /* length of this record */
uint32_t bit; /* starting bit from start of image */
uint32_t length; /* length of field in bits */
uint32_t config; /* e=enumeration, h=hex, r=reserved */
uint32_t config_id; /* a number linking to an enumeration record */
u32 tag; /* entry type */
u32 size; /* length of this record */
u32 bit; /* starting bit from start of image */
u32 length; /* length of field in bits */
u32 config; /* e=enumeration, h=hex, r=reserved */
u32 config_id; /* a number linking to an enumeration record */
#define CMOS_MAX_NAME_LENGTH 32
uint8_t name[CMOS_MAX_NAME_LENGTH]; /* name of entry in ascii,
u8 name[CMOS_MAX_NAME_LENGTH]; /* name of entry in ascii,
variable length int aligned */
};
@ -193,12 +193,12 @@ struct cmos_entries {
*/
#define LB_TAG_OPTION_ENUM 202
struct cmos_enums {
uint32_t tag; /* enumeration type */
uint32_t size; /* length of this record */
uint32_t config_id; /* a number identifying the config id */
uint32_t value; /* the value associated with the text */
u32 tag; /* enumeration type */
u32 size; /* length of this record */
u32 config_id; /* a number identifying the config id */
u32 value; /* the value associated with the text */
#define CMOS_MAX_TEXT_LENGTH 32
uint8_t text[CMOS_MAX_TEXT_LENGTH]; /* enum description in ascii,
u8 text[CMOS_MAX_TEXT_LENGTH]; /* enum description in ascii,
variable length int aligned */
};
@ -207,25 +207,25 @@ struct cmos_enums {
*/
#define LB_TAG_OPTION_DEFAULTS 203
struct cmos_defaults {
uint32_t tag; /* default type */
uint32_t size; /* length of this record */
uint32_t name_length; /* length of the following name field */
uint8_t name[CMOS_MAX_NAME_LENGTH]; /* name identifying the default */
u32 tag; /* default type */
u32 size; /* length of this record */
u32 name_length; /* length of the following name field */
u8 name[CMOS_MAX_NAME_LENGTH]; /* name identifying the default */
#define CMOS_IMAGE_BUFFER_SIZE 128
uint8_t default_set[CMOS_IMAGE_BUFFER_SIZE]; /* default settings */
u8 default_set[CMOS_IMAGE_BUFFER_SIZE]; /* default settings */
};
#define LB_TAG_OPTION_CHECKSUM 204
struct cmos_checksum {
uint32_t tag;
uint32_t size;
u32 tag;
u32 size;
/* In practice everything is byte aligned, but things are measured
* in bits to be consistent.
*/
uint32_t range_start; /* First bit that is checksummed (byte aligned) */
uint32_t range_end; /* Last bit that is checksummed (byte aligned) */
uint32_t location; /* First bit of the checksum (byte aligned) */
uint32_t type; /* Checksum algorithm that is used */
u32 range_start; /* First bit that is checksummed (byte aligned) */
u32 range_end; /* Last bit that is checksummed (byte aligned) */
u32 location; /* First bit of the checksum (byte aligned) */
u32 type; /* Checksum algorithm that is used */
#define CHECKSUM_NONE 0
#define CHECKSUM_PCBIOS 1
};

View file

@ -1,7 +1,8 @@
/*
* This file is part of the LinuxBIOS project.
*
* Copyright (C) FIXME GET HISTORY
* Copyright (C) 2001 Linux Networx
* Written by Eric Biederman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -18,6 +19,7 @@
*/
#include <lib.h>
void mdelay(unsigned msecs)
{
unsigned i;

View file

@ -51,8 +51,8 @@ static int valid_area(struct lb_memory *mem,
* have a match.
*/
for(i = 0; i < mem_entries; i++) {
uint64_t mstart, mend;
uint32_t mtype;
u64 mstart, mend;
u32 mtype;
mtype = mem->map[i].type;
mstart = unpack_lb64(mem->map[i].start);
mend = mstart + unpack_lb64(mem->map[i].size);
@ -65,8 +65,8 @@ static int valid_area(struct lb_memory *mem,
printk(BIOS_ERR, " [0x%016lx, 0x%016lx)\n", start, end);
printk(BIOS_ERR, "Ram areas\n");
for(i = 0; i < mem_entries; i++) {
uint64_t mstart, mend;
uint32_t mtype;
u64 mstart, mend;
u32 mtype;
mtype = mem->map[i].type;
mstart = unpack_lb64(mem->map[i].start);
mend = mstart + unpack_lb64(mem->map[i].size);

View file

@ -17,7 +17,7 @@
(bb*=2,bb&0xffff ? (bb>>16)&1 : (ilen+=2,((bb=(src[ilen-2]+src[ilen-1]*256u)*2+1)>>16)&1))
#define GETBIT_LE32(bb, src, ilen) \
(bc > 0 ? ((bb>>--bc)&1) : (bc=31,\
bb=*(const uint32_t *)((src)+ilen),ilen+=4,(bb>>31)&1))
bb=*(const u32 *)((src)+ilen),ilen+=4,(bb>>31)&1))
#if ENDIAN == 0 && BITSIZE == 8
#define GETBIT(bb, src, ilen) GETBIT_8(bb, src, ilen)
@ -28,12 +28,12 @@
#if ENDIAN == 0 && BITSIZE == 32
#define GETBIT(bb, src, ilen) GETBIT_LE32(bb, src, ilen)
#endif
static unsigned long unrv2b(uint8_t * src, uint8_t * dst, unsigned long *ilen_p)
static unsigned long unrv2b(u8 * src, u8 * dst, unsigned long *ilen_p)
{
unsigned long ilen = 0, olen = 0, last_m_off = 1;
uint32_t bb = 0;
u32 bb = 0;
unsigned bc = 0;
const uint8_t *m_pos;
const u8 *m_pos;
// skip length
src += 4;

View file

@ -81,7 +81,7 @@ static void ram_resource(struct device * dev, unsigned long index,
static void pci_domain_set_resources(struct device * dev)
{
struct device * mc_dev;
uint32_t tolmk; /* Top of low mem, Kbytes. */
u32 tolmk; /* Top of low mem, Kbytes. */
int idx;
struct northbridge_intel_i440bx_config *chip_info = dev->chip_info;
tolmk = chip_info->ramsize * 1024;