Beispiel #1
0
static void
fw_probe(int index, struct fwohci_softc *sc)
{
	int err;

	sc->state = FWOHCI_STATE_INIT;
	err = biospci_find_devclass(
		0x0c0010	/* Serial:FireWire:OHCI */,
		index		/* index */,
		&sc->locator);

	if (err != 0) {
		sc->state = FWOHCI_STATE_DEAD;
		return;
	}

	biospci_write_config(sc->locator,
		0x4	/* command */,
		0x6	/* enable bus master and memory mapped I/O */,
		1	/* word */);

	biospci_read_config(sc->locator, 0x00 /*devid*/, 2 /*dword*/,
		&sc->devid);
	biospci_read_config(sc->locator, 0x10 /*base_addr*/, 2 /*dword*/,
		&sc->base_addr);

        sc->handle = (uint32_t)PTOV(sc->base_addr);
	sc->bus_id = OREAD(sc, OHCI_BUS_ID);

	return;
}
Beispiel #2
0
/*
 * pcibios-read-config (locator offset width -- value)
 *
 * Reads the specified config register.
 * Locator is bus << 8 | device << 3 | fuction
 * offset is the pci config register
 * width is 0 for byte, 1 for word, 2 for dword
 * value is the value to read from the register
 */
static void
ficlPciBiosReadConfig(FICL_VM *pVM)
{
	uint32_t value, width, offset, locator;

	width = stackPopINT(pVM->pStack);
	offset = stackPopINT(pVM->pStack);
	locator = stackPopINT(pVM->pStack);

	biospci_read_config(locator, offset, width, &value);

	stackPushINT(pVM->pStack, value);
}