Module Name:    src
Committed By:   maxv
Date:           Wed Jul 13 15:35:56 UTC 2016

Modified Files:
        src/sys/arch/amd64/amd64: machdep.c
        src/sys/arch/i386/i386: machdep.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.220 -r1.221 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.755 -r1.756 src/sys/arch/i386/i386/machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amd64/amd64/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.220 src/sys/arch/amd64/amd64/machdep.c:1.221
--- src/sys/arch/amd64/amd64/machdep.c:1.220	Sat Jul  2 07:22:09 2016
+++ src/sys/arch/amd64/amd64/machdep.c	Wed Jul 13 15:35:56 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.220 2016/07/02 07:22:09 maxv Exp $	*/
+/*	$NetBSD: machdep.c,v 1.221 2016/07/13 15:35:56 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -111,7 +111,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.220 2016/07/02 07:22:09 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.221 2016/07/13 15:35:56 maxv Exp $");
 
 /* #define XENDEBUG_LOW  */
 
@@ -217,25 +217,22 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 
 char machine[] = "amd64";		/* CPU "architecture" */
 char machine_arch[] = "x86_64";		/* machine == machine_arch */
 
-extern struct bi_devmatch *x86_alldisks;
-extern int x86_ndisks;
-
 #ifdef CPURESET_DELAY
-int	cpureset_delay = CPURESET_DELAY;
+int cpureset_delay = CPURESET_DELAY;
 #else
-int     cpureset_delay = 2000; /* default to 2s */
+int cpureset_delay = 2000; /* default to 2s */
 #endif
 
-int	cpu_class = CPUCLASS_686;
+int cpu_class = CPUCLASS_686;
 
 #ifdef MTRR
 struct mtrr_funcs *mtrr_funcs;
 #endif
 
-uint64_t	dumpmem_low;
-uint64_t	dumpmem_high;
-int	cpu_class;
-int	use_pae;
+uint64_t dumpmem_low;
+uint64_t dumpmem_high;
+int cpu_class;
+int use_pae;
 
 #ifndef NO_SPARSE_DUMP
 int sparse_dump = 1;
@@ -255,7 +252,7 @@ size_t dump_npages;
 size_t dump_header_size;
 size_t dump_totalbytesleft;
 
-vaddr_t	msgbuf_vaddr;
+vaddr_t msgbuf_vaddr;
 paddr_t msgbuf_paddr;
 
 struct {
@@ -263,9 +260,9 @@ struct {
 	psize_t sz;
 } msgbuf_p_seg[VM_PHYSSEG_MAX];
 unsigned int msgbuf_p_cnt = 0;
-      
-vaddr_t	idt_vaddr;
-paddr_t	idt_paddr;
+
+vaddr_t idt_vaddr;
+paddr_t idt_paddr;
 
 vaddr_t module_start, module_end;
 static struct vm_map module_map_store;
@@ -274,9 +271,9 @@ vaddr_t kern_end;
 
 struct vm_map *phys_map = NULL;
 
-extern	paddr_t avail_start, avail_end;
+extern paddr_t avail_start, avail_end;
 #ifdef XEN
-extern  paddr_t pmap_pa_start, pmap_pa_end;
+extern paddr_t pmap_pa_start, pmap_pa_end;
 #endif
 
 #ifndef XEN
@@ -292,15 +289,15 @@ void (*initclock_func)(void) = xen_initc
  * Size of memory segments, before any memory is stolen.
  */
 phys_ram_seg_t mem_clusters[VM_PHYSSEG_MAX];
-int	mem_cluster_cnt;
+int mem_cluster_cnt;
 
-char	x86_64_doubleflt_stack[4096];
+char x86_64_doubleflt_stack[4096];
 
-int	cpu_dump(void);
-int	cpu_dumpsize(void);
-u_long	cpu_dump_mempagecnt(void);
-void	dodumpsys(void);
-void	dumpsys(void);
+int cpu_dump(void);
+int cpu_dumpsize(void);
+u_long cpu_dump_mempagecnt(void);
+void dodumpsys(void);
+void dumpsys(void);
 
 extern int time_adjusted;	/* XXX no common header */
 
@@ -323,7 +320,7 @@ int dump_header_finish(void);
 int dump_seg_count_range(paddr_t, paddr_t);
 int dumpsys_seg(paddr_t, paddr_t);
 
-void	init_x86_64(paddr_t);
+void init_x86_64(paddr_t);
 
 static int valid_user_selector(struct lwp *, uint64_t);
 
@@ -351,8 +348,7 @@ cpu_startup(void)
 	for (x = 0, sz = 0; x < msgbuf_p_cnt; sz += msgbuf_p_seg[x++].sz)
 		continue;
 
-	msgbuf_vaddr = uvm_km_alloc(kernel_map, sz, 0,
-	    UVM_KMF_VAONLY);
+	msgbuf_vaddr = uvm_km_alloc(kernel_map, sz, 0, UVM_KMF_VAONLY);
 	if (msgbuf_vaddr == 0)
 		panic("failed to valloc msgbuf_vaddr");
 
@@ -360,8 +356,8 @@ cpu_startup(void)
 	for (y = 0, sz = 0; y < msgbuf_p_cnt; y++) {
 		for (x = 0; x < btoc(msgbuf_p_seg[y].sz); x++, sz += PAGE_SIZE)
 			pmap_kenter_pa((vaddr_t)msgbuf_vaddr + sz,
-				       msgbuf_p_seg[y].paddr + x * PAGE_SIZE,
-				       VM_PROT_READ | VM_PROT_WRITE, 0);
+			    msgbuf_p_seg[y].paddr + x * PAGE_SIZE,
+			    VM_PROT_READ|VM_PROT_WRITE, 0);
 	}
 
 	pmap_update(pmap_kernel());
