/*
 * Copyright (c) 2018 MediaTek Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files
 * (the "Software"), to deal in the Software without restriction,
 * including without limitation the rights to use, copy, modify, merge,
 * publish, distribute, sublicense, and/or sell copies of the Software,
 * and to permit persons to whom the Software is furnished to do so,
 * subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

#include <env.h>
#include <errno.h>
#include <lib/bio.h>
#include <lib/mempool.h>
#include <malloc.h>
#include <printf.h>
#include <stdint.h>
#include <string.h>
#include <sys/types.h>
#define ENV_PART "para"

#define MODULE_NAME "LK_ENV"
env_t g_env;
static int env_valid;
static char *env_buffer;
static char env_get_char(int index);
static char *env_get_addr(int index);
static int envmatch(uchar *s1, int i2);
static int write_env_area(char *env_buf);
static int read_env_area(char *env_buf);

#ifndef min
#define min(x, y)   (x < y ? x : y)
#endif

void env_init(void)
{
    int ret, i;
    env_buffer = (char *)mempool_alloc(CFG_ENV_SIZE, MEMPOOL_ANY);
    memset(env_buffer, 0x00, CFG_ENV_SIZE);
    g_env.env_data = env_buffer + CFG_ENV_DATA_OFFSET;
    ret = read_env_area(env_buffer);
    int checksum = 0;
    if (ret < 0) {
        printf("[%s]read_env_area fail, ret = %x\n", MODULE_NAME, ret);
        env_valid = 0;
        goto end;
    }

    memcpy(g_env.sig, env_buffer, sizeof(g_env.sig));
    memcpy(g_env.sig_1, env_buffer + CFG_ENV_SIG_1_OFFSET, sizeof(g_env.sig_1));

    if (!strcmp(g_env.sig, ENV_SIG) && !strcmp(g_env.sig_1, ENV_SIG)) {
        g_env.checksum = *((int *)env_buffer + CFG_ENV_CHECKSUM_OFFSET / 4);
        for (i = 0; i < (int)(CFG_ENV_DATA_SIZE); i++) {
            checksum += g_env.env_data[i];
        }
        if (checksum != g_env.checksum) {
            printf("[%s]checksum mismatch s %d d %d!\n", MODULE_NAME, g_env.checksum, checksum);
            env_valid = 0;
            goto end;
        } else {
            printf("[%s]ENV initialize sucess\n", MODULE_NAME);
            env_valid = 1;
        }

    } else {
        printf("[%s]ENV SIG Wrong\n", MODULE_NAME);
        env_valid = 0;
        goto end;
    }
end:
    if (!env_valid) {
        memset(env_buffer, 0x00, CFG_ENV_SIZE);
    }

}

char *get_env(char *name)
{
    int i, nxt;
    printf("[%s]get_env %s\n", MODULE_NAME, name);
    if (!env_valid)
        return NULL;

    for (i = 0; env_get_char(i) != '\0'; i = nxt + 1) {
        int val;

        for (nxt = i; env_get_char(nxt) != '\0'; ++nxt) {
            if (nxt >= CFG_ENV_SIZE) {
                return (NULL);
            }
        }
        if ((val = envmatch((uchar *) name, i)) < 0)
            continue;
        return ((char *)env_get_addr(val));
    }

    return (NULL);
}

static char env_get_char(int index)
{
    return *(g_env.env_data + index);
}

static char *env_get_addr(int index)
{
    return (g_env.env_data + index);

}

static int envmatch(uchar *s1, int i2)
{

    while (*s1 == env_get_char(i2++))
        if (*s1++ == '=')
            return (i2);
    if (*s1 == '\0' && env_get_char(i2 - 1) == '=')
        return (i2);
    return (-1);
}

int set_env(char *name, char *value)
{
    int len, oldval;
    uchar *env, *nxt = NULL;

    int ret;

    uchar *env_data = (uchar *) g_env.env_data;

    printf("[%s]set_env %s %s\n", MODULE_NAME, name, value);

    oldval = -1;

    if (!env_valid) {
        env = env_data;
        goto add;
    }

    for (env = env_data; *env; env = nxt + 1) {
        for (nxt = env; *nxt; ++nxt);
        if ((oldval = envmatch((uchar *) name, env - env_data)) >= 0)
            break;
    }

    if (oldval > 0) {
        if (*++nxt == '\0') {
            if (env > env_data) {
                env--;
            } else {
                *env = '\0';
            }
        } else {
            for (;;) {
                *env = *nxt++;
                if ((*env == '\0') && (*nxt == '\0'))
                    break;
                ++env;
            }
        }
        *++env = '\0';
    }

    for (env = env_data; *env || *(env + 1); ++env);
    if (env > env_data)
        ++env;

add:
    /*
     * Overflow when:
     * "name" + "=" + "val" +"\0\0"  > ENV_SIZE - (env-env_data)
     */
    len = strlen(name) + 2;
    /* add '=' for first arg, ' ' for all others */
    len += strlen(value) + 1;

    if (len > (&env_data[CFG_ENV_DATA_SIZE] - env)) {
        printf("## Error: environment overflow, \"%s\" deleted\n", name);
        return -1;
    }
    while ((*env = *name++) != '\0')
        env++;

    *env = '=';

    while ((*++env = *value++) != '\0');

    /* end is marked with double '\0' */
    *++env = '\0';
    memset(env, 0x00, CFG_ENV_DATA_SIZE - (env - env_data));
    ret = write_env_area(env_buffer);
    if (ret < 0) {
        printf("[%s]write env fail\n", MODULE_NAME);
        memset(env_buffer, 0x00, CFG_ENV_SIZE);
        return -1;
    }
    env_valid = 1;
    return 0;

}

