Some build fixes with <arch/types.h>

Add include guards to the one implementation we have so far;
use this header instead of <stdint.h> where it broke the build;
use u8 etc. types where it broke the build.

Signed-off-by: Segher Boessenkool <segher@kernel.crashing.org>
Acked-by: Ronald G. Minnich <rminnich@gmail.com>


git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@37 f3766cd6-281f-0410-b1cd-43a5c92072e9
This commit is contained in:
Segher Boessenkool 2006-11-07 13:26:40 +00:00
parent b7a666e32b
commit 8633f0f9b1
8 changed files with 57 additions and 43 deletions

View file

@ -17,7 +17,7 @@
#ifndef CONSOLE_CONSOLE_H_
#define CONSOLE_CONSOLE_H_
#include <stdint.h>
#include <arch/types.h>
#include <console/loglevel.h>
void console_init(void);
@ -25,7 +25,7 @@ void console_tx_byte(unsigned char byte);
void console_tx_flush(void);
unsigned char console_rx_byte(void);
int console_tst_byte(void);
void post_code(uint8_t value);
void post_code(u8 value);
void die(const char *msg);
struct console_driver {

View file

@ -1,6 +1,13 @@
/* data types */
/*
* Generic data types.
*/
#ifndef _ARCH_TYPES_H
#define _ARCH_TYPES_H
typedef unsigned long long u64;
typedef unsigned int u32;
typedef unsigned short u16;
typedef unsigned char u8;
#endif

View file

@ -17,7 +17,7 @@
#ifndef DEVICE_H
#define DEVICE_H
#include <stdint.h>
#include <arch/types.h>
#include <device/resource.h>
#include <device/path.h>
@ -87,7 +87,7 @@ struct device {
unsigned int on_mainboard : 1;
unsigned long rom_address;
uint8_t command;
u8 command;
/* Base registers for this device. I/O, MEM and Expansion ROM */
struct resource resource[MAX_RESOURCES];

View file

@ -31,6 +31,7 @@
#ifndef PCI_H
#define PCI_H
#include <arch/types.h>
#include <device/pci_def.h>
#include <device/resource.h>
#include <device/device.h>
@ -45,12 +46,17 @@ struct pci_operations {
/* Common pci bus operations */
struct pci_bus_operations {
uint8_t (*read8) (struct bus *pbus, unsigned char bus, int devfn, int where);
uint16_t (*read16) (struct bus *pbus, unsigned char bus, int devfn, int where);
uint32_t (*read32) (struct bus *pbus, unsigned char bus, int devfn, int where);
void (*write8) (struct bus *pbus, unsigned char bus, int devfn, int where, uint8_t val);
void (*write16) (struct bus *pbus, unsigned char bus, int devfn, int where, uint16_t val);
void (*write32) (struct bus *pbus, unsigned char bus, int devfn, int where, uint32_t val);
u8 (*read8)(struct bus *pbus, unsigned char bus, int devfn, int where);
u16 (*read16)(struct bus *pbus, unsigned char bus, int devfn,
int where);
u32 (*read32)(struct bus *pbus, unsigned char bus, int devfn,
int where);
void (*write8)(struct bus *pbus, unsigned char bus, int devfn,
int where, u8 val);
void (*write16)(struct bus *pbus, unsigned char bus, int devfn,
int where, u16 val);
void (*write32)(struct bus *pbus, unsigned char bus, int devfn,
int where, u32 val);
};
struct pci_driver {
@ -81,9 +87,9 @@ unsigned int do_pci_scan_bridge(device_t bus, unsigned int max,
unsigned min_devfn, unsigned max_devfn, unsigned int max));
unsigned int pci_scan_bridge(device_t bus, unsigned int max);
unsigned int pci_scan_bus(struct bus *bus, unsigned min_devfn, unsigned max_devfn, unsigned int max);
uint8_t pci_moving_config8(struct device *dev, unsigned reg);
uint16_t pci_moving_config16(struct device *dev, unsigned reg);
uint32_t pci_moving_config32(struct device *dev, unsigned reg);
u8 pci_moving_config8(struct device *dev, unsigned reg);
u16 pci_moving_config16(struct device *dev, unsigned reg);
u32 pci_moving_config32(struct device *dev, unsigned reg);
unsigned pci_find_next_capability(device_t dev, unsigned cap, unsigned last);
unsigned pci_find_capability(device_t dev, unsigned cap);
struct resource *pci_get_resource(struct device *dev, unsigned long index);

View file

@ -17,14 +17,14 @@
#ifndef PCI_OPS_H
#define PCI_OPS_H
#include <stdint.h>
#include <arch/types.h>
#include <device/device.h>
uint8_t pci_read_config8(device_t dev, unsigned where);
uint16_t pci_read_config16(device_t dev, unsigned where);
uint32_t pci_read_config32(device_t dev, unsigned where);
void pci_write_config8(device_t dev, unsigned where, uint8_t val);
void pci_write_config16(device_t dev, unsigned where, uint16_t val);
void pci_write_config32(device_t dev, unsigned where, uint32_t val);
u8 pci_read_config8(device_t dev, unsigned where);
u16 pci_read_config16(device_t dev, unsigned where);
u32 pci_read_config32(device_t dev, unsigned where);
void pci_write_config8(device_t dev, unsigned where, u8 val);
void pci_write_config16(device_t dev, unsigned where, u16 val);
void pci_write_config32(device_t dev, unsigned where, u32 val);
#endif /* PCI_OPS_H */

View file

@ -16,37 +16,38 @@
*/
#ifndef PCI_ROM_H
#define PCI_ROM_H
#include <arch/types.h>
#include <arch/byteorder.h>
#include <stddef.h>
#define PCI_ROM_HDR 0xAA55
#define PCI_DATA_HDR (uint32_t) ( ('R' << 24) | ('I' << 16) | ('C' << 8) | 'P' )
#define PCI_DATA_HDR (u32) ( ('R' << 24) | ('I' << 16) | ('C' << 8) | 'P' )
#define PCI_RAM_IMAGE_START 0xD0000
#define PCI_VGA_RAM_IMAGE_START 0xC0000
struct rom_header {
uint16_t signature;
uint8_t size;
uint8_t init[3];
uint8_t reserved[0x12];
uint16_t data;
u16 signature;
u8 size;
u8 init[3];
u8 reserved[0x12];
u16 data;
};
struct pci_data {
uint32_t signature;
uint16_t vendor;
uint16_t device;
uint16_t reserved_1;
uint16_t dlen;
uint8_t drevision;
uint8_t class_lo;
uint16_t class_hi;
uint16_t ilen;
uint16_t irevision;
uint8_t type;
uint8_t indicator;
uint16_t reserved_2;
u32 signature;
u16 vendor;
u16 device;
u16 reserved_1;
u16 dlen;
u8 drevision;
u8 class_lo;
u16 class_hi;
u16 ilen;
u16 irevision;
u8 type;
u8 indicator;
u16 reserved_2;
};
extern struct rom_header * pci_rom_probe(struct device *dev);

View file

@ -17,7 +17,7 @@
#ifndef RESOURCE_H
#define RESOURCE_H
#include <stdint.h>
#include <arch/types.h>
#define IORESOURCE_BITS 0x000000ff /* Bus-specific bits */
@ -78,7 +78,7 @@
#define IORESOURCE_MEM_EXPANSIONROM (1<<6)
typedef uint64_t resource_t;
typedef u64 resource_t;
struct resource {
resource_t base; /* Base address of the resource */
resource_t size; /* Size of the resource */

View file

@ -19,7 +19,7 @@
#include <device/pci.h>
#include <device/pci_ids.h>
#include <device/pci_ops.h>
#include <arch/stdint.h>
#include <arch/types.h>
#include "dtc.h"
struct chip_operations mainboard_emulation_qemu_i386_ops = {