@@ -1598,8 +1594,8 @@ init_x86_64(paddr_t first_avail)
 
 #if !defined(REALBASEMEM) && !defined(REALEXTMEM)
 	/*
-	 * Check to see if we have a memory map from the BIOS (passed
-	 * to us by the boot program.
+	 * Check to see if we have a memory map from the BIOS (passed to us by
+	 * the boot program).
 	 */
 	bim = lookup_bootinfo(BTINFO_MEMMAP);
 	if (bim != NULL && bim->num > 0)
@@ -1607,14 +1603,14 @@ init_x86_64(paddr_t first_avail)
 #endif	/* ! REALBASEMEM && ! REALEXTMEM */
 
 	/*
-	 * If the loop above didn't find any valid segment, fall back to
+	 * If initx86_parse_memmap didn't find any valid segment, fall back to
 	 * former code.
 	 */
 	if (mem_cluster_cnt == 0)
 		initx86_fake_memmap(iomem_ex);
 
 #else	/* XEN */
-	/* Parse Xen command line (replace bootinfo */
+	/* Parse Xen command line (replace bootinfo) */
 	xen_parse_cmdline(XEN_PARSE_BOOTFLAGS, NULL);
 
 	/* Determine physical address space */
@@ -1651,6 +1647,7 @@ init_x86_64(paddr_t first_avail)
 	pmap_growkernel(VM_MIN_KERNEL_ADDRESS + 32 * 1024 * 1024);
 
 	kpreempt_disable();
+
 	pmap_kenter_pa(idt_vaddr, idt_paddr, VM_PROT_READ|VM_PROT_WRITE, 0);
 	pmap_update(pmap_kernel());
 	memset((void *)idt_vaddr, 0, PAGE_SIZE);

Index: src/sys/arch/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.755 src/sys/arch/i386/i386/machdep.c:1.756
--- src/sys/arch/i386/i386/machdep.c:1.755	Sun May 15 10:35:54 2016
+++ src/sys/arch/i386/i386/machdep.c	Wed Jul 13 15:35:56 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.755 2016/05/15 10:35:54 maxv Exp $	*/
+/*	$NetBSD: machdep.c,v 1.756 2016/07/13 15:35:56 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.755 2016/05/15 10:35:54 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.756 2016/07/13 15:35:56 maxv Exp $");
 
 #include "opt_beep.h"
 #include "opt_compat_ibcs2.h"
@@ -215,42 +215,39 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 
 char machine[] = "i386";		/* CPU "architecture" */
 char machine_arch[] = "i386";		/* machine == machine_arch */
 
