summaryrefslogtreecommitdiff
path: root/disk
diff options
context:
space:
mode:
authorAnton staaf <robotboy@chromium.org>2011-10-12 13:56:04 +0000
committerWolfgang Denk <wd@denx.de>2011-10-25 09:26:34 +0200
commitf75dd584cdfe29dfdcfd424bb237b9238cfb8fe4 (patch)
tree64c18b237725fde2849ccf12c3b96e2a4d815a12 /disk
parenta1969923c90c64ac55f80f14a7ca3ea2c766d079 (diff)
downloadu-boot-f75dd584cdfe29dfdcfd424bb237b9238cfb8fe4.tar.gz
u-boot-f75dd584cdfe29dfdcfd424bb237b9238cfb8fe4.tar.bz2
u-boot-f75dd584cdfe29dfdcfd424bb237b9238cfb8fe4.zip
part_efi: dcache: allocate cacheline aligned buffers
Currently part_efi.c allocates buffers for the gpt_header, the legacy_mbr, and the pte (partition table entry) that may be incorrectly aligned for DMA operations. This patch uses ALLOC_CACHE_ALIGN_BUFFER for the stack allocated buffers and memalign to replace the malloc of the pte. Signed-off-by: Anton Staaf <robotboy@chromium.org> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Mike Frysinger <vapier@gentoo.org> Cc: Albert ARIBAUD <albert.u.boot@aribaud.net> Acked-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'disk')
-rw-r--r--disk/part_efi.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/disk/part_efi.c b/disk/part_efi.c
index 0a513c6ed0..e5917242ae 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -120,7 +120,7 @@ static char *print_efiname(gpt_entry *pte)
void print_part_efi(block_dev_desc_t * dev_desc)
{
- gpt_header gpt_head;
+ ALLOC_CACHE_ALIGN_BUFFER(gpt_header, gpt_head, 1);
gpt_entry **pgpt_pte = NULL;
int i = 0;
@@ -130,7 +130,7 @@ void print_part_efi(block_dev_desc_t * dev_desc)
}
/* This function validates AND fills in the GPT header and PTE */
if (is_gpt_valid(dev_desc, GPT_PRIMARY_PARTITION_TABLE_LBA,
- &(gpt_head), pgpt_pte) != 1) {
+ gpt_head, pgpt_pte) != 1) {
printf("%s: *** ERROR: Invalid GPT ***\n", __FUNCTION__);
return;
}
@@ -138,7 +138,7 @@ void print_part_efi(block_dev_desc_t * dev_desc)
debug("%s: gpt-entry at 0x%08X\n", __FUNCTION__, (unsigned int)*pgpt_pte);
printf("Part\tName\t\t\tStart LBA\tEnd LBA\n");
- for (i = 0; i < le32_to_int(gpt_head.num_partition_entries); i++) {
+ for (i = 0; i < le32_to_int(gpt_head->num_partition_entries); i++) {
if (is_pte_valid(&(*pgpt_pte)[i])) {
printf("%3d\t%-18s\t0x%08llX\t0x%08llX\n", (i + 1),
@@ -161,7 +161,7 @@ void print_part_efi(block_dev_desc_t * dev_desc)
int get_partition_info_efi(block_dev_desc_t * dev_desc, int part,
disk_partition_t * info)
{
- gpt_header gpt_head;
+ ALLOC_CACHE_ALIGN_BUFFER(gpt_header, gpt_head, 1);
gpt_entry **pgpt_pte = NULL;
/* "part" argument must be at least 1 */
@@ -172,7 +172,7 @@ int get_partition_info_efi(block_dev_desc_t * dev_desc, int part,
/* This function validates AND fills in the GPT header and PTE */
if (is_gpt_valid(dev_desc, GPT_PRIMARY_PARTITION_TABLE_LBA,
- &(gpt_head), pgpt_pte) != 1) {
+ gpt_head, pgpt_pte) != 1) {
printf("%s: *** ERROR: Invalid GPT ***\n", __FUNCTION__);
return -1;
}
@@ -201,11 +201,11 @@ int get_partition_info_efi(block_dev_desc_t * dev_desc, int part,
int test_part_efi(block_dev_desc_t * dev_desc)
{
- legacy_mbr legacymbr;
+ ALLOC_CACHE_ALIGN_BUFFER(legacy_mbr, legacymbr, 1);
/* Read legacy MBR from block 0 and validate it */
- if ((dev_desc->block_read(dev_desc->dev, 0, 1, (ulong *) & legacymbr) != 1)
- || (is_pmbr_valid(&legacymbr) != 1)) {
+ if ((dev_desc->block_read(dev_desc->dev, 0, 1, (ulong *)legacymbr) != 1)
+ || (is_pmbr_valid(legacymbr) != 1)) {
return -1;
}
return 0;
@@ -388,7 +388,7 @@ static gpt_entry *alloc_read_gpt_entries(block_dev_desc_t * dev_desc,
/* Allocate memory for PTE, remember to FREE */
if (count != 0) {
- pte = malloc(count);
+ pte = memalign(CONFIG_SYS_CACHELINE_SIZE, count);
}
if (count == 0 || pte == NULL) {