region.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
  2. * Use of this source code is governed by a BSD-style license that can be
  3. * found in the LICENSE file.
  4. *
  5. * Access to portions of the firmware image, perhaps later to be expanded
  6. * to other devices.
  7. */
  8. #ifndef VBOOT_REFERENCE_REGION_H_
  9. #define VBOOT_REFERENCE_REGION_H_
  10. #include "bmpblk_header.h"
  11. #include "gbb_header.h"
  12. #include "vboot_api.h"
  13. #include "vboot_struct.h"
  14. /* The maximum length of a hardware ID */
  15. #define VB_REGION_HWID_LEN 256
  16. /**
  17. * Read data from a region
  18. *
  19. * @param cparams Vboot common parameters
  20. * @param region Region number to read
  21. * @param offset Offset within region to start reading
  22. * @param size Size of data to read
  23. * @param buf Buffer to put the data into
  24. * @return VBERROR_... error, VBERROR_SUCCESS on success,
  25. */
  26. VbError_t VbRegionReadData(VbCommonParams *cparams,
  27. enum vb_firmware_region region, uint32_t offset,
  28. uint32_t size, void *buf);
  29. /**
  30. * Check the version of the GBB and print debug information if valid
  31. *
  32. * @param cparams Vboot common parameters
  33. */
  34. void VbRegionCheckVersion(VbCommonParams *cparams);
  35. /**
  36. * Read the hardware ID from the GBB
  37. *
  38. * @param cparams Vboot common parameters
  39. * @param hwid Place to put HWID, which will be null-terminated
  40. * @param max_size Maximum size of HWID including terminated null
  41. * character (suggest VB_REGION_HWID_LEN). If this size
  42. * it too small then VBERROR_INVALID_PARAMETER is
  43. * returned.
  44. * @return VBERROR_... error, VBERROR_SUCCESS on success,
  45. */
  46. VbError_t VbRegionReadHWID(VbCommonParams *cparams, char *hwid,
  47. uint32_t max_size);
  48. #endif /* VBOOT_REFERENCE_REGION_H_ */