diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2014-11-22 08:33:27 +1100 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2014-11-22 08:33:27 +1100 |
commit | c1862061cae04f6fd2c4bd4a723a408a76e8be81 (patch) | |
tree | 5d247c9345e746442973402077d404391d92b653 | |
parent | 0b446b4c8c3883b847f00722b9fd43d3110f7af1 (diff) | |
parent | 23f147ea00fbc246106040cb95b1b6f0dfe4e961 (diff) | |
download | skiboot-c1862061cae04f6fd2c4bd4a723a408a76e8be81.zip skiboot-c1862061cae04f6fd2c4bd4a723a408a76e8be81.tar.gz skiboot-c1862061cae04f6fd2c4bd4a723a408a76e8be81.tar.bz2 |
Merge remote-tracking branch 'ltcgit/master'
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | Makefile.main | 36 | ||||
-rw-r--r-- | core/init.c | 2 | ||||
-rw-r--r-- | core/opal.c | 2 | ||||
-rw-r--r-- | hw/fsp/fsp-attn.c | 4 | ||||
-rw-r--r-- | hw/phb3.c | 32 | ||||
-rw-r--r-- | include/fsp-attn.h | 6 | ||||
-rw-r--r-- | include/skiboot.h | 4 | ||||
-rwxr-xr-x | make_version.sh | 38 |
9 files changed, 105 insertions, 22 deletions
@@ -17,7 +17,7 @@ tags cscope.out asm/asm-offsets.s include/asm-offsets.h -gitid.c +version.c core/test/run-device core/test/run-malloc core/test/run-malloc-speed @@ -36,3 +36,4 @@ libc/test/run-time libc/test/run-time-gcov libflash/test/test-flash libflash/test/test-flash-gcov +VERSION diff --git a/Makefile.main b/Makefile.main index 129d38b..46af374 100644 --- a/Makefile.main +++ b/Makefile.main @@ -117,21 +117,23 @@ OBJS := $(ASM) $(CORE) $(HW) $(PLATFORMS) $(LIBFDT) $(LIBFLASH) ifeq ($(PORE),1) OBJS += $(LIBPORE) endif -OBJS += $(LIBC) $(CCAN) $(DEVSRC_OBJ) gitid.o +OBJS += $(LIBC) $(CCAN) $(DEVSRC_OBJ) +OBJS_NO_VER = $(OBJS) +ALL_OBJS = $(OBJS) version.o -OBJS_1 = $(OBJS) asm/dummy_map.o -OBJS_2 = $(OBJS) asm/real_map.o +ALL_OBJS_1 = $(ALL_OBJS) asm/dummy_map.o +ALL_OBJS_2 = $(ALL_OBJS) asm/real_map.o $(TARGET).lid: $(TARGET).elf $(call Q,OBJCOPY, $(OBJCOPY) -O binary -S $^ $@, $@) -$(TARGET).tmp.elf: $(OBJS_1) $(TARGET).lds $(KERNEL) - $(call Q,LD, $(CC) $(LDFLAGS) -T $(TARGET).lds $(OBJS_1) -o $@, $@) +$(TARGET).tmp.elf: $(ALL_OBJS_1) $(TARGET).lds $(KERNEL) + $(call Q,LD, $(CC) $(LDFLAGS) -T $(TARGET).lds $(ALL_OBJS_1) -o $@, $@) asm/real_map.o : $(TARGET).tmp.map -$(TARGET).elf: $(OBJS_2) $(TARGET).lds $(KERNEL) - $(call Q,LD, $(CC) $(LDFLAGS) -T $(TARGET).lds $(OBJS_2) -o $@, $@) +$(TARGET).elf: $(ALL_OBJS_2) $(TARGET).lds $(KERNEL) + $(call Q,LD, $(CC) $(LDFLAGS) -T $(TARGET).lds $(ALL_OBJS_2) -o $@, $@) $(SUBDIRS): $(call Q,MKDIR,mkdir $@, $@) @@ -142,10 +144,20 @@ $(SUBDIRS): # Set V=1 if you want to see everything. include $(SRC)/Makefile.rules -GIT_SHA ?= $(shell cd $(SRC); GIT_DIR=$(SRC)/.git git describe --always --dirty 2> /dev/null) +VERSION ?= $(shell cd $(SRC); GIT_DIR=$(SRC)/.git $(SRC)/make_version.sh) -gitid.c: - @echo "const char gitid[] = \"$(GIT_SHA)\";" > $@ +.PHONY: VERSION-always +.version: VERSION-always + @echo $(VERSION) > $@.tmp + @cmp -s $@ $@.tmp || cp $@.tmp $@ + @rm -f $@.tmp + +version.c: make_version.sh $(OBJS_NO_VER) .version + @(if [ "a$(VERSION)" = "a" ]; then \ + echo "#error You need to set SKIBOOT_VERSION environment variable" > $@ ;\ + else \ + echo "const char version[] = \"$(VERSION)\";" ;\ + fi) > $@ .PHONY: coverage include $(shell find $(SRC)/* -name Makefile.check) @@ -163,7 +175,7 @@ tags: TAGS: find . -name '*.[chS]' | xargs etags -.PHONY: tags TAGS check gitid.c +.PHONY: tags TAGS check cscope: find . -name '*.[chS]' | xargs cscope @@ -171,7 +183,7 @@ cscope: clean: $(RM) *.[odsa] $(SUBDIRS:%=%/*.[odsa]) $(RM) *.elf $(TARGET).lid *.map $(TARGET).lds - $(RM) include/asm-offsets.h gitid.c + $(RM) include/asm-offsets.h version.c distclean: clean $(RM) *~ $(SUBDIRS:%=%/*~) include/*~ diff --git a/core/init.c b/core/init.c index d934e78..d8e9d20 100644 --- a/core/init.c +++ b/core/init.c @@ -492,7 +492,7 @@ void __noreturn main_cpu_entry(const void *fdt, u32 master_cpu) */ clear_console(); - printf("SkiBoot %s starting...\n", gitid); + printf("SkiBoot %s starting...\n", version); printf("initial console log level: memory %d, driver %d\n", (debug_descriptor.console_log_levels >> 4), (debug_descriptor.console_log_levels & 0x0f)); diff --git a/core/opal.c b/core/opal.c index 345d619..5b96064 100644 --- a/core/opal.c +++ b/core/opal.c @@ -118,7 +118,7 @@ static void add_opal_firmware_node(void) dt_add_property_string(firmware, "compatible", "ibm,opal-firmware"); dt_add_property_string(firmware, "name", "firmware"); - dt_add_property_string(firmware, "git-id", gitid); + dt_add_property_string(firmware, "version", version); dt_add_property(firmware, "symbol-map", __sym_map_start, __sym_map_end - __sym_map_start); } diff --git a/hw/fsp/fsp-attn.c b/hw/fsp/fsp-attn.c index 02603a1..71de780 100644 --- a/hw/fsp/fsp-attn.c +++ b/hw/fsp/fsp-attn.c @@ -104,7 +104,7 @@ void update_sp_attn_area(const char *msg) ti_attn->src_word[0] = (uint32_t)((uint64_t)__builtin_return_address(0) & 0xffffffff); - snprintf(ti_attn->msg.gitid, GITID_LEN, "%s", gitid); + snprintf(ti_attn->msg.version, VERSION_LEN, "%s", version); ent_cnt = STACK_BUF_ENTRIES; __backtrace(bt_buf, &ent_cnt); len = BT_FRAME_LEN; @@ -112,7 +112,7 @@ void update_sp_attn_area(const char *msg) ti_attn->msg.bt_buf, &len, false); snprintf(ti_attn->msg.file_info, FILE_INFO_LEN, "%s", msg); - ti_attn->msg_len = GITID_LEN + BT_FRAME_LEN + + ti_attn->msg_len = VERSION_LEN + BT_FRAME_LEN + strlen(ti_attn->msg.file_info); } @@ -3704,12 +3704,44 @@ static void phb3_init_errors(struct phb3 *p) out_be64(p->regs + PHB_LEM_WOF, 0x0000000000000000); } +static int64_t phb3_fixup_pec_inits(struct phb3 *p) +{ + int64_t rc; + uint64_t val; + + /* These fixups handle some timer updates that HB doesn't yet do + * to work around problems with some adapters or external drawers + * (SW283991) + */ + + /* PCI Hardware Configuration 0 Register */ + rc = xscom_read(p->chip_id, p->pe_xscom + 0x18, &val); + if (rc) { + PHBERR(p, "Can't read CS0 !\n"); + return rc; + } + val = val & 0x0f0fffffffffffffull; + val = val | 0x1010000000000000ull; + rc = xscom_write(p->chip_id, p->pe_xscom + 0x18, val); + if (rc) { + PHBERR(p, "Can't write CS0 !\n"); + return rc; + } + return 0; +} + static void phb3_init_hw(struct phb3 *p) { uint64_t val; PHBDBG(p, "Initializing PHB...\n"); + /* Fixups for PEC inits */ + if (phb3_fixup_pec_inits(p)) { + PHBERR(p, "Failed to init PEC, PHB appears broken\n"); + goto failed; + } + /* Lift reset */ xscom_read(p->chip_id, p->spci_xscom + 1, &val);/* HW275117 */ xscom_write(p->chip_id, p->pci_xscom + 0xa, 0); diff --git a/include/fsp-attn.h b/include/fsp-attn.h index 947c49f..1eaa5bb 100644 --- a/include/fsp-attn.h +++ b/include/fsp-attn.h @@ -59,14 +59,14 @@ struct sp_attn_area { #define TI_MSG_LEN 940 /* Maximum sapphire version length (approx) */ -#define GITID_LEN 40 +#define VERSION_LEN 80 /* Upto 10 frames each of length 40 bytes + header = 430 bytes */ #define BT_FRAME_LEN 430 /* File info length : Use the rest of the memory for file details */ -#define FILE_INFO_LEN (TI_MSG_LEN - GITID_LEN - BT_FRAME_LEN) +#define FILE_INFO_LEN (TI_MSG_LEN - VERSION_LEN - BT_FRAME_LEN) struct user_data { - char gitid[GITID_LEN]; + char version[VERSION_LEN]; char bt_buf[BT_FRAME_LEN]; char file_info[FILE_INFO_LEN]; } __packed; diff --git a/include/skiboot.h b/include/skiboot.h index 79aece6..d2e1be0 100644 --- a/include/skiboot.h +++ b/include/skiboot.h @@ -168,8 +168,8 @@ extern void parse_hdat(bool is_opal, uint32_t master_cpu); /* Root of device tree. */ extern struct dt_node *dt_root; -/* Generated git id. */ -extern const char gitid[]; +/* Full skiboot version number (possibly includes gitid). */ +extern const char version[]; /* Debug support */ extern char __sym_map_start[]; diff --git a/make_version.sh b/make_version.sh new file mode 100755 index 0000000..1409704 --- /dev/null +++ b/make_version.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +if test -d .git; +then + version=`git describe --exact-match 2>/dev/null` + if [ -z "$version" ]; + then + version=`git describe 2>/dev/null` + fi + if [ -z "$version" ]; + then + version=`git rev-parse --verify --short HEAD 2>/dev/null` + fi + if [ ! -z "$EXTRA_VERSION" ]; + then + version="$version-$EXTRA_VERSION" + fi + if git diff-index --name-only HEAD |grep -qv '.git'; + then + if [ ! -z "$USER" ]; + then + version="$version-$USER" + fi + version="$version-dirty" + diffsha=`git diff|sha1sum` + diffsha=`cut -c-7 <<< "$diffsha"` + version="$version-$diffsha" + fi + + echo $version +else + if [ ! -z "$SKIBOOT_VERSION" ]; + then + echo $SKIBOOT_VERSION + else + exit 1; + fi +fi |