Fix for patman with email addresses containing commas

Bootstage improvements for TPL, SPL
 Various sandbox and dm improvements and fixes
 -----BEGIN PGP SIGNATURE-----
 
 iQFFBAABCgAvFiEEslwAIq+Gp8wWVbYnfxc6PpAIreYFAl24zDoRHHNqZ0BjaHJv
 bWl1bS5vcmcACgkQfxc6PpAIreZRiwf+Mf7oG//zjiZcHaPP6KOFb1CjwqLSuiaI
 eCYB6GEZXuSpc8MjAw+baAfIw8MMFuaCfPsUQ5dDo391neK0sW9kkEsdcXnQBpB3
 GdJYcewLN1UuJZovriGobIisGc0GQHh8gmRcVGWSKoEt+gAQauRtVYBIUPuS3JG+
 ihZgYmVgICa+3tqavIbP2oZdXLuLAxR65mfiQHtiJwdCN3OOzyls2v0T0slQX9GV
 ln6EvTk8OMIudBmkB7YiTmJF7AB+3PH/uBaiYyTKO9gtjLhnmCFvG5HxJTRFOKvU
 F4oVWZJDEcqfZvYgWg8i5vgokMP41nzLfBr7j5ifUX1f3xwCHy/Tpw==
 =S4XI
 -----END PGP SIGNATURE-----

Merge tag 'dm-pull-29oct19' of git://git.denx.de/u-boot-dm

- Fix for patman with email addresses containing commas
- Bootstage improvements for TPL, SPL
- Various sandbox and dm improvements and fixes
This commit is contained in:
Tom Rini 2019-11-01 09:34:35 -04:00
commit bb1bb4bb5d
21 changed files with 135 additions and 55 deletions

View File

