Cleaning up commented out code. Formatting according to style rules.

This commit is contained in:
ober 2007-12-09 03:33:29 +00:00
parent 6797f052ff
commit 02ade29d04
4 changed files with 60 additions and 136 deletions

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.c,v 1.17 2007/12/05 12:31:25 tsutsui Exp $ */ /* $NetBSD: autoconf.c,v 1.18 2007/12/09 03:33:29 ober Exp $ */
/*- /*-
* Copyright (c) 1990 The Regents of the University of California. * Copyright (c) 1990 The Regents of the University of California.
@ -44,7 +44,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.17 2007/12/05 12:31:25 tsutsui Exp $"); __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.18 2007/12/09 03:33:29 ober Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -59,32 +59,20 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.17 2007/12/05 12:31:25 tsutsui Exp $"
#include <machine/pte.h> #include <machine/pte.h>
#include <machine/intr.h> #include <machine/intr.h>
/*
#include <dev/pci/pcivar.h>
#include <dev/pci/pcidevs.h>
#include <dev/scsipi/scsi_all.h>
#include <dev/scsipi/scsipi_all.h>
#include <dev/scsipi/scsiconf.h>
#include <dev/ata/atavar.h>
#include <dev/ic/wdcvar.h>
#include <machine/isa_machdep.h>
#include <dev/isa/isareg.h>
#include <prep/pnpbus/pnpbusvar.h>
*/
void genppc_cpu_configure(void); void genppc_cpu_configure(void);
static void findroot(void); static void findroot(void);
/* /*
* Determine i/o configuration for a machine. * Determine i/o configuration for a machine.
*/ */
void void
cpu_configure() cpu_configure()
{ {
if (config_rootfound("mainbus", NULL) == NULL) if (config_rootfound("mainbus", NULL) == NULL)
panic("configure: mainbus not configured"); panic("configure: mainbus not configured");
genppc_cpu_configure(); genppc_cpu_configure();
} }
@ -114,23 +102,19 @@ findroot(void)
char buf[32]; char buf[32];
const char *name; const char *name;
#if 0
aprint_normal("howto %x bootdev %x ", boothowto, bootdev);
#endif
if ((bootdev & B_MAGICMASK) != (u_long)B_DEVMAGIC) if ((bootdev & B_MAGICMASK) != (u_long)B_DEVMAGIC)
return; return;
name = devsw_blk2name((bootdev >> B_TYPESHIFT) & B_TYPEMASK); name = devsw_blk2name((bootdev >> B_TYPESHIFT) & B_TYPEMASK);
if (name == NULL) if (name == NULL)
return; return;
part = (bootdev >> B_PARTITIONSHIFT) & B_PARTITIONMASK; part = (bootdev >> B_PARTITIONSHIFT) & B_PARTITIONMASK;
unit = (bootdev >> B_UNITSHIFT) & B_UNITMASK; unit = (bootdev >> B_UNITSHIFT) & B_UNITMASK;
sprintf(buf, "%s%d", name, unit); sprintf(buf, "%s%d", name, unit);
for (dv = TAILQ_FIRST(&alldevs); dv != NULL; for (dv = TAILQ_FIRST(&alldevs); dv != NULL;
dv = TAILQ_NEXT(dv, dv_list)) { dv = TAILQ_NEXT(dv, dv_list)) {
if (strcmp(buf, dv->dv_xname) == 0) { if (strcmp(buf, dv->dv_xname) == 0) {
booted_device = dv; booted_device = dv;
booted_partition = part; booted_partition = part;

@ -1,4 +1,4 @@
/* $NetBSD: cpu.c,v 1.7 2007/10/17 19:53:57 garbled Exp $ */ /* $NetBSD: cpu.c,v 1.8 2007/12/09 03:33:29 ober Exp $ */
/*- /*-
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.7 2007/10/17 19:53:57 garbled Exp $"); __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.8 2007/12/09 03:33:29 ober Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -51,20 +51,20 @@ int cpumatch(struct device *, struct cfdata *, void *);
void cpuattach(struct device *, struct device *, void *); void cpuattach(struct device *, struct device *, void *);
CFATTACH_DECL(cpu, sizeof(struct device), CFATTACH_DECL(cpu, sizeof(struct device),
cpumatch, cpuattach, NULL, NULL); cpumatch, cpuattach, NULL, NULL);
extern struct cfdriver cpu_cd; extern struct cfdriver cpu_cd;
int int
cpumatch(struct device *parent, struct cfdata *cfdata, void *aux) cpumatch(struct device *parent, struct cfdata *cfdata, void *aux)
{ {
struct confargs *ca = aux; struct confargs *ca = aux;
if (strcmp(ca->ca_name, cpu_cd.cd_name) != 0) if (strcmp(ca->ca_name, cpu_cd.cd_name) != 0)
return (0); return (0);
if (cpu_info[0].ci_dev != NULL) if (cpu_info[0].ci_dev != NULL)
return (0); return (0);
return (1); return (1);
} }
void void

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.90 2007/10/17 19:53:58 garbled Exp $ */ /* $NetBSD: machdep.c,v 1.91 2007/12/09 03:33:29 ober Exp $ */
/* /*
* Copyright (C) 1995, 1996 Wolfgang Solfrank. * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -32,7 +32,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.90 2007/10/17 19:53:58 garbled Exp $"); __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.91 2007/12/09 03:33:29 ober Exp $");
#include "opt_compat_netbsd.h" #include "opt_compat_netbsd.h"
#include "opt_ddb.h" #include "opt_ddb.h"
@ -130,7 +130,7 @@ initppc(u_long startkernel, u_long endkernel, void *btinfo)
struct btinfo_memory *meminfo; struct btinfo_memory *meminfo;
meminfo = meminfo =
(struct btinfo_memory *)lookup_bootinfo(BTINFO_MEMORY); (struct btinfo_memory *)lookup_bootinfo(BTINFO_MEMORY);
if (!meminfo) if (!meminfo)
panic("not found memory information in bootinfo"); panic("not found memory information in bootinfo");
physmemr[0].start = 0; physmemr[0].start = 0;
@ -148,22 +148,14 @@ initppc(u_long startkernel, u_long endkernel, void *btinfo)
extern u_long ticks_per_sec, ns_per_tick; extern u_long ticks_per_sec, ns_per_tick;
clockinfo = clockinfo =
(struct btinfo_clock *)lookup_bootinfo(BTINFO_CLOCK); (struct btinfo_clock *)lookup_bootinfo(BTINFO_CLOCK);
if (!clockinfo) if (!clockinfo)
panic("not found clock information in bootinfo"); panic("not found clock information in bootinfo");
ticks_per_sec = clockinfo->ticks_per_sec; ticks_per_sec = clockinfo->ticks_per_sec;
ns_per_tick = 1000000000 / ticks_per_sec; ns_per_tick = 1000000000 / ticks_per_sec;
} }
/*
* BeBox MotherBoard's Register
* Interrupt Mask Reset
*/
#if 0
*(volatile u_int *)(MOTHER_BOARD_REG + CPU0_INT_MASK) = 0x0ffffffc;
*(volatile u_int *)(MOTHER_BOARD_REG + CPU0_INT_MASK) = 0x80000023;
*(volatile u_int *)(MOTHER_BOARD_REG + CPU1_INT_MASK) = 0x0ffffffc;
#endif
/* /*
* boothowto * boothowto
*/ */
@ -181,30 +173,30 @@ cpu_startup()
/* /*
* BeBox Mother Board's Register Mapping * BeBox Mother Board's Register Mapping
*/ */
bebox_mb_reg = (vaddr_t) mapiodev(BEBOX_INTR_REG, PAGE_SIZE); bebox_mb_reg = (vaddr_t) mapiodev(BEBOX_INTR_REG, PAGE_SIZE);
if (!bebox_mb_reg) if (!bebox_mb_reg)
panic("cpu_startup: no room for interrupt register"); panic("cpu_startup: no room for interrupt register");
/* /*
* Do common VM initialization * Do common VM initialization
*/ */
oea_startup(NULL); oea_startup(NULL);
/* /*
* Now that we have VM, malloc's are OK in bus_space. * Now that we have VM, malloc's are OK in bus_space.
*/ */
bus_space_mallocok(); bus_space_mallocok();
/* /*
* Now allow hardware interrupts. * Now allow hardware interrupts.
*/ */
{ {
int msr; int msr;
splhigh(); splhigh();
__asm volatile ("mfmsr %0; ori %0,%0,%1; mtmsr %0" __asm volatile ("mfmsr %0; ori %0,%0,%1; mtmsr %0"
: "=r"(msr) : "K"(PSL_EE)); : "=r"(msr) : "K"(PSL_EE));
} }
} }
/* /*
@ -224,7 +216,7 @@ lookup_bootinfo(type)
return (help); return (help);
help = (struct btinfo_common *)((char*)help + bt->next); help = (struct btinfo_common *)((char*)help + bt->next);
} while (bt->next && } while (bt->next &&
(size_t)help < (size_t)bootinfo + sizeof (bootinfo)); (size_t)help < (size_t)bootinfo + sizeof (bootinfo));
return (NULL); return (NULL);
} }
@ -247,25 +239,11 @@ consinit()
if (!consinfo) if (!consinfo)
panic("not found console information in bootinfo"); panic("not found console information in bootinfo");
#if 0
#if (NPFB > 0)
if (!strcmp(consinfo->devname, "be")) {
pfb_cnattach(consinfo->addr);
#if (NPCKBC > 0)
pckbc_cnattach(&genppc_isa_io_space_tag, IO_KBD, KBCMDP,
PCKBC_KBD_SLOT);
#endif
return;
}
#endif
#endif /* if 0 */
#if (NPC > 0) || (NVGA > 0) #if (NPC > 0) || (NVGA > 0)
if (!strcmp(consinfo->devname, "vga")) { if (!strcmp(consinfo->devname, "vga")) {
#if (NVGA > 0) #if (NVGA > 0)
if (!vga_cnattach(&genppc_isa_io_space_tag, &genppc_isa_mem_space_tag, if (!vga_cnattach(&genppc_isa_io_space_tag, &genppc_isa_mem_space_tag,
-1, 1)) -1, 1))
goto dokbd; goto dokbd;
#endif #endif
#if (NPC > 0) #if (NPC > 0)
@ -287,8 +265,8 @@ dokbd:
bus_space_tag_t tag = &genppc_isa_io_space_tag; bus_space_tag_t tag = &genppc_isa_io_space_tag;
if(comcnattach(tag, consinfo->addr, consinfo->speed, if(comcnattach(tag, consinfo->addr, consinfo->speed,
COM_FREQ, COM_TYPE_NORMAL, COM_FREQ, COM_TYPE_NORMAL,
((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8))) ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8)))
panic("can't init serial console"); panic("can't init serial console");
return; return;
@ -335,9 +313,7 @@ cpu_reboot(int howto, char *what)
if (howto & RB_HALT) { if (howto & RB_HALT) {
doshutdownhooks(); doshutdownhooks();
printf("halted\n\n"); printf("halted\n\n");
#if 0
ppc_exit();
#endif
} }
if (!cold && (howto & RB_DUMP)) if (!cold && (howto & RB_DUMP))
oea_dumpsys(); oea_dumpsys();
@ -360,18 +336,5 @@ cpu_reboot(int howto, char *what)
*ap++ = 0; *ap++ = 0;
if (ap[-2] == '-') if (ap[-2] == '-')
*ap1 = 0; *ap1 = 0;
#if 0
ppc_boot(str);
#endif
while (1); while (1);
} }
#if 0
void
mem_regions(struct mem_region **mem, struct mem_region **avail)
{
*mem = physmemr;
*avail = availmemr;
}
#endif

@ -1,4 +1,4 @@
/* $NetBSD: mainbus.c,v 1.20 2007/10/17 19:53:58 garbled Exp $ */ /* $NetBSD: mainbus.c,v 1.21 2007/12/09 03:33:29 ober Exp $ */
/* /*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@ -31,7 +31,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.20 2007/10/17 19:53:58 garbled Exp $"); __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.21 2007/12/09 03:33:29 ober Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/extent.h> #include <sys/extent.h>
@ -60,7 +60,7 @@ int mainbus_print (void *, const char *);
union mainbus_attach_args { union mainbus_attach_args {
const char *mba_busname; /* first elem of all */ const char *mba_busname; /* first elem of all */
struct pcibus_attach_args mba_pba; struct pcibus_attach_args mba_pba;
/*struct pnpbus_attach_args mba_paa;*/ /*struct pnpbus_attach_args mba_paa;*/
}; };
@ -84,31 +84,31 @@ mainbus_match(struct device *parent, struct cfdata *match, void *aux)
void void
mainbus_attach(struct device *parent, struct device *self, void *aux) mainbus_attach(struct device *parent, struct device *self, void *aux)
{ {
union mainbus_attach_args mba; union mainbus_attach_args mba;
struct confargs ca; struct confargs ca;
#if NPCI > 0 #if NPCI > 0
struct genppc_pci_chipset_businfo *pbi; struct genppc_pci_chipset_businfo *pbi;
#ifdef PCI_NETBSD_CONFIGURE #ifdef PCI_NETBSD_CONFIGURE
struct extent *ioext, *memext; struct extent *ioext, *memext;
#endif #endif
#endif #endif
mainbus_found = 1; mainbus_found = 1;
aprint_normal("\n"); aprint_normal("\n");
#if defined(RESIDUAL_DATA_DUMP) #if defined(RESIDUAL_DATA_DUMP)
print_residual_device_info(); print_residual_device_info();
#endif #endif
/* /*
* Always find the CPU * Always find the CPU
*/ */
ca.ca_name = "cpu"; ca.ca_name = "cpu";
ca.ca_node = 0; ca.ca_node = 0;
config_found_ia(self, "mainbus", &ca, mainbus_print); config_found_ia(self, "mainbus", &ca, mainbus_print);
/* /*
* XXX Note also that the presence of a PCI bus should * XXX Note also that the presence of a PCI bus should
@ -172,32 +172,9 @@ mainbus_attach(struct device *parent, struct device *self, void *aux)
#ifdef RESIDUAL_DATA_DUMP #ifdef RESIDUAL_DATA_DUMP
SIMPLEQ_FOREACH(pbi, &genppc_pct->pc_pbi, next) SIMPLEQ_FOREACH(pbi, &genppc_pct->pc_pbi, next)
printf("%s\n", prop_dictionary_externalize(pbi->pbi_properties)); printf("%s\n", prop_dictionary_externalize(pbi->pbi_properties));
#endif #endif
#if 0
#if NPCI > 0
#if defined(PCI_NETBSD_CONFIGURE)
ioext = extent_create("pciio", 0x00008000, 0x0000ffff, M_DEVBUF,
NULL, 0, EX_NOWAIT);
memext = extent_create("pcimem", 0x00000000, 0x0fffffff, M_DEVBUF,
NULL, 0, EX_NOWAIT);
pci_configure_bus(0, ioext, memext, NULL, 0, 32);
extent_destroy(ioext);
extent_destroy(memext);
#endif
mba.mba_pba.pba_iot = &genppc_isa_io_space_tag;
mba.mba_pba.pba_memt = &genppc_isa_mem_space_tag;
mba.mba_pba.pba_dmat = &pci_bus_dma_tag;
mba.mba_pba.pba_dmat64 = NULL;
mba.mba_pba.pba_bus = 0;
mba.mba_pba.pba_bridgetag = NULL;
mba.mba_pba.pba_flags = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED;
config_found_ia(self, "pcibus", &mba, pcibusprint);
#endif
#endif
} }
int int