Home | History | Annotate | Download | only in include
      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 
      9 #ifndef VBOOT_REFERENCE_REGION_H_
     10 #define VBOOT_REFERENCE_REGION_H_
     11 
     12 #include "bmpblk_header.h"
     13 #include "gbb_header.h"
     14 #include "vboot_api.h"
     15 #include "vboot_struct.h"
     16 
     17 /* The maximum length of a hardware ID */
     18 #define VB_REGION_HWID_LEN	256
     19 
     20 /**
     21  * Read data from a region
     22  *
     23  * @param cparams	Vboot common parameters
     24  * @param region	Region number to read
     25  * @param offset	Offset within region to start reading
     26  * @param size		Size of data to read
     27  * @param buf		Buffer to put the data into
     28  * @return VBERROR_... error, VBERROR_SUCCESS on success,
     29  */
     30 VbError_t VbRegionReadData(VbCommonParams *cparams,
     31 			   enum vb_firmware_region region, uint32_t offset,
     32 			   uint32_t size, void *buf);
     33 
     34 /**
     35  * Check the version of the GBB and print debug information if valid
     36  *
     37  * @param cparams	Vboot common parameters
     38  */
     39 void VbRegionCheckVersion(VbCommonParams *cparams);
     40 
     41 /**
     42  * Read the hardware ID from the GBB
     43  *
     44  * @param cparams	Vboot common parameters
     45  * @param hwid		Place to put HWID, which will be null-terminated
     46  * @param max_size	Maximum size of HWID including terminated null
     47  *			character (suggest VB_REGION_HWID_LEN). If this size
     48  *			it too small then VBERROR_INVALID_PARAMETER is
     49  *			returned.
     50  * @return VBERROR_... error, VBERROR_SUCCESS on success,
     51  */
     52 VbError_t VbRegionReadHWID(VbCommonParams *cparams, char *hwid,
     53 			   uint32_t max_size);
     54 
     55 #endif  /* VBOOT_REFERENCE_REGION_H_ */
     56