Releasing debian version 4.06+dfsg-2.
[syslinux-debian/hramrach.git] / com32 / gpllib / dmi / dmi_cache.c
blob67a43d0bc84cdcc64c7c4464da85d78372403b99
1 /* ----------------------------------------------------------------------- *
3 * Copyright 2009 Pierre-Alexandre Meyer - All Rights Reserved
5 * Some part borrowed from DMI Decode:
7 * (C) 2000-2002 Alan Cox <alan@redhat.com>
8 * (C) 2002-2007 Jean Delvare <khali@linux-fr.org>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, Inc., 53 Temple Place Ste 330,
13 * Boston MA 02111-1307, USA; either version 2 of the License, or
14 * (at your option) any later version; incorporated herein by reference.
16 * ----------------------------------------------------------------------- */
18 #include <dmi/dmi.h>
19 #include <dmi/dmi_cache.h>
20 #include <stdio.h>
23 * 3.3.8 Cache Information (Type 7)
26 const char *dmi_cache_mode(uint8_t code)
28 static const char *mode[] = {
29 "Write Through", /* 0x00 */
30 "Write Back",
31 "Varies With Memory Address",
32 "Unknown" /* 0x03 */
35 return mode[code];
38 const char *dmi_cache_location(uint8_t code)
40 static const char *location[4] = {
41 "Internal", /* 0x00 */
42 "External",
43 "<OUT OF SPEC", /* 0x02 */
44 "Unknown" /* 0x03 */
47 if (location[code] != NULL)
48 return location[code];
49 return out_of_spec;
52 uint16_t dmi_cache_size(uint16_t code)
54 if (code & 0x8000)
55 return (code & 0x7FFF) << 6; /* KB */
56 else
57 return code; /* KB */
60 void dmi_cache_types(uint16_t code, const char *sep, char *array)
62 /* 3.3.8.2 */
63 static const char *types[] = {
64 "Other", /* 0 */
65 "Unknown",
66 "Non-burst",
67 "Burst",
68 "Pipeline Burst",
69 "Synchronous",
70 "Asynchronous" /* 6 */
73 if ((code & 0x007F) == 0)
74 strcpy(array, "None");
75 else {
76 int i;
78 for (i = 0; i <= 6; i++)
79 if (code & (1 << i))
80 sprintf(array, "%s%s", sep, types[i]);
84 const char *dmi_cache_ec_type(uint8_t code)
86 /* 3.3.8.3 */
87 static const char *type[] = {
88 "Other", /* 0x01 */
89 "Unknown",
90 "None",
91 "Parity",
92 "Single-bit ECC",
93 "Multi-bit ECC" /* 0x06 */
96 if (code >= 0x01 && code <= 0x06)
97 return type[code - 0x01];
98 return out_of_spec;
101 const char *dmi_cache_type(uint8_t code)
103 /* 3.3.8.4 */
104 static const char *type[] = {
105 "Other", /* 0x01 */
106 "Unknown",
107 "Instruction",
108 "Data",
109 "Unified" /* 0x05 */
112 if (code >= 0x01 && code <= 0x05)
113 return type[code - 0x01];
114 return out_of_spec;
117 const char *dmi_cache_associativity(uint8_t code)
119 /* 3.3.8.5 */
120 static const char *type[] = {
121 "Other", /* 0x01 */
122 "Unknown",
123 "Direct Mapped",
124 "2-way Set-associative",
125 "4-way Set-associative",
126 "Fully Associative",
127 "8-way Set-associative",
128 "16-way Set-associative", /* 0x08 */
129 "12-way Set-associative",
130 "24-way Set-associative",
131 "32-way Set-associative",
132 "48-way Set-associative",
133 "64-way Set-associative" /* 0x0D */
136 if (code >= 0x01 && code <= 0x0D)
137 return type[code - 0x01];
138 return out_of_spec;