firewire.c revision 199767f8919635c4928607450d9e0abb932109ce
/*-
* Copyright (c) 2004 Hidetoshi Shimokawa <simokawa@FreeBSD.ORG>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
__FBSDID("$FreeBSD$");
/*
* FireWire disk device handling.
*
*/
#include <stand.h>
#include <machine/bootinfo.h>
#include <stdarg.h>
#include <bootstrap.h>
#include <btxv86.h>
#include <libi386.h>
#include "fwohci.h"
/* XXX */
#define _KERNEL
extern uint32_t dcons_paddr;
struct crom_src_buf {
struct crom_chunk root;
struct crom_chunk vendor;
struct crom_chunk hw;
/* for dcons */
struct crom_chunk unit;
struct crom_chunk spec;
struct crom_chunk ver;
};
static int fw_init(void);
static void fw_cleanup(void);
void fw_enable(void);
"FW1394", /* 7 chars at most */
};
static int fw_initialized = 0;
static void
{
int err;
0x0c0010 /* Serial:FireWire:OHCI */,
index /* index */,
if (err != 0) {
return;
}
0x4 /* command */,
0x6 /* enable bus master and memory mapped I/O */,
1 /* word */);
return;
}
static int
fw_init(void)
{
int i, avail;
struct fwohci_softc *sc;
if (fw_initialized)
return (0);
avail = 0;
for (i = 0; i < MAX_OHCI; i ++) {
break;
avail ++;
break;
}
fw_initialized = 1;
return (0);
}
/*
* Print information about OHCI chips
*/
static void
{
int i;
struct fwohci_softc *sc;
for (i = 0; i < MAX_OHCI; i ++) {
break;
printf("%d: locator=0x%04x devid=0x%08x"
" base_addr=0x%08x handle=0x%08x bus_id=0x%08x\n",
}
}
static int
{
#if 0
struct i386_devdesc *dev;
int error;
#endif
return (ENXIO);
}
static int
{
return (0);
}
static void
{
/* invalidate dcons buffer */
if (dcons_paddr) {
}
}
static int
{
return (EIO);
}
static void
{
printf("fw_init_crom\n");
malloc(sizeof(struct crom_src_buf));
return;
/* BUS info sample */
#define FW_GENERATION_CHANGEABLE 2
}
static void
{
struct crom_src_buf *buf;
struct crom_chunk *root;
printf("fw_reset\n");
/* private company_id */
#ifdef __DragonFly__
#else
#endif
}
#define ADDR_LO(x) ((x) & 0xffffff)
static void
{
struct crom_src_buf *buf;
struct crom_chunk *root;
}
void
{
void *newrom;
dcons_crom(sc);
/* Bump generation and reload. */
/* Handle generation count wraps. */
/* Recalculate CRC to account for generation change. */
}
}
static int
{
int count;
printf("fwohci not enabled\n");
return(CMD_OK);
}
fwohci_ibr(sc);
count = 0;
count ++;
if (count > 1000) {
printf("give up to wait bus initialize\n");
return (-1);
}
}
return (0);
}
void
fw_enable(void)
{
struct fwohci_softc *sc;
int i;
if (fw_initialized == 0)
fw_init();
for (i = 0; i < MAX_OHCI; i ++) {
break;
#if 0
printf("configrom: %08p %08p\n",
#endif
if (fwohci_init(sc, 0) == 0) {
} else
}
}
void
fw_poll(void)
{
struct fwohci_softc *sc;
int i;
if (fw_initialized == 0)
return;
for (i = 0; i < MAX_OHCI; i ++) {
break;
}
}
#if 0 /* for debug */
static int
{
struct fwohci_softc *sc;
int i;
for (i = 0; i < MAX_OHCI; i ++) {
break;
}
return(CMD_OK);
}
static int
{
fw_poll();
return(CMD_OK);
}
static int
{
fw_print(0);
fw_enable();
return(CMD_OK);
}
static int
{
fw_enable();
return(CMD_OK);
}
static int
{
char c;
printf("%c", c);
}
printf("\r\n");
return(CMD_OK);
}
static int
{
int len, i;
if (argc < 2)
return(CMD_OK);
for (i = 0; i < len; i ++)
return(CMD_OK);
}
#endif