Merge pull request #917 from soby-mathew/sm/sys_susp_css
CSS: Allow system suspend only via PSCI SYSTEM_SUSPEND API
diff --git a/bl1/bl1_fwu.c b/bl1/bl1_fwu.c
index f7fae68..e2ede68 100644
--- a/bl1/bl1_fwu.c
+++ b/bl1/bl1_fwu.c
@@ -109,7 +109,7 @@
break;
}
- SMC_RET0(handle);
+ SMC_RET1(handle, SMC_UNK);
}
/*******************************************************************************
diff --git a/bl2/bl2_image_load_v2.c b/bl2/bl2_image_load_v2.c
index 4fab655..05c0fcd 100644
--- a/bl2/bl2_image_load_v2.c
+++ b/bl2/bl2_image_load_v2.c
@@ -109,6 +109,10 @@
assert(bl2_to_next_bl_params->head);
assert(bl2_to_next_bl_params->h.type == PARAM_BL_PARAMS);
assert(bl2_to_next_bl_params->h.version >= VERSION_2);
+ assert(bl2_to_next_bl_params->head->ep_info);
+
+ /* Populate arg0 for the next BL image */
+ bl2_to_next_bl_params->head->ep_info->args.arg0 = (u_register_t)bl2_to_next_bl_params;
/* Flush the parameters to be passed to next image */
plat_flush_next_bl_params();
diff --git a/common/desc_image_load.c b/common/desc_image_load.c
index a9762b7..52ef362 100644
--- a/common/desc_image_load.c
+++ b/common/desc_image_load.c
@@ -47,8 +47,11 @@
******************************************************************************/
void flush_bl_params_desc(void)
{
- flush_dcache_range((unsigned long)bl_mem_params_desc_ptr,
+ flush_dcache_range((uintptr_t)bl_mem_params_desc_ptr,
sizeof(*bl_mem_params_desc_ptr) * bl_mem_params_desc_num);
+
+ flush_dcache_range((uintptr_t)&next_bl_params,
+ sizeof(next_bl_params));
}
/*******************************************************************************
@@ -209,12 +212,5 @@
/* Invalid image is expected to terminate the loop */
assert(img_id == INVALID_IMAGE_ID);
- /* Populate arg0 for the next BL image */
- next_bl_params.head->ep_info->args.arg0 = (unsigned long)&next_bl_params;
-
- /* Flush the parameters to be passed to the next BL image */
- flush_dcache_range((unsigned long)&next_bl_params,
- sizeof(next_bl_params));
-
return &next_bl_params;
}
diff --git a/drivers/ti/uart/aarch64/16550_console.S b/drivers/ti/uart/aarch64/16550_console.S
index 489fcbe..1b9cab8 100644
--- a/drivers/ti/uart/aarch64/16550_console.S
+++ b/drivers/ti/uart/aarch64/16550_console.S
@@ -115,9 +115,6 @@
b.ne 1b
mov w2, #0xD /* '\r' */
str w2, [x1, #UARTTX]
- ldr w2, [x1, #UARTFCR]
- orr w2, w2, #UARTFCR_TXCLR
- str w2, [x1, #UARTFCR]
/* Check if the transmit FIFO is full */
2: ldr w2, [x1, #UARTLSR]
@@ -125,9 +122,6 @@
cmp w2, #(UARTLSR_TEMT | UARTLSR_THRE)
b.ne 2b
str w0, [x1, #UARTTX]
- ldr w2, [x1, #UARTFCR]
- orr w2, w2, #UARTFCR_TXCLR
- str w2, [x1, #UARTFCR]
ret
putc_error:
mov w0, #-1
diff --git a/include/lib/smcc.h b/include/lib/smcc.h
index 2f562c5..a4c4b6c 100644
--- a/include/lib/smcc.h
+++ b/include/lib/smcc.h
@@ -58,6 +58,7 @@
#define SMC_64 1
#define SMC_32 0
+#define SMC_OK 0
#define SMC_UNK 0xffffffff
#define SMC_TYPE_FAST ULL(1)
#define SMC_TYPE_STD 0
diff --git a/include/lib/stdlib/stdbool.h b/include/lib/stdlib/stdbool.h
new file mode 100644
index 0000000..48070c1
--- /dev/null
+++ b/include/lib/stdlib/stdbool.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2000 Jeroen Ruigrok van der Werven <asmodai@FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef __bool_true_false_are_defined
+#define __bool_true_false_are_defined 1
+
+#ifndef __cplusplus
+
+#define false 0
+#define true 1
+
+#define bool _Bool
+#if __STDC_VERSION__ < 199901L && __GNUC__ < 3 && !defined(__INTEL_COMPILER)
+typedef int _Bool;
+#endif
+
+#endif /* !__cplusplus */
+#endif /* __bool_true_false_are_defined */
diff --git a/include/lib/xlat_tables/xlat_tables.h b/include/lib/xlat_tables/xlat_tables.h
index 4e85503..38150f5 100644
--- a/include/lib/xlat_tables/xlat_tables.h
+++ b/include/lib/xlat_tables/xlat_tables.h
@@ -108,7 +108,7 @@
/* Generic translation table APIs */
void init_xlat_tables(void);
void mmap_add_region(unsigned long long base_pa, uintptr_t base_va,
- size_t size, unsigned int attr);
+ size_t size, mmap_attr_t attr);
void mmap_add(const mmap_region_t *mm);
#endif /*__ASSEMBLY__*/
diff --git a/include/lib/xlat_tables/xlat_tables_v2.h b/include/lib/xlat_tables/xlat_tables_v2.h
index 16b857c..d1704b7 100644
--- a/include/lib/xlat_tables/xlat_tables_v2.h
+++ b/include/lib/xlat_tables/xlat_tables_v2.h
@@ -114,7 +114,7 @@
* be added before initializing the MMU and cannot be removed later.
*/
void mmap_add_region(unsigned long long base_pa, uintptr_t base_va,
- size_t size, unsigned int attr);
+ size_t size, mmap_attr_t attr);
/*
* Add a region with defined base PA and base VA. This type of region can be
@@ -128,7 +128,7 @@
* EPERM: It overlaps another region in an invalid way.
*/
int mmap_add_dynamic_region(unsigned long long base_pa, uintptr_t base_va,
- size_t size, unsigned int attr);
+ size_t size, mmap_attr_t attr);
/*
* Add an array of static regions with defined base PA and base VA. This type
diff --git a/lib/xlat_tables/xlat_tables_common.c b/lib/xlat_tables/xlat_tables_common.c
index 4b25d0e..4426cce 100644
--- a/lib/xlat_tables/xlat_tables_common.c
+++ b/lib/xlat_tables/xlat_tables_common.c
@@ -87,7 +87,7 @@
}
void mmap_add_region(unsigned long long base_pa, uintptr_t base_va,
- size_t size, unsigned int attr)
+ size_t size, mmap_attr_t attr)
{
mmap_region_t *mm = mmap;
mmap_region_t *mm_last = mm + ARRAY_SIZE(mmap) - 1;
@@ -199,7 +199,7 @@
}
}
-static uint64_t mmap_desc(unsigned attr, unsigned long long addr_pa,
+static uint64_t mmap_desc(mmap_attr_t attr, unsigned long long addr_pa,
int level)
{
uint64_t desc;
@@ -277,11 +277,11 @@
* attributes of the innermost region that contains it. If there are partial
* overlaps, it returns -1, as a smaller size is needed.
*/
-static int mmap_region_attr(mmap_region_t *mm, uintptr_t base_va,
+static mmap_attr_t mmap_region_attr(mmap_region_t *mm, uintptr_t base_va,
size_t size)
{
/* Don't assume that the area is contained in the first region */
- int attr = -1;
+ mmap_attr_t attr = -1;
/*
* Get attributes from last (innermost) region that contains the
@@ -360,7 +360,8 @@
* there are partially overlapping regions. On success,
* it will return the innermost region's attributes.
*/
- int attr = mmap_region_attr(mm, base_va, level_size);
+ mmap_attr_t attr = mmap_region_attr(mm, base_va,
+ level_size);
if (attr >= 0) {
desc = mmap_desc(attr,
base_va - mm->base_va + mm->base_pa,
diff --git a/lib/xlat_tables_v2/xlat_tables_common.c b/lib/xlat_tables_v2/xlat_tables_common.c
index b4691a2..7ca81b9 100644
--- a/lib/xlat_tables_v2/xlat_tables_common.c
+++ b/lib/xlat_tables_v2/xlat_tables_common.c
@@ -92,7 +92,7 @@
};
void mmap_add_region(unsigned long long base_pa, uintptr_t base_va,
- size_t size, unsigned int attr)
+ size_t size, mmap_attr_t attr)
{
mmap_region_t mm = {
.base_va = base_va,
@@ -114,7 +114,7 @@
#if PLAT_XLAT_TABLES_DYNAMIC
int mmap_add_dynamic_region(unsigned long long base_pa,
- uintptr_t base_va, size_t size, unsigned int attr)
+ uintptr_t base_va, size_t size, mmap_attr_t attr)
{
mmap_region_t mm = {
.base_va = base_va,
diff --git a/lib/xlat_tables_v2/xlat_tables_internal.c b/lib/xlat_tables_v2/xlat_tables_internal.c
index 2f03306..581f770 100644
--- a/lib/xlat_tables_v2/xlat_tables_internal.c
+++ b/lib/xlat_tables_v2/xlat_tables_internal.c
@@ -115,7 +115,7 @@
#endif /* PLAT_XLAT_TABLES_DYNAMIC */
/* Returns a block/page table descriptor for the given level and attributes. */
-static uint64_t xlat_desc(unsigned int attr, unsigned long long addr_pa,
+static uint64_t xlat_desc(mmap_attr_t attr, unsigned long long addr_pa,
int level)
{
uint64_t desc;
@@ -609,7 +609,7 @@
*/
static int mmap_add_region_check(xlat_ctx_t *ctx, unsigned long long base_pa,
uintptr_t base_va, size_t size,
- unsigned int attr)
+ mmap_attr_t attr)
{
mmap_region_t *mm = ctx->mmap;
unsigned long long end_pa = base_pa + size - 1;
diff --git a/services/spd/tspd/tspd_main.c b/services/spd/tspd/tspd_main.c
index ff515cc..e5ec5cd 100644
--- a/services/spd/tspd/tspd_main.c
+++ b/services/spd/tspd/tspd_main.c
@@ -631,7 +631,7 @@
cm_el1_sysregs_context_restore(NON_SECURE);
cm_set_next_eret_context(NON_SECURE);
- SMC_RET0(handle);
+ SMC_RET1(handle, SMC_OK);
/*
* Request from non secure world to resume the preempted
diff --git a/tools/fiptool/fiptool.c b/tools/fiptool/fiptool.c
index 542a946..0503696 100644
--- a/tools/fiptool/fiptool.c
+++ b/tools/fiptool/fiptool.c
@@ -646,7 +646,7 @@
unsigned long align;
errno = 0;
- align = strtoul(arg, &endptr, 10);
+ align = strtoul(arg, &endptr, 0);
if (*endptr != '\0' || !is_power_of_2(align) || errno != 0)
log_errx("Invalid alignment: %s", arg);