[coreboot-gerrit] Change in coreboot[master]: intelmetool: small cosmetic changes
Maximilian Schander (Code Review)
gerrit at coreboot.org
Sat Oct 28 20:33:39 CEST 2017
Maximilian Schander has uploaded this change for review. ( https://review.coreboot.org/22216
Change subject: intelmetool: small cosmetic changes
......................................................................
intelmetool: small cosmetic changes
Change-Id: I0038a146bd899f150518c4832258a42792abaabb
Signed-off-by: Maximilian Schander <maxschander at googlemail.com>
---
M util/intelmetool/intelmetool.c
M util/intelmetool/me.c
M util/intelmetool/me_status.c
M util/intelmetool/mmap.c
4 files changed, 52 insertions(+), 37 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/16/22216/1
diff --git a/util/intelmetool/intelmetool.c b/util/intelmetool/intelmetool.c
index b918c3e..c156e75 100644
--- a/util/intelmetool/intelmetool.c
+++ b/util/intelmetool/intelmetool.c
@@ -25,6 +25,7 @@
#include "mmap.h"
#include "intelmetool.h"
+#define VENDOR_ID_INTEL 0x8086
#define FD2 0x3428
#define ME_COMMAND_DELAY 10000
@@ -63,7 +64,8 @@
fclose(fp);
}
-static void rehide_me() {
+static void rehide_me(void)
+{
if (fd2 & 0x2) {
printf("Re-hiding MEI device...");
fd2 = *(uint32_t *)(rcba + FD2);
@@ -78,7 +80,8 @@
* Real ME memory is located around top of memory minus 64MB. (I think)
* so we avoid cloning to this part.
*/
-static void dump_me_memory() {
+static void dump_me_memory(void)
+{
uintptr_t me_clone = 0x60000000;
uint8_t *dump;
@@ -107,7 +110,8 @@
}
}
-static int pci_platform_scan() {
+static int pci_platform_scan(void)
+{
struct pci_access *pacc;
struct pci_dev *dev;
char namebuf[1024];
@@ -159,7 +163,9 @@
return 0;
}
-static struct pci_dev *pci_me_interface_scan(const char **name, char *namebuf, int namebuf_size) {
+static struct pci_dev *pci_me_interface_scan(const char **name, char *namebuf,
+ int namebuf_size)
+{
struct pci_access *pacc;
struct pci_dev *dev;
int me = 0;
@@ -174,7 +180,7 @@
pci_fill_info(dev, PCI_FILL_IDENT | PCI_FILL_BASES | PCI_FILL_SIZES | PCI_FILL_CLASS);
*name = pci_lookup_name(pacc, namebuf, namebuf_size,
PCI_LOOKUP_DEVICE, dev->vendor_id, dev->device_id);
- if (dev->vendor_id == 0x8086) {
+ if (dev->vendor_id == VENDOR_ID_INTEL) {
if (PCI_DEV_HAS_SUPPORTED_ME(dev->device_id)) {
me = 1;
break;
@@ -193,7 +199,8 @@
return dev;
}
-static int activate_me() {
+static int activate_me(void)
+{
struct pci_access *pacc;
struct pci_dev *sb;
uint32_t rcba_phys;
@@ -236,7 +243,8 @@
return 0;
}
-static void dump_me_info() {
+static void dump_me_info(void)
+{
struct pci_dev *dev;
uint32_t stat, stat2;
char namebuf[1024];
@@ -257,6 +265,7 @@
if (name == NULL)
name = "<unknown>";
+
printf("MEI found: [%x:%x] %s\n\n", dev->vendor_id, dev->device_id, name);
stat = pci_read_long(dev, 0x40);
printf("ME Status : 0x%x\n", stat);
@@ -268,7 +277,7 @@
intel_me_extend_valid(dev);
printf("\n");
- if ((stat & 0xf000) >> 12 != 0) {
+ if (stat & 0xf000) {
printf("ME: has a broken implementation on your board with this BIOS\n");
}
@@ -328,7 +337,7 @@
};
while ((opt = getopt_long(argc, argv, "vh?sd",
- long_options, &option_index)) != EOF) {
+ long_options, &option_index)) != EOF) {
switch (opt) {
case 'v':
print_version();
diff --git a/util/intelmetool/me.c b/util/intelmetool/me.c
index e9fea6b..a0b56b4 100644
--- a/util/intelmetool/me.c
+++ b/util/intelmetool/me.c
@@ -53,7 +53,8 @@
switch (offset) {
case MEI_H_CSR:
case MEI_ME_CSR_HA:
-/* csr = ptr;
+/*
+ csr = ptr;
if (!csr) {
printf("%-9s[%02x] : ", type, offset);
printf("ERROR: 0x%08x\n", dword);
@@ -61,11 +62,13 @@
}
printf("%-9s[%02x] : ", type, offset);
printf("depth=%u read=%02u write=%02u ready=%u "
- "reset=%u intgen=%u intstatus=%u intenable=%u\n", csr->buffer_depth,
- csr->buffer_read_ptr, csr->buffer_write_ptr,
- csr->ready, csr->reset, csr->interrupt_generate,
- csr->interrupt_status, csr->interrupt_enable);
-*/ break;
+ "reset=%u intgen=%u intstatus=%u intenable=%u\n",
+ csr->buffer_depth, csr->buffer_read_ptr,
+ csr->buffer_write_ptr, csr->ready, csr->reset,
+ csr->interrupt_generate, csr->interrupt_status,
+ csr->interrupt_enable);
+*/
+ break;
case MEI_ME_CB_RW:
case MEI_H_CB_WW:
printf("%-9s[%02x] : ", type, offset);
@@ -580,7 +583,8 @@
mei_base_address = dev->base_addr[0] & ~0xf;
pagerounded = mei_base_address & ~0xfff;
- mei_mmap = map_physical(pagerounded, 0x2000) + mei_base_address - pagerounded;
+ mei_mmap = (uint8_t *) map_physical(pagerounded, 0x2000)
+ + mei_base_address - pagerounded;
if (mei_mmap == NULL) {
printf("Could not map ME setup memory\n");
return 1;
diff --git a/util/intelmetool/me_status.c b/util/intelmetool/me_status.c
index 1de51f4..501848b 100644
--- a/util/intelmetool/me_status.c
+++ b/util/intelmetool/me_status.c
@@ -142,51 +142,50 @@
{
/* Check Current States */
printf("ME: FW Partition Table : %s\n",
- ((hfs & 0x20) >> 5) ? "BAD" : "OK");
+ ((hfs & 0x20) >> 5) ? "BAD" : "OK");
printf("ME: Bringup Loader Failure : %s\n",
- ((hfs & 0x400) >> 10) ? "YES" : "NO");
+ ((hfs & 0x400) >> 10) ? "YES" : "NO");
printf("ME: Firmware Init Complete : %s\n",
- ((hfs & 0x200) >> 9) ? "YES" : "NO");
+ ((hfs & 0x200) >> 9) ? "YES" : "NO");
printf("ME: Manufacturing Mode : %s\n",
- ((hfs & 0x10) >> 4) ? "YES" : "NO");
+ ((hfs & 0x10) >> 4) ? "YES" : "NO");
printf("ME: Boot Options Present : %s\n",
- ((hfs & 0x1000000) >> 24) ? "YES" : "NO");
+ ((hfs & 0x1000000) >> 24) ? "YES" : "NO");
printf("ME: Update In Progress : %s\n",
- ((hfs & 0x800) >> 11) ? "YES" : "NO");
+ ((hfs & 0x800) >> 11) ? "YES" : "NO");
printf("ME: Current Working State : %s\n",
- me_cws_values[hfs & 0xf]);
+ me_cws_values[hfs & 0xf]);
printf("ME: Current Operation State : %s\n",
- me_opstate_values[(hfs & 0x1c0) >> 6]);
+ me_opstate_values[(hfs & 0x1c0) >> 6]);
printf("ME: Current Operation Mode : %s\n",
- me_opmode_values[(hfs & 0xf0000) >> 16]);
+ me_opmode_values[(hfs & 0xf0000) >> 16]);
printf("ME: Error Code : %s\n",
- me_error_values[(hfs & 0xf000) >> 12]);
+ me_error_values[(hfs & 0xf000) >> 12]);
printf("ME: Progress Phase : %s\n",
- me_progress_values[(gmes & 0xf0000000) >> 28]);
+ me_progress_values[(gmes & 0xf0000000) >> 28]);
printf("ME: Power Management Event : %s\n",
- me_pmevent_values[(gmes & 0xf000000) >> 24]);
+ me_pmevent_values[(gmes & 0xf000000) >> 24]);
printf("ME: Progress Phase State : ");
switch ((gmes & 0xf0000000) >> 28) {
case ME_GMES_PHASE_ROM: /* ROM Phase */
- printf("%s",
- me_progress_rom_values[(gmes & 0xff0000) >> 16]);
+ printf("%s", me_progress_rom_values[(gmes & 0xff0000) >> 16]);
break;
case ME_GMES_PHASE_BUP: /* Bringup Phase */
if ((gmes & 0xff0000) >> 16 < ARRAY_SIZE(me_progress_bup_values)
- && me_progress_bup_values[(gmes & 0xff0000) >> 16])
+ && me_progress_bup_values[(gmes & 0xff0000) >> 16])
printf("%s",
- me_progress_bup_values[(gmes & 0xff0000) >> 16]);
+ me_progress_bup_values[(gmes & 0xff0000) >> 16]);
else
printf("0x%02x", (gmes & 0xff0000) >> 16);
break;
case ME_GMES_PHASE_POLICY: /* Policy Module Phase */
if ((gmes & 0xff0000) >> 16 < ARRAY_SIZE(me_progress_policy_values)
- && me_progress_policy_values[(gmes & 0xff0000) >> 16])
+ && me_progress_policy_values[(gmes & 0xff0000) >> 16])
printf("%s",
- me_progress_policy_values[(gmes & 0xff0000) >> 16]);
+ me_progress_policy_values[(gmes & 0xff0000) >> 16]);
else
printf("0x%02x", (gmes & 0xff0000) >> 16);
break;
diff --git a/util/intelmetool/mmap.c b/util/intelmetool/mmap.c
index 2462b22..c67e870 100644
--- a/util/intelmetool/mmap.c
+++ b/util/intelmetool/mmap.c
@@ -20,7 +20,8 @@
#ifndef __DARWIN__
int fd_mem;
-void *map_physical_exact(off_t phys_addr, void *mapto, size_t len) {
+void *map_physical_exact(off_t phys_addr, void *mapto, size_t len)
+{
void *virt_addr;
int err;
@@ -37,7 +38,8 @@
return virt_addr;
}
-void *map_physical(off_t phys_addr, size_t len) {
+void *map_physical(off_t phys_addr, size_t len)
+{
void *virt_addr;
int err;
@@ -53,7 +55,8 @@
return virt_addr;
}
-void unmap_physical(void *virt_addr, size_t len) {
+void unmap_physical(void *virt_addr, size_t len)
+{
munmap(virt_addr, len);
}
#endif
--
To view, visit https://review.coreboot.org/22216
To unsubscribe, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0038a146bd899f150518c4832258a42792abaabb
Gerrit-Change-Number: 22216
Gerrit-PatchSet: 1
Gerrit-Owner: Maximilian Schander <maxschander at googlemail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20171028/e559803a/attachment-0001.html>
More information about the coreboot-gerrit
mailing list