Files
OpenCellular/chip/g/board_id.h
Anatol Pomazau 5a910a86be Add support for HW alerts
- Add a vendor command that provides alert counter. Userspace can use
   it e.g. for user metric analysis.
 - Add 'alerts' debug console command. It provides information about
   chip alerts: supported alerts, fuse status, interrupt status, alert
   counter.
 - Add 'alerts fire [INT]' command to fire a software defined alert
   (globalsec/fwN where N is 0,1,2,3).

Signed-off-by: Anatol Pomazau <anatol@google.com>

BUG=b:63523947
TEST=ran the FW at Pyro and checked alerts data sent to host

Change-Id: I7cec0c451ed71076b44dad14a151b147ff1337e8
Reviewed-on: https://chromium-review.googlesource.com/817639
Commit-Ready: Anatol Pomazau <anatol@google.com>
Tested-by: Anatol Pomazau <anatol@google.com>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2018-01-31 13:47:15 -08:00

69 lines
1.9 KiB
C

/*
* Copyright 2017 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.
*/
#ifndef __EC_CHIP_G_BOARD_ID_H
#define __EC_CHIP_G_BOARD_ID_H
#include "common.h"
#include "signed_header.h"
#include "util.h"
/* Structure holding Board ID */
struct board_id {
uint32_t type; /* Board type */
uint32_t type_inv; /* Board type (inverted) */
uint32_t flags; /* Flags */
};
/* Info1 Board space contents. */
struct info1_board_space {
struct board_id bid;
};
#define INFO_BOARD_ID_SIZE sizeof(struct board_id)
#define INFO_BOARD_SPACE_PROTECT_SIZE 16
/**
* Check the current header vs. the supplied Board ID
*
* @param board_id Pointer to a Board ID structure to check
* @param h Pointer to the currently running image's header
*
* @return 0 if no mismatch, non-zero if mismatch
*/
uint32_t check_board_id_vs_header(const struct board_id *id,
const struct SignedHeader *h);
/**
* Check board ID from the flash INFO1 space.
*
* @param id Pointer to a Board ID structure to fill
*
* @return EC_SUCCESS of an error code in cases of vairous failures to read.
*/
int read_board_id(struct board_id *id);
/**
* Return the image header for the current image copy
*/
const struct SignedHeader *get_current_image_header(void);
/**
* Check if board ID in the image matches board ID field in the INFO1.
*
* Pass the pointer to the image header to check. If the pointer is set to
* NULL, check board ID against the currently running image's header.
*
* Return true if there is a mismatch (the code should not run).
*/
uint32_t board_id_mismatch(const struct SignedHeader *h);
BUILD_ASSERT((offsetof(struct info1_board_space, bid) & 3) == 0);
BUILD_ASSERT((INFO_BOARD_ID_SIZE & 3) == 0);
BUILD_ASSERT(sizeof(struct info1_board_space) <= INFO_BOARD_SPACE_PROTECT_SIZE);
#endif /* ! __EC_CHIP_G_BOARD_ID_H */