diff options
-rw-r--r-- | AMD/identify.c | 8 | ||||
-rw-r--r-- | binary.c | 6 | ||||
-rw-r--r-- | dumpregs.c | 2 | ||||
-rw-r--r-- | features.c | 2 | ||||
-rw-r--r-- | mtrr.c | 12 | ||||
-rw-r--r-- | rdmsr.c | 12 | ||||
-rw-r--r-- | x86info.c | 22 |
7 files changed, 32 insertions, 32 deletions
diff --git a/AMD/identify.c b/AMD/identify.c index 087c0d3..b83d2d3 100644 --- a/AMD/identify.c +++ b/AMD/identify.c @@ -28,7 +28,7 @@ static void set_k8_name(struct k8_rev *r, struct cpudata *c) s[0] = 0; cont = 0; - for (i=0; (r != NULL) && (i<ARRAY_SIZE(k8_names)); i++) { + for (i = 0; (r != NULL) && (i < ARRAY_SIZE(k8_names)); i++) { p = NULL; id = 1<<i; if (r->nameid & id) @@ -54,7 +54,7 @@ static void set_k8_revinfo(int id, struct cpudata *c) c->connector = 0; r = NULL; - for (i=0; i<ARRAY_SIZE(k8_revisions); i++) { + for (i = 0; i < ARRAY_SIZE(k8_revisions); i++) { if (k8_revisions[i].eax == id) { r = &k8_revisions[i]; break; @@ -119,7 +119,7 @@ static void set_fam10h_revinfo(int id, struct cpudata *c) int i; struct fam10h_rev *r = NULL; - for (i=0; i<ARRAY_SIZE(fam10h_revisions); i++) { + for (i = 0; i < ARRAY_SIZE(fam10h_revisions); i++) { if (fam10h_revisions[i].eax == id) { r = &fam10h_revisions[i]; break; @@ -134,7 +134,7 @@ static void set_fam11h_revinfo(int id, struct cpudata *c) const char *p; p = get_fam11h_revision_name(id); - if(p) + if (p) snprintf(c->name, CPU_NAME_LEN, "AMD Turion X2 Ultra Dual-Core (%s)", p); else @@ -13,7 +13,7 @@ void binary(unsigned int n, unsigned long value) { unsigned int i; - for (i=0; i<n; i++, value<<=1) + for (i = 0; i < n; i++, value<<=1) (void)putchar( (1<<(n-1) & value) ? '1' : '0' ); (void)putchar('\n'); } @@ -22,10 +22,10 @@ void binary32(unsigned long value) { int i; - for (i=0;i<32;i++,value<<=1) { + for (i = 0; i < 32; i++,value<<=1) { (void)putchar( (1<<31 & value) ? '1' : '0' ); - if (i==23 || i==15 || i==7) + if (i == 23 || i == 15 || i == 7) (void)putchar(' '); } (void)putchar('\n'); @@ -13,7 +13,7 @@ void dumpregs(int cpunum, unsigned int begin, unsigned int end) unsigned int eax, ebx, ecx, edx; /* Dump all the CPUID results in raw hex */ - for (i=begin; i<=end; i++) { + for (i = begin; i <= end; i++) { cpuid(cpunum, i, &eax, &ebx, &ecx, &edx); printf("eax in: 0x%08x, eax = %08x ebx = %08x ecx = %08x edx = %08x\n", i, eax, ebx, ecx, edx); } @@ -15,7 +15,7 @@ static void flag_decode(unsigned long reg, const char * reg_desc, const char *fl { unsigned int i; - for (i=0; i<32; i++) { + for (i = 0; i < 32; i++) { if (reg & (1<<i)) { if (!verbose) { if (flags[i]) @@ -53,7 +53,7 @@ static void set_max_phy_addr(struct cpudata *cpu) { unsigned int value; - if(!max_phy_addr){ + if (!max_phy_addr) { cpuid(cpu->number, 0x80000008,&value, NULL, NULL, NULL); max_phy_addr = (value & 0xFF); } @@ -81,7 +81,7 @@ static void decode_mtrrcap(int cpu, int msr) int ret; ret = mtrr_value(cpu,msr,&val); - if(ret){ + if (ret) { printf("0x%016llx ", val); printf("(smrr flag: 0x%01x, ",(unsigned int) (val & IA32_MTRRCAP_SMRR) >> 11 ); printf("wc flag: 0x%01x, ",(unsigned int) (val&IA32_MTRRCAP_WC) >> 10); @@ -96,7 +96,7 @@ static void decode_mtrr_deftype(int cpu, int msr) int ret; ret = mtrr_value(cpu,msr,&val); - if(ret){ + if (ret) { printf("0x%016llx ", val); printf("(fixed-range flag: 0x%01x, ",(unsigned int) (val&IA32_MTRR_DEFTYPE_FE) >> 10); printf("mtrr flag: 0x%01x, ",(unsigned int) (val&IA32_MTRR_DEFTYPE_E) >> 11); @@ -111,7 +111,7 @@ static void decode_mtrr_physbase(int cpu, int msr) int ret; ret = mtrr_value(cpu,msr,&val); - if(ret){ + if (ret) { printf("0x%016llx ", val); printf("(physbase field:"); @@ -128,7 +128,7 @@ static void decode_mtrr_physmask(int cpu, int msr) int ret; ret = mtrr_value(cpu,msr,&val); - if(ret){ + if (ret) { printf("0x%016llx ", val); printf("(physmask field:"); @@ -161,7 +161,7 @@ void dump_mtrrs(struct cpudata *cpu) set_max_phy_addr(cpu); - for (i=0; i<16; i+=2) { + for (i = 0; i < 16; i+=2) { printf("MTRRphysBase%u (0x%x): ", i/2, (unsigned int) 0x200+i); decode_mtrr_physbase(cpu->number, 0x200+i); printf("MTRRphysMask%u (0x%x): ", i/2, (unsigned int) 0x201+i); @@ -80,7 +80,7 @@ int read_msr(int cpu, unsigned int idx, unsigned long long *val) (void)snprintf(cpuname, sizeof(cpuname), "/dev/cpu/%d/msr", cpu); fh = open(cpuname, O_RDONLY); - if (fh==-1) { + if (fh == -1) { perror(cpuname); nodriver=1; return 0; @@ -105,7 +105,7 @@ int read_msr(int cpu, unsigned int idx, unsigned long long *val) *val = hi; *val = (*val<<32) | lo; } - if (close(fh)==-1) { + if (close(fh) == -1) { perror("close"); exit(EXIT_FAILURE); } @@ -120,11 +120,11 @@ void dumpmsr(int cpu, unsigned int msr, int size) unsigned long long val=0; if (read_msr(cpu, msr, &val) == 1) { - if (size==32){ + if (size == 32){ printf("MSR: 0x%08x=0x%08lx : ", msr, (unsigned long) val); binary32(val); } - if (size==64) { + if (size == 64) { printf("MSR: 0x%08x=0x%016llx : ", msr, val); binary64(val); } @@ -138,9 +138,9 @@ void dumpmsr_bin(int cpu, unsigned int msr, int size) unsigned long long val=0; if (read_msr(cpu, msr, &val) == 1) { - if (size==32) + if (size == 32) binary32(val); - if (size==64) + if (size == 64) binary64(val); return; } @@ -196,7 +196,7 @@ static void separator(void) { int j; - for (j=0; j<74; j++) + for (j = 0; j < 74; j++) printf("-"); printf("\n"); } @@ -244,7 +244,7 @@ static void display_topology(struct cpudata *head) if (debug == 1) { cpu = head; printf("cpu->phys_proc_id: "); - for (i=0; i<nrCPUs; i++) { + for (i = 0; i < nrCPUs; i++) { printf("%d, ", cpu->phys_proc_id); cpu = cpu->next; } @@ -252,7 +252,7 @@ static void display_topology(struct cpudata *head) cpu = head; printf("cpu->x86_max_cores: "); - for (i=0; i<nrCPUs; i++) { + for (i = 0; i < nrCPUs; i++) { printf("%d, ", cpu->x86_max_cores); cpu = cpu->next; } @@ -260,7 +260,7 @@ static void display_topology(struct cpudata *head) cpu = head; printf("cpu->cpu_core_id: "); - for (i=0; i<nrCPUs; i++) { + for (i = 0; i < nrCPUs; i++) { printf("%d, ", cpu->cpu_core_id); cpu = cpu->next; } @@ -268,19 +268,19 @@ static void display_topology(struct cpudata *head) } sockets = malloc(nrCPUs); - if (sockets==NULL) + if (sockets == NULL) return; - for (i=0; i<nrCPUs; i++) + for (i = 0; i < nrCPUs; i++) sockets[i]=0; cpu = head; - for (i=0; i<nrCPUs; i++) { + for (i = 0; i < nrCPUs; i++) { sockets[cpu->phys_proc_id]++; cpu = cpu->next; } - for (i=0; i<nrCPUs; i++) { + for (i = 0; i < nrCPUs; i++) { if (debug == 1) printf("Socket %d: %d threads\n", i, sockets[i]); if (sockets[i] != 0) /* only count populated sockets */ @@ -371,7 +371,7 @@ int main (int argc, char **argv) /* Iterate over the linked list. */ - for (i=0; i<nrCPUs; i++) { + for (i = 0; i < nrCPUs; i++) { cpu = malloc (sizeof (struct cpudata)); if (!cpu) { printf("Out of memory\n"); @@ -467,14 +467,14 @@ int main (int argc, char **argv) if (cpu->vendor == VENDOR_INTEL) display_topology(head); - printf (" running at an estimated "); + printf(" running at an estimated "); display_MHz(cpu); printf("\n"); out: /* Tear down the linked list. */ cpu = head; - for (i=0; i<nrCPUs; i++) { + for (i = 0; i < nrCPUs; i++) { if (cpu->info_url) free(cpu->info_url); if (cpu->datasheet_url) |