Commit b8efe5b2 authored by Marek Vasut's avatar Marek Vasut

mxssb: Get rid of asm/byteorder.h header

This header is present only on Linux, so get rid of it. The problem
is that we can no longer use __cpu_to_be16() function, which is Linux
specific. This function can be replaced in a slightly hackish way by
using the htons() call, as they do the same thing -- convert uint16_t
from the host endianness to the network endianness (which is BE). The
same goes the other way around, from __be16_to_cpu() is replaced by
ntohs(), which is again a slight hack.
Signed-off-by: Marek Vasut's avatarMarek Vasut <marex@denx.de>
parent ea88b671
......@@ -21,8 +21,6 @@
#include <unistd.h>
#include <limits.h>
#include <asm/byteorder.h>
#include <openssl/evp.h>
#include "mxssb.h"
......@@ -1072,13 +1070,13 @@ static int sb_prefill_image_header(struct sb_image_ctx *ictx)
hdr->minor_version = SB_VERSION_MINOR;
/* Boot image major version */
hdr->product_version.major = __cpu_to_be16(0x999);
hdr->product_version.minor = __cpu_to_be16(0x999);
hdr->product_version.revision = __cpu_to_be16(0x999);
hdr->product_version.major = htons(0x999);
hdr->product_version.minor = htons(0x999);
hdr->product_version.revision = htons(0x999);
/* Boot image major version */
hdr->component_version.major = __cpu_to_be16(0x999);
hdr->component_version.minor = __cpu_to_be16(0x999);
hdr->component_version.revision = __cpu_to_be16(0x999);
hdr->component_version.major = htons(0x999);
hdr->component_version.minor = htons(0x999);
hdr->component_version.revision = htons(0x999);
/* Drive tag must be 0x0 for i.MX23 */
hdr->drive_tag = 0;
......@@ -1388,13 +1386,13 @@ static int sb_verify_image_header(struct sb_image_ctx *ictx,
return ret;
fprintf(stdout, "%s Product version: %x.%x.%x\n", stat[0],
__be16_to_cpu(hdr->product_version.major),
__be16_to_cpu(hdr->product_version.minor),
__be16_to_cpu(hdr->product_version.revision));
ntohs(hdr->product_version.major),
ntohs(hdr->product_version.minor),
ntohs(hdr->product_version.revision));
fprintf(stdout, "%s Component version: %x.%x.%x\n", stat[0],
__be16_to_cpu(hdr->component_version.major),
__be16_to_cpu(hdr->component_version.minor),
__be16_to_cpu(hdr->component_version.revision));
ntohs(hdr->component_version.major),
ntohs(hdr->component_version.minor),
ntohs(hdr->component_version.revision));
if (hdr->flags & ~SB_IMAGE_FLAG_VERBOSE)
ret = -EINVAL;
......
......@@ -18,6 +18,7 @@
#define __MXSSB_H__
#include <stdint.h>
#include <arpa/inet.h>
#define SB_BLOCK_SIZE 16
......@@ -96,7 +97,7 @@ struct sb_ivt_header {
#define SB_HAB_IVT_HEADER(size) \
( \
(SB_HAB_IVT_TAG << 24) | \
(__cpu_to_be16(size) << 16) | \
(htons(size) << 16) | \
SB_HAB_VERSION \
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment