示例#1
0
static void
tctrl_event_thread(void *v)
{
	struct tctrl_softc *sc = v;
	device_t dv;
	struct sd_softc *sd = NULL;
	struct lance_softc *le = NULL;
	int ticks = hz/2;
	int rcount, wcount;
	int s;
	
	while (sd == NULL) {
		dv = device_find_by_xname("sd0");
		if (dv != NULL)
			sd = device_private(dv);
		else
			tsleep(&sc->sc_events, PWAIT, "probe_disk", hz);
	}			
	dv = device_find_by_xname("le0");
	if (dv != NULL)
		le = device_private(dv);
	printf("found %s\n", device_xname(sd->sc_dev));
	rcount = sd->sc_dk.dk_stats->io_rxfer;
	wcount = sd->sc_dk.dk_stats->io_wxfer;

	tctrl_read_event_status(sc);
	
	while (1) {
		tsleep(&sc->sc_events, PWAIT, "tctrl_event", ticks);
		s = splhigh();
		if ((rcount != sd->sc_dk.dk_stats->io_rxfer) || 
		    (wcount != sd->sc_dk.dk_stats->io_wxfer)) {
			rcount = sd->sc_dk.dk_stats->io_rxfer;
			wcount = sd->sc_dk.dk_stats->io_wxfer;
			sc->sc_lcdwanted |= TS102_LCD_DISK_ACTIVE;
		} else
			sc->sc_lcdwanted &= ~TS102_LCD_DISK_ACTIVE;
		if (le != NULL) {
			if (le->sc_havecarrier != 0) {
				sc->sc_lcdwanted |= TS102_LCD_LAN_ACTIVE;
			} else
				sc->sc_lcdwanted &= ~TS102_LCD_LAN_ACTIVE;
		}
		splx(s);
		tctrl_update_lcd(sc);
		if (sc->sc_ext_pending)
			tctrl_read_event_status(sc);
	}
}
/*
 * Attempt to find the device from which we were booted.
 */
void
findroot(void)
{
#if NSCSIBUS > 0
	int ctlr, part, type;
	device_t dv;

	if (BOOTDEV_MAG(bootdev) != 5)	/* NEWS-OS's B_DEVMAGIC */
		return;

	ctlr = BOOTDEV_CTLR(bootdev);	/* SCSI ID */
	part = BOOTDEV_PART(bootdev);	/* LUN */
	type = BOOTDEV_TYPE(bootdev);

	if (type != BOOTDEV_SD)
		return;

	/*
	 * XXX assumes only one controller exists.
	 */
	if ((dv = device_find_by_xname("scsibus0")) != NULL) {
		struct scsibus_softc *sdv = device_private(dv);
		struct scsipi_periph *periph;

		periph = scsipi_lookup_periph(sdv->sc_channel, ctlr, 0);
		if (periph != NULL) {
			booted_device = periph->periph_dev;
			booted_partition = part;
		}
	}
#endif
}
示例#3
0
/*
 * Try to find a (optional) memory window board.
 */
static void
empb_find_mem(struct empb_softc *sc)
{
	device_t memdev;
	struct emmem_softc *mem_sc;

	memdev = device_find_by_xname("emmem0");
	sc->pci_mem_win_size = 0;

	if(memdev == NULL) {
		return;
	}

	mem_sc = device_private(memdev);

	sc->pci_mem_win.base = (bus_addr_t) mem_sc->sc_base;
	sc->pci_mem_win.absm = &empb_bus_swap;
	sc->pci_mem_win_size = mem_sc->sc_size;
	sc->pci_mem_win_t = &sc->pci_mem_win;

	if(sc->pci_mem_win_size == 8*1024*1024)
		sc->pci_mem_win_mask = EMPB_WINDOW_MASK_8M;
	else if(sc->pci_mem_win_size == 4*1024*1024)
		sc->pci_mem_win_mask = EMPB_WINDOW_MASK_4M;
	else /* disable anyway */
		sc->pci_mem_win_size = 0;

#ifdef EMPB_DEBUG
	aprint_normal("empb: found %x b window at %p, switch mask %x\n", 
	    sc->pci_mem_win_size, (void*) sc->pci_mem_win.base, 
	    sc->pci_mem_win_mask);
#endif /* EMPB_DEBUG */

}
示例#4
0
文件: cpu.c 项目: lacombar/netbsd-alc
void
cpu_rootconf(void)
{
	device_t rdev;

	rdev = device_find_by_xname("md0");

	setroot(rdev, 0);
}
示例#5
0
void
cpu_rootconf(void)
{
	extern char *usermode_root_device;
	device_t rdev;

	if (usermode_root_device != NULL) {
		rdev = device_find_by_xname(usermode_root_device);
	} else {
		rdev = device_find_by_xname("ld0");
		if (rdev == NULL)
			rdev = device_find_by_xname("md0");
	}

	aprint_normal("boot device: %s\n",
	    rdev ? device_xname(rdev) : "<unknown>");
	booted_device = rdev;
	rootconf();
}
示例#6
0
uint32_t
omap_chipid(void)
{
	struct omap3_scm_softc *sc;
	device_t dev;

	dev = device_find_by_xname("omapscm0");
	KASSERT(dev != NULL);
	sc = device_private(dev);
	return sc->sc_cid;
}
static bool 
empb_bsm_init(void) 
{
	device_t dev;

	/* We can't have more than one Mediator anyway. */
	if (!(dev = device_find_by_xname("empb0"))) {
		aprint_error("empb: can't find bridge device\n");
		return false;
	}

	if (!(empb_sc = device_private(dev))) {
		aprint_error_dev(dev, "can't obtain bridge softc\n");
		return false;
	}

	if (empb_sc->pci_mem_win_size == 0) {
		aprint_error_dev(dev, "no PCI memory window found\n");
		return false;
	}

	return true;
}
void
cpu_rootconf(void)
{
	device_t dv;
	char *p;
	const char *bootdev_name, *netdev_name;
	int unit, partition;

	/* Extract boot device */
	for (p = __boot_kernel_name; *p; p++) {
		if (*p == ':') {
			*p = '\0';
			break;
		}
	}
	p = __boot_kernel_name;

	bootdev_name = 0;
	unit = 0;

	switch (SBD_INFO->machine) {
#ifdef EWS4800_TR2
	case MACHINE_TR2:
		netdev_name = "iee0";
		break;
#endif
#ifdef EWS4800_TR2A
	case MACHINE_TR2A:
		netdev_name = "le0";
		break;
#endif
	default:
		netdev_name = NULL;
	}
	partition = 0;

	if (strncmp(p, "sd", 2) == 0) {
		unit = p[2] - '0';
		partition = p[3] - 'a';
		if (unit >= 0 && unit <= 9 && partition >= 0 &&
		    partition < MAXPARTITIONS) {
			p[3] = '\0';
			bootdev_name = __boot_kernel_name;
		}
	} else if (strncmp(p, "nfs", 3) == 0) {
		bootdev_name = netdev_name;
	} else if (strncmp(p, "mem", 3) == 0) {
		int bootdev = (*platform.ipl_bootdev)();
		if (bootdev == NVSRAM_BOOTDEV_HARDDISK)
			bootdev_name = "sd0";
		else if (bootdev == NVSRAM_BOOTDEV_NETWORK)
			bootdev_name = netdev_name;
		else
			bootdev_name = 0;
	}

	if (bootdev_name &&
	    (dv = device_find_by_xname(bootdev_name)) != NULL) {
		booted_device = dv;
		booted_partition = partition;
	}
	rootconf();
}