void print_env()
{
    int i, nxt;
    uchar *env = (uchar *) g_env.env_data;
    if (!env_valid) {
        printf("[%s]no valid env\n", MODULE_NAME);
        return;
    }
    printf("[%s]env:\n", MODULE_NAME);
    for (i = 0; env_get_char(i) != '\0'; i = nxt + 1) {
        for (nxt = i; env_get_char(nxt) != '\0'; ++nxt) {
            if (nxt >= (int)(CFG_ENV_DATA_SIZE)) {
                return;
            }
        }
        printf("%s\n", env + i);
    }
}

static int write_env_area(char *env_buf)
{
#if 0 //nelson
    part_t *part;
    part_dev_t *dev;
    size_t count;
    long len;
    int i, checksum = 0;
    unsigned long long start_addr;

    dev = mt_part_get_device();
    if (!dev) {
        return -ENODEV;
    }

    part = mt_part_get_partition(ENV_PART);
    if (!part) {
        return -ENOENT;
    }

    start_addr = (u64) part->start_sect * dev->blkdev->blksz;

    count = min(sizeof(ENV_SIG), sizeof(g_env.sig));
    memcpy(env_buf, ENV_SIG, count);
    memcpy(env_buf + CFG_ENV_SIG_1_OFFSET, ENV_SIG, count);

    for (i = 0; i < (int)CFG_ENV_DATA_SIZE; i++) {
        checksum += *(env_buf + CFG_ENV_DATA_OFFSET + i);
    }
    printf("checksum %d\n", checksum);

    *((int *)env_buf + CFG_ENV_CHECKSUM_OFFSET / 4) = checksum;

    len = dev->write(dev, (uchar *) env_buf, start_addr + CFG_ENV_OFFSET, CFG_ENV_SIZE, part->part_id);
    if (len < 0) {
        return -EIO;
    }
#else
    size_t count;
    long len;
    int i, checksum = 0;

    bdev_t *bdev;

    bdev = bio_open_by_label(ENV_PART);
    if (!bdev) {
        return -ENODEV;
    }

    count = min(sizeof(ENV_SIG), sizeof(g_env.sig));
    memcpy(env_buf, ENV_SIG, count);
    memcpy(env_buf + CFG_ENV_SIG_1_OFFSET, ENV_SIG, count);

    for (i = 0; i < (int)CFG_ENV_DATA_SIZE; i++) {
        checksum += *(env_buf + CFG_ENV_DATA_OFFSET + i);
    }
    dprintf(CRITICAL, "checksum %d\n", checksum);

    *((int *)env_buf + CFG_ENV_CHECKSUM_OFFSET / 4) = checksum;
    len = bio_write(bdev, (uchar *) env_buf, CFG_ENV_OFFSET, CFG_ENV_SIZE);
    if (len < 0) {
        return -EIO;
    }

#endif
    return 0;

}

static int read_env_area(char *env_buf)
{
#if 0 //nelson
    part_t *part;
    part_dev_t *dev;
    long len;
    unsigned long long start_addr;

    dev = mt_part_get_device();
    if (!dev) {
        return -ENODEV;
    }

    part = mt_part_get_partition(ENV_PART);
    if (!part) {
        return -ENOENT;
    }

    start_addr = (u64) part->start_sect * dev->blkdev->blksz;

    len = dev->read(dev, start_addr + CFG_ENV_OFFSET, (uchar *) env_buf, CFG_ENV_SIZE, part->part_id);
    if (len < 0) {
        return -EIO;
    }
#else

    long len;
    bdev_t *bdev;

    bdev = bio_open_by_label(ENV_PART);
    if (!bdev) {
        return -ENODEV;
    }

    len = bio_read(bdev, (uchar *) env_buf, CFG_ENV_OFFSET, CFG_ENV_SIZE);
    if (len < 0) {
        return -EIO;
    }

#endif
    return 0;
}
