199767f8919635c4928607450d9e0abb932109ceToomas Soome * Copyright (c) 2004 Hidetoshi Shimokawa <simokawa@FreeBSD.ORG>
199767f8919635c4928607450d9e0abb932109ceToomas Soome * All rights reserved.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Redistribution and use in source and binary forms, with or without
199767f8919635c4928607450d9e0abb932109ceToomas Soome * modification, are permitted provided that the following conditions
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 1. Redistributions of source code must retain the above copyright
199767f8919635c4928607450d9e0abb932109ceToomas Soome * notice, this list of conditions and the following disclaimer.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 2. Redistributions in binary form must reproduce the above copyright
199767f8919635c4928607450d9e0abb932109ceToomas Soome * notice, this list of conditions and the following disclaimer in the
199767f8919635c4928607450d9e0abb932109ceToomas Soome * documentation and/or other materials provided with the distribution.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
199767f8919635c4928607450d9e0abb932109ceToomas Soome * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
199767f8919635c4928607450d9e0abb932109ceToomas Soome * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
199767f8919635c4928607450d9e0abb932109ceToomas Soome * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
199767f8919635c4928607450d9e0abb932109ceToomas Soome * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
199767f8919635c4928607450d9e0abb932109ceToomas Soome * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
199767f8919635c4928607450d9e0abb932109ceToomas Soome * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
199767f8919635c4928607450d9e0abb932109ceToomas Soome * SUCH DAMAGE.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * FireWire disk device handling.
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* for dcons */
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic int fw_init(void);
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic int fw_strategy(void *devdata, int flag, daddr_t dblk,
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic void fw_cleanup(void);
199767f8919635c4928607450d9e0abb932109ceToomas Soome 0x6 /* enable bus master and memory mapped I/O */,
199767f8919635c4928607450d9e0abb932109ceToomas Soome biospci_read_config(sc->locator, 0x00 /*devid*/, 2 /*dword*/,
199767f8919635c4928607450d9e0abb932109ceToomas Soome biospci_read_config(sc->locator, 0x10 /*base_addr*/, 2 /*dword*/,
199767f8919635c4928607450d9e0abb932109ceToomas Soome for (i = 0; i < MAX_OHCI; i ++) {
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Print information about OHCI chips
199767f8919635c4928607450d9e0abb932109ceToomas Soome for (i = 0; i < MAX_OHCI; i ++) {
199767f8919635c4928607450d9e0abb932109ceToomas Soome " base_addr=0x%08x handle=0x%08x bus_id=0x%08x\n",
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* invalidate dcons buffer */
199767f8919635c4928607450d9e0abb932109ceToomas Soomefw_strategy(void *devdata, int rw, daddr_t dblk, size_t size, char *buf, size_t *rsize)
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* BUS info sample */
199767f8919635c4928607450d9e0abb932109ceToomas Soome src->businfo.generation = FW_GENERATION_CHANGEABLE;
199767f8919635c4928607450d9e0abb932109ceToomas Soome crom_add_entry(root, CSRKEY_NCAP, 0x0083c0); /* XXX */
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* private company_id */
199767f8919635c4928607450d9e0abb932109ceToomas Soome crom_add_entry(root, CSRKEY_VENDOR, CSRVAL_VENDOR_PRIVATE);
199767f8919635c4928607450d9e0abb932109ceToomas Soome crom_add_simple_text(src, root, &buf->vendor, "DragonFly Project");
199767f8919635c4928607450d9e0abb932109ceToomas Soome crom_add_simple_text(src, root, &buf->vendor, "FreeBSD Project");
199767f8919635c4928607450d9e0abb932109ceToomas Soome crom_add_chunk(src, root, &buf->unit, CROM_UDIR);
199767f8919635c4928607450d9e0abb932109ceToomas Soome crom_add_entry(&buf->unit, CSRKEY_SPEC, CSRVAL_VENDOR_PRIVATE);
199767f8919635c4928607450d9e0abb932109ceToomas Soome crom_add_simple_text(src, &buf->unit, &buf->spec, "FreeBSD");
199767f8919635c4928607450d9e0abb932109ceToomas Soome crom_add_entry(&buf->unit, CSRKEY_VER, DCONS_CSR_VAL_VER);
199767f8919635c4928607450d9e0abb932109ceToomas Soome crom_add_simple_text(src, &buf->unit, &buf->ver, "dcons");
199767f8919635c4928607450d9e0abb932109ceToomas Soome crom_add_entry(&buf->unit, DCONS_CSR_KEY_HI, ADDR_HI(dcons_paddr));
199767f8919635c4928607450d9e0abb932109ceToomas Soome crom_add_entry(&buf->unit, DCONS_CSR_KEY_LO, ADDR_LO(dcons_paddr));
199767f8919635c4928607450d9e0abb932109ceToomas Soome if (bcmp(newrom, sc->config_rom, CROMSIZE) != 0) {
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* Bump generation and reload. */
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* Handle generation count wraps. */
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* Recalculate CRC to account for generation change. */
199767f8919635c4928607450d9e0abb932109ceToomas Soome bcopy(newrom, (void *)sc->config_rom, CROMSIZE);
199767f8919635c4928607450d9e0abb932109ceToomas Soome return (-1);
199767f8919635c4928607450d9e0abb932109ceToomas Soome for (i = 0; i < MAX_OHCI; i ++) {
199767f8919635c4928607450d9e0abb932109ceToomas Soome for (i = 0; i < MAX_OHCI; i ++) {
199767f8919635c4928607450d9e0abb932109ceToomas Soome#if 0 /* for debug */
199767f8919635c4928607450d9e0abb932109ceToomas Soome for (i = 0; i < MAX_OHCI; i ++) {
199767f8919635c4928607450d9e0abb932109ceToomas Soome for (i = 0; i < len; i ++)
199767f8919635c4928607450d9e0abb932109ceToomas SoomeCOMMAND_SET(firewire, "firewire", "enable firewire", fw_enable_cmd);
199767f8919635c4928607450d9e0abb932109ceToomas SoomeCOMMAND_SET(fwbusreset, "fwbusreset", "firewire busreset", fw_busreset_cmd);
199767f8919635c4928607450d9e0abb932109ceToomas SoomeCOMMAND_SET(fwpoll, "fwpoll", "firewire poll", fw_poll_cmd);
199767f8919635c4928607450d9e0abb932109ceToomas SoomeCOMMAND_SET(dcons, "dcons", "enable dcons", dcons_enable);
199767f8919635c4928607450d9e0abb932109ceToomas SoomeCOMMAND_SET(dread, "dread", "read from dcons", dcons_read);
199767f8919635c4928607450d9e0abb932109ceToomas SoomeCOMMAND_SET(dwrite, "dwrite", "write to dcons", dcons_write);