crossystem: Remove platform_family field

This field doesn't seem to be used for anyone and it keeps adding work
for people trying to bring up new platforms. If we ever needed something
like this again, we'd probably prefer to have it in mosys now anyway.
Let's get rid of it.

BRANCH=None
BUG=chromium:551715
TEST=Built for Falco and Jerry.

Change-Id: I6b96e255968fdd22a345d4a75bfdc1e79d3f5896
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/311345
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Bernie Thompson <bhthompson@chromium.org>
diff --git a/host/arch/arm/lib/crossystem_arch.c b/host/arch/arm/lib/crossystem_arch.c
index ff59da1..76c6d3a 100644
--- a/host/arch/arm/lib/crossystem_arch.c
+++ b/host/arch/arm/lib/crossystem_arch.c
@@ -50,26 +50,6 @@
 #define SECTOR_SIZE 512
 #define MAX_NMMCBLK 9
 
-typedef struct PlatformFamily {
-  const char* compatible_string; /* Last string in FDT compatible entry */
-  const char* platform_string;   /* String to return */
-} PlatformFamily;
-
-/* Array of platform family names, terminated with a NULL entry */
-const PlatformFamily platform_family_array[] = {
-  {"nvidia,tegra124", "Tegra5"},
-  {"nvidia,tegra250", "Tegra2"},
-  {"nvidia,tegra20", "Tegra2"},
-  {"ti,omap4", "OMAP4"},
-  {"ti,omap3", "OMAP3"},
-  {"samsung,exynos4210", "EXYNOS4"},
-  {"samsung,exynos5250", "EXYNOS5"},
-  {"samsung,exynos5420", "EXYNOS5"},
-  {"qcom,ipq8064", "IPQ8064"},
-  /* Terminate with NULL entry */
-  {NULL, NULL}
-};
-
 static int InAndroid() {
   int fd;
   struct stat s;
@@ -201,37 +181,6 @@
   return (char *)str;
 }
 
