blob: a5c5b9640f5f257a86efbfe7704b8bc8cd85537e [file] [log] [blame] [edit]
// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "nvram.h"
namespace tpmd {
class VolatileNvram : public Nvram {
public:
VolatileNvram();
virtual ~VolatileNvram();
virtual bool Allocate(uint32_t slot, size_t len, uint32_t flags);
virtual bool Free(uint32_t slot);
virtual bool Write(uint32_t slot, const Bytes& bytes);
virtual bool Read(uint32_t slot, Bytes* bytes);
virtual bool is_defined(uint32_t slot);
virtual bool is_locked(uint32_t slot);
virtual size_t size(uint32_t slot);
virtual size_t num_slots();
private:
static const unsigned int MAX_SLOTS = 16;
static const unsigned int NVRAM_BASE = 0x20000000;
struct BackingSlot {
bool lockonce_;
bool locked_;
bool defined_;
Bytes bytes_;
};
struct BackingSlot slots_[MAX_SLOTS];
};
} // namespace tpmd