-extern struct bi_devmatch *x86_alldisks;
-extern int x86_ndisks;
-
 #ifdef CPURESET_DELAY
-int	cpureset_delay = CPURESET_DELAY;
+int cpureset_delay = CPURESET_DELAY;
 #else
-int     cpureset_delay = 2000; /* default to 2s */
+int cpureset_delay = 2000; /* default to 2s */
 #endif
 
 #ifdef MTRR
 struct mtrr_funcs *mtrr_funcs;
 #endif
 
-int	cpu_class;
-int	use_pae;
-int	i386_fpu_present = 1;
-int	i386_fpu_fdivbug;
-
-int	i386_use_fxsave;
-int	i386_has_sse;
-int	i386_has_sse2;
+int cpu_class;
+int use_pae;
+int i386_fpu_present = 1;
+int i386_fpu_fdivbug;
+
+int i386_use_fxsave;
+int i386_has_sse;
+int i386_has_sse2;
 
-vaddr_t	msgbuf_vaddr;
+vaddr_t msgbuf_vaddr;
 struct {
 	paddr_t paddr;
 	psize_t sz;
 } msgbuf_p_seg[VM_PHYSSEG_MAX];
 unsigned int msgbuf_p_cnt = 0;
 
-vaddr_t	idt_vaddr;
-paddr_t	idt_paddr;
-vaddr_t	pentium_idt_vaddr;
+vaddr_t idt_vaddr;
+paddr_t idt_paddr;
+vaddr_t pentium_idt_vaddr;
 
 struct vm_map *phys_map = NULL;
 
-extern	paddr_t avail_start, avail_end;
+extern paddr_t avail_start, avail_end;
 #ifdef XEN
 extern paddr_t pmap_pa_start, pmap_pa_end;
 void hypervisor_callback(void);
@@ -270,10 +267,10 @@ void (*initclock_func)(void) = i8254_ini
  * Size of memory segments, before any memory is stolen.
  */
 phys_ram_seg_t mem_clusters[VM_PHYSSEG_MAX];
-int	mem_cluster_cnt = 0;
+int mem_cluster_cnt = 0;
 
-void	init386(paddr_t);
-void	initgdt(union descriptor *);
+void init386(paddr_t);
+void initgdt(union descriptor *);
 
 extern int time_adjusted;
 
@@ -285,30 +282,32 @@ extern int boothowto;
 
 /* Base memory reported by BIOS. */
 #ifndef REALBASEMEM
-int	biosbasemem = 0;
+int biosbasemem = 0;
 #else
-int	biosbasemem = REALBASEMEM;
+int biosbasemem = REALBASEMEM;
 #endif
 
 /* Extended memory reported by BIOS. */
 #ifndef REALEXTMEM
-int	biosextmem = 0;
+int biosextmem = 0;
 #else
-int	biosextmem = REALEXTMEM;
+int biosextmem = REALEXTMEM;
 #endif
 
 /* Set if any boot-loader set biosbasemem/biosextmem. */
-int	biosmem_implicit;
+int biosmem_implicit;
 
-/* Representation of the bootinfo structure constructed by a NetBSD native
- * boot loader.  Only be used by native_loader(). */
+/*
+ * Representation of the bootinfo structure constructed by a NetBSD native
+ * boot loader.  Only be used by native_loader().
+ */
 struct bootinfo_source {
 	uint32_t bs_naddrs;
 	void *bs_addrs[1]; /* Actually longer. */
 };
 
