diff --git a/src/include/console/console.h b/src/include/console/console.h index 6417c2e007..199ab2307d 100644 --- a/src/include/console/console.h +++ b/src/include/console/console.h @@ -17,7 +17,7 @@ #ifndef CONSOLE_CONSOLE_H_ #define CONSOLE_CONSOLE_H_ -#include +#include #include 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 { diff --git a/src/include/cpu/generic/i386/arch/types.h b/src/include/cpu/generic/i386/arch/types.h index b9f7c9b642..e47c61bcd1 100644 --- a/src/include/cpu/generic/i386/arch/types.h +++ b/src/include/cpu/generic/i386/arch/types.h @@ -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 diff --git a/src/include/device/device.h b/src/include/device/device.h index d6acd9771f..c7f6899d49 100644 --- a/src/include/device/device.h +++ b/src/include/device/device.h @@ -17,7 +17,7 @@ #ifndef DEVICE_H #define DEVICE_H -#include +#include #include #include @@ -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]; diff --git a/src/include/device/pci.h b/src/include/device/pci.h index 128c5c3af6..abe3104ee0 100644 --- a/src/include/device/pci.h +++ b/src/include/device/pci.h @@ -31,6 +31,7 @@ #ifndef PCI_H #define PCI_H +#include #include #include #include @@ -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); diff --git a/src/include/device/pci_ops.h b/src/include/device/pci_ops.h index d9cda9961b..9f6c8b5fc7 100644 --- a/src/include/device/pci_ops.h +++ b/src/include/device/pci_ops.h @@ -17,14 +17,14 @@ #ifndef PCI_OPS_H #define PCI_OPS_H -#include +#include #include -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 */ diff --git a/src/include/device/pci_rom.h b/src/include/device/pci_rom.h index 916d0d4d43..c5bd278ba9 100644 --- a/src/include/device/pci_rom.h +++ b/src/include/device/pci_rom.h @@ -16,37 +16,38 @@ */ #ifndef PCI_ROM_H #define PCI_ROM_H +#include #include #include #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); diff --git a/src/include/device/resource.h b/src/include/device/resource.h index f57de0e0eb..d47bae209c 100644 --- a/src/include/device/resource.h +++ b/src/include/device/resource.h @@ -17,7 +17,7 @@ #ifndef RESOURCE_H #define RESOURCE_H -#include +#include #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 */ diff --git a/src/mainboard/emulation/qemu-i386/mainboard.c b/src/mainboard/emulation/qemu-i386/mainboard.c index 3992196080..b8c219fd95 100644 --- a/src/mainboard/emulation/qemu-i386/mainboard.c +++ b/src/mainboard/emulation/qemu-i386/mainboard.c @@ -19,10 +19,10 @@ #include #include #include -#include +#include #include "dtc.h" struct chip_operations mainboard_emulation_qemu_i386_ops = { - "qemu mainboard " + .name = "qemu mainboard " }; diff --git a/src/scripts/Makefile.build b/src/scripts/Makefile.build index 3c6ff2e07a..b890bba9df 100644 --- a/src/scripts/Makefile.build +++ b/src/scripts/Makefile.build @@ -97,7 +97,7 @@ cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< define rule_cc_o_c $(call echo-cmd,checksrc) $(cmd_checksrc) \ - $(call echo-cmd,cc_o_c) $(cmd_cc_o_c); \ \ + $(call echo-cmd,cc_o_c) $(cmd_cc_o_c); \ scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' > $(@D)/.$(@F).tmp; \ rm -f $(depfile); \ mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd diff --git a/src/scripts/Makefile.clean b/src/scripts/Makefile.clean new file mode 100644 index 0000000000..cff33498fa --- /dev/null +++ b/src/scripts/Makefile.clean @@ -0,0 +1,102 @@ +# ========================================================================== +# Cleaning up +# ========================================================================== + +src := $(obj) + +PHONY := __clean +__clean: + +# Shorthand for $(Q)$(MAKE) scripts/Makefile.clean obj=dir +# Usage: +# $(Q)$(MAKE) $(clean)=dir +clean := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.clean obj + +# The filename Kbuild has precedence over Makefile +kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) +include $(if $(wildcard $(kbuild-dir)/Kbuild), $(kbuild-dir)/Kbuild, $(kbuild-dir)/Makefile) + +# Figure out what we need to build from the various variables +# ========================================================================== + +__subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y))) +subdir-y += $(__subdir-y) +__subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m))) +subdir-m += $(__subdir-m) +__subdir-n := $(patsubst %/,%,$(filter %/, $(obj-n))) +subdir-n += $(__subdir-n) +__subdir- := $(patsubst %/,%,$(filter %/, $(obj-))) +subdir- += $(__subdir-) + +# Subdirectories we need to descend into + +subdir-ym := $(sort $(subdir-y) $(subdir-m)) +subdir-ymn := $(sort $(subdir-ym) $(subdir-n) $(subdir-)) + +# Add subdir path + +subdir-ymn := $(addprefix $(obj)/,$(subdir-ymn)) + +# build a list of files to remove, usually releative to the current +# directory + +__clean-files := $(extra-y) $(EXTRA_TARGETS) $(always) \ + $(targets) $(clean-files) \ + $(host-progs) \ + $(hostprogs-y) $(hostprogs-m) $(hostprogs-) + +# as clean-files is given relative to the current directory, this adds +# a $(obj) prefix, except for absolute paths + +__clean-files := $(wildcard \ + $(addprefix $(obj)/, $(filter-out /%, $(__clean-files))) \ + $(filter /%, $(__clean-files))) + +# as clean-dirs is given relative to the current directory, this adds +# a $(obj) prefix, except for absolute paths + +__clean-dirs := $(wildcard \ + $(addprefix $(obj)/, $(filter-out /%, $(clean-dirs))) \ + $(filter /%, $(clean-dirs))) + +# ========================================================================== + +quiet_cmd_clean = CLEAN $(obj) + cmd_clean = rm -f $(__clean-files) +quiet_cmd_cleandir = CLEAN $(__clean-dirs) + cmd_cleandir = rm -rf $(__clean-dirs) + + +__clean: $(subdir-ymn) +ifneq ($(strip $(__clean-files)),) + +$(call cmd,clean) +endif +ifneq ($(strip $(__clean-dirs)),) + +$(call cmd,cleandir) +endif +ifneq ($(strip $(clean-rule)),) + +$(clean-rule) +endif + @: + + +# =========================================================================== +# Generic stuff +# =========================================================================== + +# Descending +# --------------------------------------------------------------------------- + +PHONY += $(subdir-ymn) +$(subdir-ymn): + $(Q)$(MAKE) $(clean)=$@ + +# If quiet is set, only print short version of command + +cmd = @$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))' &&) $(cmd_$(1)) + + +# Declare the contents of the .PHONY variable as phony. We keep that +# information in a variable se we can use it in if_changed and friends. + +.PHONY: $(PHONY)