mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-18 01:03:05 +00:00
83d290c56f
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
56 lines
1.3 KiB
C
56 lines
1.3 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* Copyright (c) 2016 Google, Inc
|
|
*
|
|
* Based on code from coreboot src/soc/intel/broadwell/me_status.c
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <errno.h>
|
|
#include <asm/arch/me.h>
|
|
|
|
static inline void me_read_dword_ptr(struct udevice *dev, void *ptr, int offset)
|
|
{
|
|
u32 dword;
|
|
|
|
dm_pci_read_config32(dev, offset, &dword);
|
|
memcpy(ptr, &dword, sizeof(dword));
|
|
}
|
|
|
|
int intel_me_hsio_version(struct udevice *dev, uint16_t *versionp,
|
|
uint16_t *checksump)
|
|
{
|
|
int count;
|
|
u32 hsiover;
|
|
struct me_hfs hfs;
|
|
|
|
/* Query for HSIO version, overloads H_GS and HFS */
|
|
dm_pci_write_config32(dev, PCI_ME_H_GS,
|
|
ME_HSIO_MESSAGE | ME_HSIO_CMD_GETHSIOVER);
|
|
|
|
/* Must wait for ME acknowledgement */
|
|
for (count = ME_RETRY; count > 0; --count) {
|
|
me_read_dword_ptr(dev, &hfs, PCI_ME_HFS);
|
|
if (hfs.bios_msg_ack)
|
|
break;
|
|
udelay(ME_DELAY);
|
|
}
|
|
if (!count) {
|
|
debug("ERROR: ME failed to respond\n");
|
|
return -ETIMEDOUT;
|
|
}
|
|
|
|
/* HSIO version should be in HFS_5 */
|
|
dm_pci_read_config32(dev, PCI_ME_HFS5, &hsiover);
|
|
*versionp = hsiover >> 16;
|
|
*checksump = hsiover & 0xffff;
|
|
|
|
debug("ME: HSIO Version : %d (CRC 0x%04x)\n",
|
|
*versionp, *checksump);
|
|
|
|
/* Reset registers to normal behavior */
|
|
dm_pci_write_config32(dev, PCI_ME_H_GS,
|
|
ME_HSIO_MESSAGE | ME_HSIO_CMD_GETHSIOVER);
|
|
|
|
return 0;
|
|
}
|