-/* Only called by locore.h; no need to be in a header file. */
-void	native_loader(int, int, struct bootinfo_source *, paddr_t, int, int);
+/* Only called by locore.S; no need to be in a header file. */
+void native_loader(int, int, struct bootinfo_source *, paddr_t, int, int);
 
 /*
  * Called as one of the very first things during system startup (just after
@@ -429,6 +428,7 @@ cpu_startup(void)
 		panic("msgbuf paddr map has not been set up");
 	for (x = 0, sz = 0; x < msgbuf_p_cnt; sz += msgbuf_p_seg[x++].sz)
 		continue;
+
 	msgbuf_vaddr = uvm_km_alloc(kernel_map, sz, 0, UVM_KMF_VAONLY);
 	if (msgbuf_vaddr == 0)
 		panic("failed to valloc msgbuf_vaddr");
@@ -440,6 +440,7 @@ cpu_startup(void)
 			    msgbuf_p_seg[y].paddr + x * PAGE_SIZE,
 			    VM_PROT_READ|VM_PROT_WRITE, 0);
 	}
+
 	pmap_update(pmap_kernel());
 
 	initmsgbuf((void *)msgbuf_vaddr, sz);
@@ -466,7 +467,7 @@ cpu_startup(void)
 	 * Allocate a submap for physio
 	 */
 	phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
-				   VM_PHYS_SIZE, 0, false, NULL);
+	    VM_PHYS_SIZE, 0, false, NULL);
 
 	/* Say hello. */
 	banner();
@@ -1144,6 +1145,7 @@ init386(paddr_t first_avail)
 	KASSERT(HYPERVISOR_shared_info != NULL);
 	cpu_info_primary.ci_vcpu = &HYPERVISOR_shared_info->vcpu_info[0];
 #endif
+
 	cpu_probe(&cpu_info_primary);
 
 	uvm_lwp_setuarea(&lwp0, lwp0uarea);
@@ -1247,8 +1249,8 @@ init386(paddr_t first_avail)
 
 #ifndef XEN
 	/*
-	 * Check to see if we have a memory map from the BIOS (passed
-	 * to us by the boot program.
+	 * Check to see if we have a memory map from the BIOS (passed to us by
+	 * the boot program).
 	 */
 	bim = lookup_bootinfo(BTINFO_MEMMAP);
 	if ((biosmem_implicit || (biosbasemem == 0 && biosextmem == 0)) &&
@@ -1256,7 +1258,7 @@ init386(paddr_t first_avail)
 		initx86_parse_memmap(bim, iomem_ex);
 
 	/*
-	 * If the loop above didn't find any valid segment, fall back to
+	 * If initx86_parse_memmap didn't find any valid segment, fall back to
 	 * former code.
 	 */
 	if (mem_cluster_cnt == 0)
@@ -1304,9 +1306,8 @@ init386(paddr_t first_avail)
 
 #if NBIOSCALL > 0
 	KASSERT(biostramp_image_size <= PAGE_SIZE);
-	pmap_kenter_pa((vaddr_t)BIOSTRAMP_BASE,	/* virtual */
-		       (paddr_t)BIOSTRAMP_BASE,	/* physical */
-		       VM_PROT_ALL, 0);		/* protection */
+	pmap_kenter_pa((vaddr_t)BIOSTRAMP_BASE, (paddr_t)BIOSTRAMP_BASE,
+	    VM_PROT_ALL, 0);
 	pmap_update(pmap_kernel());
 	memcpy((void *)BIOSTRAMP_BASE, biostramp_image, biostramp_image_size);
 
@@ -1330,10 +1331,10 @@ init386(paddr_t first_avail)
 
 	tgdt = gdt;
 	gdt = (union descriptor *)
-		    ((char *)idt + NIDT * sizeof (struct gate_descriptor));
+		    ((char *)idt + NIDT * sizeof(struct gate_descriptor));
 	ldt = gdt + NGDT;
 
-	memcpy(gdt, tgdt, NGDT*sizeof(*gdt));
+	memcpy(gdt, tgdt, NGDT * sizeof(*gdt));
 
 	setsegment(&gdt[GLDT_SEL].sd, ldt, NLDT * sizeof(ldt[0]) - 1,
 	    SDT_SYSLDT, SEL_KPL, 0, 0);

Reply via email to