diff options
author | mmel <mmel@FreeBSD.org> | 2016-03-26 06:57:36 +0000 |
---|---|---|
committer | mmel <mmel@FreeBSD.org> | 2016-03-26 06:57:36 +0000 |
commit | 5cbf1d4ad0a3a016425cafa4fb4ae6f2fa59c6e4 (patch) | |
tree | 499fa9257364860ce5206f5c4dcd83a47749e1c7 /sys/arm | |
parent | fdc6e456335c5c514e10d43763bd81f0773ddfed (diff) | |
download | FreeBSD-src-5cbf1d4ad0a3a016425cafa4fb4ae6f2fa59c6e4.zip FreeBSD-src-5cbf1d4ad0a3a016425cafa4fb4ae6f2fa59c6e4.tar.gz |
ARM: Fix ATAG handling in LINUX_BOOT_API:
- Don't convert atags address passed from U-Boot. It's real physical
address (and we have 1:1 mapping).
- Size of tags is encoded in words, not in bytes
Diffstat (limited to 'sys/arm')
-rw-r--r-- | sys/arm/arm/machdep.c | 17 | ||||
-rw-r--r-- | sys/arm/include/atags.h | 2 |
2 files changed, 12 insertions, 7 deletions
diff --git a/sys/arm/arm/machdep.c b/sys/arm/arm/machdep.c index dd4aeaf..e4f8b9d 100644 --- a/sys/arm/arm/machdep.c +++ b/sys/arm/arm/machdep.c @@ -1035,6 +1035,7 @@ linux_parse_boot_param(struct arm_boot_params *abp) struct arm_lbabi_tag *walker; uint32_t revision; uint64_t serial; + int size; #ifdef FDT struct fdt_header *dtb_ptr; uint32_t dtb_size; @@ -1061,8 +1062,7 @@ linux_parse_boot_param(struct arm_boot_params *abp) return (0); board_id = abp->abp_r1; - walker = (struct arm_lbabi_tag *) - (abp->abp_r2 + KERNVIRTADDR - abp->abp_physaddr); + walker = (struct arm_lbabi_tag *)abp->abp_r2; if (ATAG_TAG(walker) != ATAG_CORE) return 0; @@ -1079,8 +1079,9 @@ linux_parse_boot_param(struct arm_boot_params *abp) case ATAG_INITRD2: break; case ATAG_SERIAL: - serial = walker->u.tag_sn.low | - ((uint64_t)walker->u.tag_sn.high << 32); + serial = walker->u.tag_sn.high; + serial <<= 32; + serial |= walker->u.tag_sn.low; board_set_serial(serial); break; case ATAG_REVISION: @@ -1089,8 +1090,12 @@ linux_parse_boot_param(struct arm_boot_params *abp) break; case ATAG_CMDLINE: /* XXX open question: Parse this for boothowto? */ - bcopy(walker->u.tag_cmd.command, linux_command_line, - ATAG_SIZE(walker)); + size = ATAG_SIZE(walker) - + sizeof(struct arm_lbabi_header); + size = min(size, sizeof(linux_command_line) - 1); + strncpy(linux_command_line, walker->u.tag_cmd.command, + size); + linux_command_line[size] = '\0'; break; default: break; diff --git a/sys/arm/include/atags.h b/sys/arm/include/atags.h index 3665890..6d400af 100644 --- a/sys/arm/include/atags.h +++ b/sys/arm/include/atags.h @@ -123,7 +123,7 @@ struct arm_lbabi_tag }; #define ATAG_TAG(a) (a)->tag_hdr.tag -#define ATAG_SIZE(a) (a)->tag_hdr.size +#define ATAG_SIZE(a) ((a)->tag_hdr.size * sizeof(uint32_t)) #define ATAG_NEXT(a) (struct arm_lbabi_tag *)((char *)(a) + ATAG_SIZE(a)) #endif /* __MACHINE_ATAGS_H__ */ |