@ -246,8 +246,7 @@ unsigned int sandbox_read(const void *addr, enum sandboxio_size_t size)
return 0;
}
void sandbox_write(const void *addr, unsigned int val,
enum sandboxio_size_t size)
void sandbox_write(void *addr, unsigned int val, enum sandboxio_size_t size)
{
struct sandbox_state *state = state_get_current();

View File

@ -46,8 +46,7 @@ static inline void unmap_sysmem(const void *vaddr)
phys_addr_t map_to_sysmem(const void *ptr);
unsigned int sandbox_read(const void *addr, enum sandboxio_size_t size);
void sandbox_write(const void *addr, unsigned int val,
enum sandboxio_size_t size);
void sandbox_write(void *addr, unsigned int val, enum sandboxio_size_t size);
#define readb(addr) sandbox_read((const void *)addr, SB_SIZE_8)
#define readw(addr) sandbox_read((const void *)addr, SB_SIZE_16)
@ -55,11 +54,11 @@ void sandbox_write(const void *addr, unsigned int val,
#ifdef CONFIG_SANDBOX64
#define readq(addr) sandbox_read((const void *)addr, SB_SIZE_64)
#endif
#define writeb(v, addr) sandbox_write((const void *)addr, v, SB_SIZE_8)
#define writew(v, addr) sandbox_write((const void *)addr, v, SB_SIZE_16)
#define writel(v, addr) sandbox_write((const void *)addr, v, SB_SIZE_32)
#define writeb(v, addr) sandbox_write((void *)addr, v, SB_SIZE_8)
#define writew(v, addr) sandbox_write((void *)addr, v, SB_SIZE_16)
#define writel(v, addr) sandbox_write((void *)addr, v, SB_SIZE_32)
#ifdef CONFIG_SANDBOX64
#define writeq(v, addr) sandbox_write((const void *)addr, v, SB_SIZE_64)
#define writeq(v, addr) sandbox_write((void *)addr, v, SB_SIZE_64)
#endif
/*

View File

@ -213,4 +213,15 @@ int sandbox_get_pci_ep_irq_count(struct udevice *dev);
*/
uint sandbox_pci_read_bar(u32 barval, int type, uint size);
/**
* sandbox_set_enable_memio() - Enable readl/writel() for sandbox
*
* Normally these I/O functions do nothing with sandbox. Certain tests need them
* to work as for other architectures, so this function can be used to enable
* them.
*
* @enable: true to enable, false to disable
*/
void sandbox_set_enable_memio(bool enable);
#endif

View File

@ -588,6 +588,7 @@ static int reserve_stacks(void)
static int reserve_bloblist(void)
{
#ifdef CONFIG_BLOBLIST
gd->start_addr_sp &= ~0xf;
gd->start_addr_sp -= CONFIG_BLOBLIST_SIZE;
gd->new_bloblist = map_sysmem(gd->start_addr_sp, CONFIG_BLOBLIST_SIZE);
#endif
@ -695,6 +696,7 @@ static int reloc_bootstage(void)
gd->bootstage, gd->new_bootstage, size);
memcpy(gd->new_bootstage, gd->bootstage, size);
gd->bootstage = gd->new_bootstage;
bootstage_relocate();
}
#endif

View File

@ -670,7 +670,6 @@ static init_fnc_t init_sequence_r[] = {
#ifdef CONFIG_SYS_NONCACHED_MEMORY
initr_noncached,
#endif
bootstage_relocate,
#ifdef CONFIG_OF_LIVE
initr_of_live,
#endif

View File

@ -10,9 +10,10 @@
*/
#include <common.h>
#include <linux/libfdt.h>
#include <malloc.h>
#include <spl.h>
#include <linux/compiler.h>
#include <linux/libfdt.h>
DECLARE_GLOBAL_DATA_PTR;
@ -41,24 +42,34 @@ enum {
};
struct bootstage_hdr {
uint32_t version; /* BOOTSTAGE_VERSION */
uint32_t count; /* Number of records */
uint32_t size; /* Total data size (non-zero if valid) */
uint32_t magic; /* Unused */
u32 version; /* BOOTSTAGE_VERSION */
u32 count; /* Number of records */
u32 size; /* Total data size (non-zero if valid) */
u32 magic; /* Magic number */
u32 next_id; /* Next ID to use for bootstage */
};
int bootstage_relocate(void)
{
struct bootstage_data *data = gd->bootstage;
int i;
char *ptr;
/* Figure out where to relocate the strings to */
ptr = (char *)(data + 1);
/*
* Duplicate all strings. They may point to an old location in the
* program .text section that can eventually get trashed.
*/
debug("Relocating %d records\n", data->rec_count);
for (i = 0; i < data->rec_count; i++)
data->record[i].name = strdup(data->record[i].name);
for (i = 0; i < data->rec_count; i++) {
const char *from = data->record[i].name;
strcpy(ptr, from);
data->record[i].name = ptr;
ptr += strlen(ptr) + 1;
}
return 0;
}
@ -372,7 +383,6 @@ int bootstage_stash(void *base, int size)
const struct bootstage_record *rec;
char buf[20];
char *ptr = base, *end = ptr + size;
uint32_t count;
int i;
if (hdr + 1 > (struct bootstage_hdr *)end) {
@ -383,21 +393,15 @@ int bootstage_stash(void *base, int size)
/* Write an arbitrary version number */
hdr->version = BOOTSTAGE_VERSION;
/* Count the number of records, and write that value first */
for (rec = data->record, i = count = 0; i < data->rec_count;
i++, rec++) {
if (rec->id != 0)
count++;
}
hdr->count = count;
hdr->count = data->rec_count;
hdr->size = 0;
hdr->magic = BOOTSTAGE_MAGIC;
hdr->next_id = data->next_id;
ptr += sizeof(*hdr);
/* Write the records, silently stopping when we run out of space */
for (rec = data->record, i = 0; i < data->rec_count; i++, rec++) {
for (rec = data->record, i = 0; i < data->rec_count; i++, rec++)
append_data(&ptr, end, rec, sizeof(*rec));
}
/* Write the name strings */
for (rec = data->record, i = 0; i < data->rec_count; i++, rec++) {
@ -478,6 +482,8 @@ int bootstage_unstash(const void *base, int size)
for (rec = data->record + data->next_id, i = 0; i < hdr->count;
i++, rec++) {
rec->name = ptr;
if (spl_phase() == PHASE_SPL)
rec->name = strdup(ptr);
/* Assume no data corruption here */
ptr += strlen(ptr) + 1;
@ -485,6 +491,7 @@ int bootstage_unstash(const void *base, int size)
/* Mark the records as read */
data->rec_count += hdr->count;
data->next_id = hdr->next_id;
debug("Unstashed %d records\n", hdr->count);
return 0;
@ -492,7 +499,17 @@ int bootstage_unstash(const void *base, int size)
int bootstage_get_size(void)
{
return sizeof(struct bootstage_data);
struct bootstage_data *data = gd->bootstage;
struct bootstage_record *rec;
int size;
int i;
size = sizeof(struct bootstage_data);
for (rec = data->record, i = 0; i < data->rec_count;
i++, rec++)
size += strlen(rec->name) + 1;
return size;
}
int bootstage_init(bool first)

View File

@ -1566,7 +1566,7 @@ static int fdt_read_prop(const fdt32_t *prop, int prop_len, int cell_off,
uint64_t *val, int cells)
{
const fdt32_t *prop32 = &prop[cell_off];
const fdt64_t *prop64 = (const fdt64_t *)&prop[cell_off];
const unaligned_fdt64_t *prop64 = (const fdt64_t *)&prop[cell_off];
if ((cell_off + cells) > prop_len)
return -FDT_ERR_NOSPACE;

View File

@ -18,6 +18,7 @@
#include <version.h>
#include <image.h>
#include <malloc.h>
#include <mapmem.h>
#include <dm/root.h>
#include <linux/compiler.h>
#include <fdt_support.h>
@ -396,13 +397,25 @@ static int spl_common_init(bool setup_malloc)
gd->malloc_ptr = 0;
}
#endif
ret = bootstage_init(true);
ret = bootstage_init(u_boot_first_phase());
if (ret) {
debug("%s: Failed to set up bootstage: ret=%d\n", __func__,
ret);
return ret;
}
bootstage_mark_name(BOOTSTAGE_ID_START_SPL, "spl");
#ifdef CONFIG_BOOTSTAGE_STASH
if (!u_boot_first_phase()) {
const void *stash = map_sysmem(CONFIG_BOOTSTAGE_STASH_ADDR,
CONFIG_BOOTSTAGE_STASH_SIZE);
ret = bootstage_unstash(stash, CONFIG_BOOTSTAGE_STASH_SIZE);
if (ret)
debug("%s: Failed to unstash bootstage: ret=%d\n",
__func__, ret);
}
#endif /* CONFIG_BOOTSTAGE_STASH */
bootstage_mark_name(spl_phase() == PHASE_TPL ? BOOTSTAGE_ID_START_TPL :
BOOTSTAGE_ID_START_SPL, SPL_TPL_NAME);
#if CONFIG_IS_ENABLED(LOG)
ret = log_init();
if (ret) {
@ -418,7 +431,8 @@ static int spl_common_init(bool setup_malloc)
}
}
if (CONFIG_IS_ENABLED(DM)) {
bootstage_start(BOOTSTATE_ID_ACCUM_DM_SPL, "dm_spl");
bootstage_start(BOOTSTATE_ID_ACCUM_DM_SPL,
spl_phase() == PHASE_TPL ? "dm tpl" : "dm_spl");
/* With CONFIG_SPL_OF_PLATDATA, bring in all devices */
ret = dm_init_and_scan(!CONFIG_IS_ENABLED(OF_PLATDATA));
bootstage_accum(BOOTSTATE_ID_ACCUM_DM_SPL);
@ -704,8 +718,9 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
debug("SPL malloc() used 0x%lx bytes (%ld KB)\n", gd->malloc_ptr,
gd->malloc_ptr / 1024);
#endif
bootstage_mark_name(spl_phase() == PHASE_TPL ? BOOTSTAGE_ID_END_TPL :
BOOTSTAGE_ID_END_SPL, "end " SPL_TPL_NAME);
#ifdef CONFIG_BOOTSTAGE_STASH
bootstage_mark_name(BOOTSTAGE_ID_END_SPL, "end_spl");
ret = bootstage_stash((void *)CONFIG_BOOTSTAGE_STASH_ADDR,
CONFIG_BOOTSTAGE_STASH_SIZE);
if (ret)

View File

@ -57,7 +57,7 @@ int ofnode_read_s32_default(ofnode node, const char *propname, s32 def)
int ofnode_read_u64(ofnode node, const char *propname, u64 *outp)
{
const fdt64_t *cell;
const unaligned_fdt64_t *cell;
int len;
assert(ofnode_valid(node));

View File

@ -462,5 +462,5 @@ int regmap_update_bits(struct regmap *map, uint offset, uint mask, uint val)
reg &= ~mask;
return regmap_write(map, offset, reg | val);
return regmap_write(map, offset, reg | (val & mask));
}

View File

@ -6,6 +6,8 @@
* Pavel Herrmann <morpheus.ibis@gmail.com>
*/
#define LOG_CATEGORY LOGC_DM
#include <common.h>
#include <dm.h>
#include <errno.h>
@ -303,7 +305,7 @@ int uclass_find_device_by_seq(enum uclass_id id, int seq_or_req_seq,
int ret;
*devp = NULL;
debug("%s: %d %d\n", __func__, find_req_seq, seq_or_req_seq);
log_debug("%d %d\n", find_req_seq, seq_or_req_seq);
if (seq_or_req_seq == -1)
return -ENODEV;
ret = uclass_get(id, &uc);
@ -311,15 +313,16 @@ int uclass_find_device_by_seq(enum uclass_id id, int seq_or_req_seq,
return ret;
uclass_foreach_dev(dev, uc) {
debug(" - %d %d '%s'\n", dev->req_seq, dev->seq, dev->name);
log_debug(" - %d %d '%s'\n",
dev->req_seq, dev->seq, dev->name);
if ((find_req_seq ? dev->req_seq : dev->seq) ==
seq_or_req_seq) {
*devp = dev;
debug(" - found\n");
log_debug(" - found\n");
return 0;
}
}
debug(" - not found\n");
log_debug(" - not found\n");
return -ENODEV;
}

View File

@ -170,6 +170,8 @@ enum bootstage_id {
* rough boot timing information.
*/
BOOTSTAGE_ID_AWAKE,
BOOTSTAGE_ID_START_TPL,
BOOTSTAGE_ID_END_TPL,
BOOTSTAGE_ID_START_SPL,
BOOTSTAGE_ID_END_SPL,
BOOTSTAGE_ID_START_UBOOT_F,

View File

@ -16,6 +16,7 @@
typedef __be16 fdt16_t;
typedef __be32 fdt32_t;
typedef __be64 fdt64_t;
typedef __be64 unaligned_fdt64_t __aligned(4);
#define fdt32_to_cpu(x) be32_to_cpu(x)
#define cpu_to_fdt32(x) cpu_to_be32(x)

View File

@ -295,7 +295,8 @@ int regmap_raw_read_range(struct regmap *map, uint range_num, uint offset,
* @map: The map returned by regmap_init_mem*()
* @offset: Offset of the memory
* @mask: Mask to apply to the read value
* @val: Value to apply to the value to write
* @val: Value to OR with the read value after masking. Note that any
* bits set in @val which are not set in @mask are ignored
* Return: 0 if OK, -ve on error
*/
int regmap_update_bits(struct regmap *map, uint offset, uint mask, uint val);

View File

@ -61,7 +61,8 @@ void ut_failf(struct unit_test_state *uts, const char *fname, int line,
if (val1 != val2) { \
ut_failf(uts, __FILE__, __LINE__, __func__, \
#expr1 " == " #expr2, \
"Expected %d, got %d", val1, val2); \
"Expected %#x (%d), got %#x (%d)", val1, val1, \
val2, val2); \
return CMD_RET_FAILURE; \
} \
}

View File

@ -242,7 +242,7 @@ int fdtdec_get_pci_bar32(struct udevice *dev, struct fdt_pci_addr *addr,
uint64_t fdtdec_get_uint64(const void *blob, int node, const char *prop_name,
uint64_t default_val)
{
const uint64_t *cell64;
const unaligned_fdt64_t *cell64;
int length;
cell64 = fdt_getprop(blob, node, prop_name, &length);

View File

@ -157,7 +157,8 @@ static void ip4_addr_string(struct printf_info *info, u8 *addr)
* decimal).
*/
static void pointer(struct printf_info *info, const char *fmt, void *ptr)
static void __maybe_unused pointer(struct printf_info *info, const char *fmt,
void *ptr)
{
#ifdef DEBUG
unsigned long num = (uintptr_t)ptr;
@ -266,6 +267,21 @@ static int _vprintf(struct printf_info *info, const char *fmt, va_list va)
div_out(info, &num, div);
}
break;
case 'p':
#ifdef DEBUG
pointer(info, fmt, va_arg(va, void *));
/*
* Skip this because it pulls in _ctype which is
* 256 bytes, and we don't generally implement
* pointer anyway
*/
while (isalnum(fmt[0]))
fmt++;
break;
#else
islong = true;
/* no break */
#endif
case 'x':
if (islong) {
num = va_arg(va, unsigned long);
@ -287,11 +303,6 @@ static int _vprintf(struct printf_info *info, const char *fmt, va_list va)
case 's':
p = va_arg(va, char*);
break;
case 'p':
pointer(info, fmt, va_arg(va, void *));
while (isalnum(fmt[0]))
fmt++;
break;
case '%':
out(info, '%');
default:
@ -398,3 +409,9 @@ int snprintf(char *buf, size_t size, const char *fmt, ...)
return ret;
}
void print_grouped_ull(unsigned long long int_val, int digits)
{
/* Don't try to print the upper 32-bits */
printf("%ld ", (ulong)int_val);
}

View File

@ -99,18 +99,27 @@ static int dm_test_regmap_rw(struct unit_test_state *uts)
struct regmap *map;
uint reg;
sandbox_set_enable_memio(true);
ut_assertok(uclass_get_device(UCLASS_SYSCON, 0, &dev));
map = syscon_get_regmap(dev);
ut_assertok_ptr(map);
ut_assertok(regmap_write(map, 0, 0xcacafafa));
ut_assertok(regmap_write(map, 3, 0x55aa2211));
ut_assertok(regmap_write(map, 5, 0x55aa2211));
ut_assertok(regmap_read(map, 0, &reg));
ut_assertok(regmap_read(map, 3, &reg));
ut_asserteq(0xcacafafa, reg);
ut_assertok(regmap_read(map, 5, &reg));
ut_asserteq(0x55aa2211, reg);
ut_assertok(regmap_read(map, 0, &reg));
ut_asserteq(0xcacafafa, reg);
ut_assertok(regmap_update_bits(map, 0, 0xff00ff00, 0x55aa2211));
ut_assertok(regmap_update_bits(map, 3, 0x00ff00ff, 0xcacafada));
ut_assertok(regmap_read(map, 0, &reg));
ut_asserteq(0x55ca22fa, reg);
ut_assertok(regmap_update_bits(map, 5, 0x00ff00ff, 0xcacafada));
ut_assertok(regmap_read(map, 5, &reg));
ut_asserteq(0x55ca22da, reg);
return 0;
}
@ -130,6 +139,7 @@ static int dm_test_regmap_getset(struct unit_test_state *uts)
u32 val3;
};
sandbox_set_enable_memio(true);
ut_assertok(uclass_get_device(UCLASS_SYSCON, 0, &dev));
map = syscon_get_regmap(dev);
ut_assertok_ptr(map);
@ -138,7 +148,9 @@ static int dm_test_regmap_getset(struct unit_test_state *uts)
regmap_set(map, struct layout, val3, 0x55aa2211);
ut_assertok(regmap_get(map, struct layout, val0, &reg));
ut_asserteq(0xcacafafa, reg);
ut_assertok(regmap_get(map, struct layout, val3, &reg));
ut_asserteq(0x55aa2211, reg);
return 0;
}
@ -159,6 +171,7 @@ static int dm_test_regmap_poll(struct unit_test_state *uts)
start = get_timer(0);
ut_assertok(regmap_write(map, 0, 0x0));
ut_asserteq(-ETIMEDOUT,
regmap_read_poll_timeout_test(map, 0, reg,
(reg == 0xcacafafa),

View File

@ -198,9 +198,9 @@ class TestFunctional(unittest.TestCase):
line += 4
self.assertEqual(expected, tools.ToUnicode(lines[line]))
self.assertEqual(('%s %s, %s' % (args[0], rick, stefan)),
self.assertEqual(('%s %s\0%s' % (args[0], rick, stefan)),
tools.ToUnicode(cc_lines[0]))
self.assertEqual(('%s %s, %s, %s, %s' % (args[1], fred, ed, rick,
self.assertEqual(('%s %s\0%s\0%s\0%s' % (args[1], fred, ed, rick,
stefan)), tools.ToUnicode(cc_lines[1]))
expected = '''

View File

@ -112,7 +112,7 @@ elif options.cc_cmd:
for line in fd.readlines():
match = re_line.match(line)
if match and match.group(1) == args[0]:
for cc in match.group(2).split(', '):
for cc in match.group(2).split('\0'):
cc = cc.strip()
if cc:
print(cc)

View File

@ -243,13 +243,13 @@ class Series(dict):
if limit is not None:
cc = cc[:limit]
all_ccs += cc
print(commit.patch, ', '.join(sorted(set(cc))), file=fd)
print(commit.patch, '\0'.join(sorted(set(cc))), file=fd)
self._generated_cc[commit.patch] = cc
if cover_fname:
cover_cc = gitutil.BuildEmailList(self.get('cover_cc', ''))
cover_cc = [tools.FromUnicode(m) for m in cover_cc]
cc_list = ', '.join([tools.ToUnicode(x)
cc_list = '\0'.join([tools.ToUnicode(x)
for x in sorted(set(cover_cc + all_ccs))])
print(cover_fname, cc_list.encode('utf-8'), file=fd)