-static char * ReadFdtPlatformFamily(void) {
-  char *compat = NULL;
-  char *s;
-  const PlatformFamily* p;
-  size_t size = 0;
-  int slen;
-
-  if(ReadFdtBlock(FDT_COMPATIBLE_PATH, (void **)&compat, &size))
-    return NULL;
-
-  if (size > 0)
-    compat[size-1] = 0;
-
-  /* Check each null separated string in compatible against the family array */
-  s = compat;
-  while ((s-compat) < size) {
-    slen = strlen(s);
-    for (p = platform_family_array; p->compatible_string; p++) {
-      if (!strcmp(s, p->compatible_string)) {
-        free(compat);
-        return strdup(p->platform_string);
-      }
-    }
-    s += slen + 1;
-  }
-
-  /* No recognized 'compatible' entry found */
-  free(compat);
-  return NULL;
-}
-
 static int VbGetPlatformGpioStatus(const char* name) {
   char gpio_name[FNAME_SIZE];
   unsigned value;
@@ -593,9 +542,6 @@
   if (prop)
     str = ReadFdtString(prop);
 
-  if (!strcasecmp(name, "platform_family"))
-    str = ReadFdtPlatformFamily();
-
   if (str) {
       rv = StrCopy(dest, str, size);
       free(str);
diff --git a/host/arch/x86/lib/crossystem_arch.c b/host/arch/x86/lib/crossystem_arch.c
index 8819f5f..8de9edc 100644
--- a/host/arch/x86/lib/crossystem_arch.c
+++ b/host/arch/x86/lib/crossystem_arch.c
@@ -92,36 +92,11 @@
 #define PCI_VENDOR_ID_PATH "/sys/bus/pci/devices/0000:00:00.0/vendor"
 #define PCI_DEVICE_ID_PATH "/sys/bus/pci/devices/0000:00:00.0/device"
 
-typedef struct PlatformFamily {
-  unsigned int vendor;          /* Vendor id value */
-  unsigned int device;          /* Device id value */
-  const char* platform_string; /* String to return */
-} PlatformFamily;
-
 typedef struct {
   unsigned int base;
   unsigned int uid;
 } Basemapping;
 
-/* Array of platform family names, terminated with a NULL entry */
-const PlatformFamily platform_family_array[] = {
-  {0x8086, 0xA010, "PineTrail"},
-  {0x8086, 0x3406, "Westmere"},
-  {0x8086, 0x0104, "SandyBridge"}, /* mobile */
-  {0x8086, 0x0100, "SandyBridge"}, /* desktop */
-  {0x8086, 0x0154, "IvyBridge"},   /* mobile */
-  {0x8086, 0x0150, "IvyBridge"},   /* desktop */
-  {0x8086, 0x0a04, "Haswell"},     /* ult */
-  {0x8086, 0x0c04, "Haswell"},     /* mobile */
-  {0x8086, 0x0f00, "BayTrail"},    /* mobile */
-  {0x8086, 0x1604, "Broadwell"},   /* ult */
-  {0x8086, 0x2280, "Braswell"},    /* ult */
-  {0x8086, 0x1904, "Skylake"},     /* skylake-u */
-  {0x8086, 0x190c, "Skylake"},     /* skylake-y */
-  /* Terminate with NULL entry */
-  {0, 0, 0}
-};
-
 static void VbFixCmosChecksum(FILE* file) {
   int fd = fileno(file);
   ioctl(fd, NVRAM_SETCKS);
@@ -474,40 +449,6 @@
   }
 }
 
-/* Determine the platform family and return it in the dest string.
- * This uses the PCI Bus 0, Device 0, Function 0 vendor and device id values
- * taken from sysfs to determine the platform family. This assumes there will
- * be a unique pair of values here for any given platform.
- */
-static char* ReadPlatformFamilyString(char* dest, int size) {
-  FILE* f;
-  const PlatformFamily* p;
-  unsigned int v = 0xFFFF;
-  unsigned int d = 0xFFFF;
-
-  f = fopen(PCI_VENDOR_ID_PATH, "rt");
-  if (!f)
-    return NULL;
-  if(fscanf(f, "0x%4x", &v) != 1)
-    return NULL;
-  fclose(f);
-
-  f = fopen(PCI_DEVICE_ID_PATH, "rt");
-  if (!f)
-    return NULL;
-  if(fscanf(f, "0x%4x", &d) != 1)
-    return NULL;
-  fclose(f);
-
-  for (p = platform_family_array; p->vendor; p++) {
-    if((v == p->vendor) && (d == p->device))
-      return StrCopy(dest, p->platform_string, size);
-  }
-
-  /* No recognized platform family was found */
-  return NULL;
-}
-
 /* Physical GPIO number <N> may be accessed through /sys/class/gpio/gpio<M>/,
  * but <N> and <M> may differ by some offset <O>. To determine that constant,
  * we look for a directory named /sys/class/gpio/gpiochip<O>/. If there's not
@@ -904,8 +845,6 @@
       default:
         return NULL;
     }
-  } else if (!strcasecmp(name,"platform_family")) {
-    return ReadPlatformFamilyString(dest, size);
   }
 
   return NULL;
diff --git a/utility/crossystem.c b/utility/crossystem.c
index a1ef6e0..9b30e5a 100644
--- a/utility/crossystem.c
+++ b/utility/crossystem.c
@@ -74,7 +74,6 @@
   {"mainfw_type", IS_STRING, "Active main firmware type"},
   {"nvram_cleared", CAN_WRITE, "Have NV settings been lost?  Write 0 to clear"},
   {"oprom_needed", CAN_WRITE, "Should we load the VGA Option ROM at boot?"},
-  {"platform_family", IS_STRING, "Platform family type"},
   {"recovery_reason", 0, "Recovery mode reason for current boot"},
   {"recovery_request", CAN_WRITE, "Recovery mode request (writable)"},
   {"recovery_subcode", CAN_WRITE, "Recovery reason subcode (writable)"},