From bb756eebdac6fd24e8919e2c43f7d2c8c4091f59 Mon Sep 17 00:00:00 2001 From: RajithaY Date: Tue, 25 Apr 2017 03:31:15 -0700 Subject: Adding qemu as a submodule of KVMFORNFV This Patch includes the changes to add qemu as a submodule to kvmfornfv repo and make use of the updated latest qemu for the execution of all testcase Change-Id: I1280af507a857675c7f81d30c95255635667bdd7 Signed-off-by:RajithaY --- qemu/roms/SLOF/lib/libnvram/envvar.c | 243 ----------------------------------- 1 file changed, 243 deletions(-) delete mode 100644 qemu/roms/SLOF/lib/libnvram/envvar.c (limited to 'qemu/roms/SLOF/lib/libnvram/envvar.c') diff --git a/qemu/roms/SLOF/lib/libnvram/envvar.c b/qemu/roms/SLOF/lib/libnvram/envvar.c deleted file mode 100644 index ee943fce5..000000000 --- a/qemu/roms/SLOF/lib/libnvram/envvar.c +++ /dev/null @@ -1,243 +0,0 @@ -/****************************************************************************** - * Copyright (c) 2004, 2008 IBM Corporation - * All rights reserved. - * This program and the accompanying materials - * are made available under the terms of the BSD License - * which accompanies this distribution, and is available at - * http://www.opensource.org/licenses/bsd-license.php - * - * Contributors: - * IBM Corporation - initial implementation - *****************************************************************************/ - -#include -#include "../libc/include/stdio.h" -#include "../libc/include/string.h" -#include "../libc/include/stdlib.h" -#include "nvram.h" - -/* returns the offset of the first byte after the searched envvar */ -static int get_past_env_pos(partition_t part, char *envvar, int evlen) -{ - int offset, len; - static char temp[256]; - uint8_t data; - - offset=part.addr; - - memset(temp, 0, 256); - - do { - len=0; - while((data=nvram_read_byte(offset++)) && len < 256) { - temp[len++]=data; - } - if (!strncmp(envvar, temp, evlen)) { - return offset; - } - } while (len); - - return -1; -} - -/** - * @param partition name of the envvar partition - * @param envvar name of the environment variable - * @param evlen string length of the envvar parameter - * @return pointer to temporary string containing the value of envvar - */ -char *nvram_get_env(partition_t part, char *envvar, int evlen) -{ - static char temp[256+1]; - int len, offset; - uint8_t data; - - DEBUG("nvram_get_env %p... ", envvar); - if(!part.addr) { - /* ERROR: No environment variable partition */ - DEBUG("invalid partition.\n"); - return NULL; - } - - offset=part.addr; - - do { - len=0; - while((data=nvram_read_byte(offset++)) && len < 256) { - temp[len++]=data; - } - temp[len]=0; - - if (!strncmp(envvar, temp, evlen)) { - int pos=0; - while (temp[pos]!='=' && pos < len) pos++; - // DEBUG("value='%s'\n", temp+pos+1); - return temp+pos+1; - } - } while (len); - - DEBUG("not found\n"); - return NULL; -} - -static int find_last_envvar(partition_t part) -{ - uint8_t last, current; - int offset; - - offset=part.addr; - - last=nvram_read_byte(part.addr); - - for (offset=part.addr; offset<(int)(part.addr+part.len); offset++) { - current=nvram_read_byte(offset); - if(!last && !current) - return offset; - - last=current; - } - - return -1; -} - -int nvram_add_env(partition_t part, char *envvar, int evlen, char *value, int vallen) -{ - int freespace, last, len, offset; - unsigned int i; - - /* Find offset where we can write */ - last = find_last_envvar(part); - - /* How much space do we have left? */ - freespace = part.addr+part.len-last; - - /* how long is the entry we want to write? */ - len = evlen + vallen + 2; - - if(freespace