git: 8a744de27eef - main - stand: Remove i386-only support fire firewire
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 18 Nov 2022 17:44:45 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=8a744de27eef2a4266ce01b57267c42ff78ad488
commit 8a744de27eef2a4266ce01b57267c42ff78ad488
Author: Warner Losh <imp@FreeBSD.org>
AuthorDate: 2022-11-18 17:33:03 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-11-18 17:43:59 +0000
stand: Remove i386-only support fire firewire
Remove support for booting off of firewire, and for having dcons via
firewire in the loader. Kernel support for these things is unchanged.
Discussed on arch@ and the current state is not working (and the build
was wrong to boot).
Sponsored by: Netflix
Discussed: https://lists.freebsd.org/archives/freebsd-arch/2022-November/000267.html
Reviewed by: kevans, melifaro, emaste
Differential Revision: https://reviews.freebsd.org/D37334
---
share/man/man5/src.conf.5 | 5 +-
share/mk/src.opts.mk | 1 -
stand/i386/Makefile | 1 -
stand/i386/Makefile.inc | 5 -
stand/i386/libfirewire/Makefile | 20 --
stand/i386/libfirewire/Makefile.depend | 13 -
stand/i386/libfirewire/dconsole.c | 127 --------
stand/i386/libfirewire/firewire.c | 485 -------------------------------
stand/i386/libfirewire/fwohci.c | 474 ------------------------------
stand/i386/libfirewire/fwohci.h | 158 ----------
stand/i386/loader/Makefile | 9 +-
stand/i386/loader/conf.c | 12 -
stand/i386/loader/main.c | 2 +-
tools/boot/universe.sh | 9 -
tools/build/options/WITH_LOADER_FIREWIRE | 3 -
15 files changed, 4 insertions(+), 1320 deletions(-)
diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5
index 4c9c160d89a0..e6a1fc52a23e 100644
--- a/share/man/man5/src.conf.5
+++ b/share/man/man5/src.conf.5
@@ -1,6 +1,6 @@
.\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman.
.\" $FreeBSD$
-.Dd November 16, 2022
+.Dd November 18, 2022
.Dt SRC.CONF 5
.Os
.Sh NAME
@@ -996,9 +996,6 @@ option should be used rather than this in most cases.
Enable building
.Xr loader 8
with support for verification based on certificates obtained from UEFI.
-.It Va WITH_LOADER_FIREWIRE
-Enable firewire support in /boot/loader on x86.
-This option is a nop on all other platforms.
.It Va WITHOUT_LOADER_GELI
Disable inclusion of GELI crypto support in the boot chain binaries.
.Pp
diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk
index ff8c359acc42..f69208f21556 100644
--- a/share/mk/src.opts.mk
+++ b/share/mk/src.opts.mk
@@ -205,7 +205,6 @@ __DEFAULT_NO_OPTIONS = \
DTRACE_TESTS \
EXPERIMENTAL \
HESIOD \
- LOADER_FIREWIRE \
LOADER_VERBOSE \
LOADER_VERIEXEC_PASS_MANIFEST \
LLVM_BINUTILS \
diff --git a/stand/i386/Makefile b/stand/i386/Makefile
index 9aa33462f309..e1555388961a 100644
--- a/stand/i386/Makefile
+++ b/stand/i386/Makefile
@@ -8,7 +8,6 @@ NO_OBJ=t
# before everything else proceeds so we don't end up building against a stale
# btxldr and ending up with a build-during-install scenario.
SUBDIR.yes+= btx libi386
-SUBDIR.${MK_LOADER_FIREWIRE}+= libfirewire
SUBDIR.yes+= .WAIT
SUBDIR.yes+= mbr pmbr boot0 boot0sio boot2 cdboot gptboot \
diff --git a/stand/i386/Makefile.inc b/stand/i386/Makefile.inc
index d12434487877..13d17b5b48dd 100644
--- a/stand/i386/Makefile.inc
+++ b/stand/i386/Makefile.inc
@@ -33,9 +33,4 @@ LD_FLAGS_BIN= -static -N --gc-sections
DO32=1
.endif
-.if defined(LOADER_FIREWIRE_SUPPORT)
-MK_LOADER_FIREWIRE=yes
-.warning LOADER_FIREWIRE_SUPPORT deprecated, please move to WITH_LOADER_FIREWIRE
-.endif
-
.include "../Makefile.inc"
diff --git a/stand/i386/libfirewire/Makefile b/stand/i386/libfirewire/Makefile
deleted file mode 100644
index bf42c26a918f..000000000000
--- a/stand/i386/libfirewire/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-# $FreeBSD$
-
-.include <bsd.init.mk>
-
-LIB= firewire
-
-.PATH: ${SYSDIR}/dev/dcons ${SYSDIR}/dev/firewire
-SRCS+= firewire.c fwohci.c dconsole.c
-SRCS+= dcons.c fwcrom.c
-
-.include "${BOOTSRC}/veriexec.mk"
-
-CFLAGS+= -D_BOOT
-
-CFLAGS+= -I${LDRSRC}
-CFLAGS+= -I${BOOTSRC}/i386/libi386
-
-CFLAGS+= -Wformat -Wall
-
-.include <bsd.lib.mk>
diff --git a/stand/i386/libfirewire/Makefile.depend b/stand/i386/libfirewire/Makefile.depend
deleted file mode 100644
index 18be76b0cb6f..000000000000
--- a/stand/i386/libfirewire/Makefile.depend
+++ /dev/null
@@ -1,13 +0,0 @@
-# $FreeBSD$
-# Autogenerated - do NOT edit!
-
-DIRDEPS = \
- include \
- include/xlocale \
-
-
-.include <dirdeps.mk>
-
-.if ${DEP_RELDIR} == ${_DEP_RELDIR}
-# local dependencies - needed for -jN in clean tree
-.endif
diff --git a/stand/i386/libfirewire/dconsole.c b/stand/i386/libfirewire/dconsole.c
deleted file mode 100644
index 338ed26aa417..000000000000
--- a/stand/i386/libfirewire/dconsole.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/*-
- * Copyright (c) 2004 Hidetoshi Shimokawa
- *
- * 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
- * documentation and/or other materials provided with the distribution.
- *
- * 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <stand.h>
-#include <bootstrap.h>
-#include <sys/param.h>
-#include <btxv86.h>
-#include <dev/dcons/dcons.h>
-
-void fw_enable(void);
-void fw_poll(void);
-
-static void dconsole_probe(struct console *cp);
-static int dconsole_init(int arg);
-static void dconsole_putchar(int c);
-static int dconsole_getchar(void);
-static int dconsole_ischar(void);
-
-static int dcons_started = 0;
-
-#define DCONS_BUF_SIZE (64*1024)
-static struct dcons_softc sc[DCONS_NPORT];
-uint32_t dcons_paddr;
-
-/* The buffer must be allocated in BSS because:
- * - The dcons driver in the kernel is initialized before VM/pmap is
- * initialized, so that the buffer must be allocate in the region
- * that is mapped at the very early boot state.
- * - We expect identiy map only for regions before KERNLOAD
- * (i386:4MB amd64:1MB).
- * - It seems that heap in conventional memory(640KB) is not sufficient
- * and we move it to high address as LOADER_SUPPORT_BZIP2.
- * - BSS is placed in conventional memory.
- */
-static char dcons_buffer[DCONS_BUF_SIZE + PAGE_SIZE];
-
-struct console dconsole = {
- "dcons",
- "dumb console port",
- 0,
- dconsole_probe,
- dconsole_init,
- dconsole_putchar,
- dconsole_getchar,
- dconsole_ischar
-};
-
-#define DCONSOLE_AS_MULTI_CONSOLE 1
-
-static void
-dconsole_probe(struct console *cp)
-{
- /* XXX check the BIOS equipment list? */
- cp->c_flags |= (C_PRESENTIN | C_PRESENTOUT);
-#if DCONSOLE_AS_MULTI_CONSOLE
- dconsole_init(0);
- cp->c_flags |= (C_ACTIVEIN | C_ACTIVEOUT);
-#endif
-}
-
-static int
-dconsole_init(int arg)
-{
- char buf[16], *dbuf;
- int size;
-
- if (dcons_started && arg == 0)
- return 0;
- dcons_started = 1;
-
- size = DCONS_BUF_SIZE;
- dbuf = (char *)round_page((vm_offset_t)&dcons_buffer[0]);
- dcons_paddr = VTOP(dbuf);
- sprintf(buf, "0x%08x", dcons_paddr);
- setenv("dcons.addr", buf, 1);
-
- dcons_init((struct dcons_buf *)dbuf, size, sc);
- sprintf(buf, "%d", size);
- setenv("dcons.size", buf, 1);
- fw_enable();
- return(0);
-}
-
-static void
-dconsole_putchar(int c)
-{
- dcons_putc(&sc[0], c);
-}
-
-static int
-dconsole_getchar(void)
-{
- fw_poll();
- return (dcons_checkc(&sc[0]));
-}
-
-static int
-dconsole_ischar(void)
-{
- fw_poll();
- return (dcons_ischar(&sc[0]));
-}
diff --git a/stand/i386/libfirewire/firewire.c b/stand/i386/libfirewire/firewire.c
deleted file mode 100644
index c4e4bdaa065f..000000000000
--- a/stand/i386/libfirewire/firewire.c
+++ /dev/null
@@ -1,485 +0,0 @@
-/*-
- * 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
- * documentation and/or other materials provided with the distribution.
- *
- * 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.
- */
-
-#include <sys/cdefs.h>
-__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 <dev/firewire/firewire.h>
-#include "fwohci.h"
-#include <dev/dcons/dcons.h>
-
-/* XXX */
-#define BIT4x2(x,y) uint8_t y:4, x:4
-#define BIT16x2(x,y) uint32_t y:16, x:16
-#define _KERNEL
-#include <dev/firewire/iec13213.h>
-
-extern uint32_t dcons_paddr;
-extern struct console dconsole;
-
-struct crom_src_buf {
- struct crom_src src;
- 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 int fw_strategy(void *devdata, int flag, daddr_t dblk,
- size_t size, char *buf, size_t *rsize);
-static int fw_open(struct open_file *f, ...);
-static int fw_close(struct open_file *f);
-static int fw_print(int verbose);
-static void fw_cleanup(void);
-
-void fw_enable(void);
-
-struct devsw fwohci = {
- .dv_name = "FW1394", /* 7 chars at most */
- .dv_type = DEVT_NET,
- .dv_init = fw_init,
- .dv_strategy = fw_strategy,
- .dv_open = fw_open,
- .dv_close = fw_close,
- .dv_ioctl = noioctl,
- .dv_print = fw_print,
- .dv_cleanup = fw_cleanup,
-};
-
-static struct fwohci_softc fwinfo[MAX_OHCI];
-static int fw_initialized = 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 */,
- BIOSPCI_16BITS,
- 0x6 /* enable bus master and memory mapped I/O */);
-
- biospci_read_config(sc->locator, 0x00 /*devid*/, BIOSPCI_32BITS,
- &sc->devid);
- biospci_read_config(sc->locator, 0x10 /*base_addr*/, BIOSPCI_32BITS,
- &sc->base_addr);
-
- sc->handle = (uint32_t)PTOV(sc->base_addr);
- sc->bus_id = OREAD(sc, OHCI_BUS_ID);
-
- 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 ++) {
- sc = &fwinfo[i];
- fw_probe(i, sc);
- if (sc->state == FWOHCI_STATE_DEAD)
- break;
- avail ++;
- break;
- }
- fw_initialized = 1;
-
- return (0);
-}
-
-
-/*
- * Print information about OHCI chips
- */
-static int
-fw_print(int verbose)
-{
- char line[80];
- int i, ret = 0;
- struct fwohci_softc *sc;
-
- printf("%s devices:", fwohci.dv_name);
- if ((ret = pager_output("\n")) != 0)
- return (ret);
-
- for (i = 0; i < MAX_OHCI; i ++) {
- sc = &fwinfo[i];
- if (sc->state == FWOHCI_STATE_DEAD)
- break;
- snprintf(line, sizeof(line), "%d: locator=0x%04x devid=0x%08x"
- " base_addr=0x%08x handle=0x%08x bus_id=0x%08x\n",
- i, sc->locator, sc->devid,
- sc->base_addr, sc->handle, sc->bus_id);
- ret = pager_output(line);
- if (ret != 0)
- break;
- }
- return (ret);
-}
-
-static int
-fw_open(struct open_file *f, ...)
-{
-#if 0
- va_list ap;
- struct i386_devdesc *dev;
- struct open_disk *od;
- int error;
-
- va_start(ap, f);
- dev = va_arg(ap, struct i386_devdesc *);
- va_end(ap);
-#endif
-
- return (ENXIO);
-}
-
-static int
-fw_close(struct open_file *f)
-{
- return (0);
-}
-
-static void
-fw_cleanup()
-{
- struct dcons_buf *db;
-
- /* invalidate dcons buffer */
- if (dcons_paddr) {
- db = (struct dcons_buf *)PTOV(dcons_paddr);
- db->magic = 0;
- }
-}
-
-static int
-fw_strategy(void *devdata, int rw, daddr_t dblk, size_t size,
- char *buf, size_t *rsize)
-{
- return (EIO);
-}
-
-static void
-fw_init_crom(struct fwohci_softc *sc)
-{
- struct crom_src *src;
-
- printf("fw_init_crom\n");
- sc->crom_src_buf = (struct crom_src_buf *)
- malloc(sizeof(struct crom_src_buf));
- if (sc->crom_src_buf == NULL)
- return;
-
- src = &sc->crom_src_buf->src;
- bzero(src, sizeof(struct crom_src));
-
- /* BUS info sample */
- src->hdr.info_len = 4;
-
- src->businfo.bus_name = CSR_BUS_NAME_IEEE1394;
-
- src->businfo.irmc = 1;
- src->businfo.cmc = 1;
- src->businfo.isc = 1;
- src->businfo.bmc = 1;
- src->businfo.pmc = 0;
- src->businfo.cyc_clk_acc = 100;
- src->businfo.max_rec = sc->maxrec;
- src->businfo.max_rom = MAXROM_4;
-#define FW_GENERATION_CHANGEABLE 2
- src->businfo.generation = FW_GENERATION_CHANGEABLE;
- src->businfo.link_spd = sc->speed;
-
- src->businfo.eui64.hi = sc->eui.hi;
- src->businfo.eui64.lo = sc->eui.lo;
-
- STAILQ_INIT(&src->chunk_list);
-
- sc->crom_src = src;
- sc->crom_root = &sc->crom_src_buf->root;
-}
-
-static void
-fw_reset_crom(struct fwohci_softc *sc)
-{
- struct crom_src_buf *buf;
- struct crom_src *src;
- struct crom_chunk *root;
-
- printf("fw_reset\n");
- if (sc->crom_src_buf == NULL)
- fw_init_crom(sc);
-
- buf = sc->crom_src_buf;
- src = sc->crom_src;
- root = sc->crom_root;
-
- STAILQ_INIT(&src->chunk_list);
-
- bzero(root, sizeof(struct crom_chunk));
- crom_add_chunk(src, NULL, root, 0);
- crom_add_entry(root, CSRKEY_NCAP, 0x0083c0); /* XXX */
- /* private company_id */
- crom_add_entry(root, CSRKEY_VENDOR, CSRVAL_VENDOR_PRIVATE);
-#ifdef __DragonFly__
- crom_add_simple_text(src, root, &buf->vendor, "DragonFly Project");
-#else
- crom_add_simple_text(src, root, &buf->vendor, "FreeBSD Project");
-#endif
-}
-
-
-#define ADDR_HI(x) (((x) >> 24) & 0xffffff)
-#define ADDR_LO(x) ((x) & 0xffffff)
-
-static void
-dcons_crom(struct fwohci_softc *sc)
-{
- struct crom_src_buf *buf;
- struct crom_src *src;
- struct crom_chunk *root;
-
- buf = sc->crom_src_buf;
- src = sc->crom_src;
- root = sc->crom_root;
-
- bzero(&buf->unit, sizeof(struct crom_chunk));
-
- crom_add_chunk(src, root, &buf->unit, CROM_UDIR);
- crom_add_entry(&buf->unit, CSRKEY_SPEC, CSRVAL_VENDOR_PRIVATE);
- crom_add_simple_text(src, &buf->unit, &buf->spec, "FreeBSD");
- crom_add_entry(&buf->unit, CSRKEY_VER, DCONS_CSR_VAL_VER);
- crom_add_simple_text(src, &buf->unit, &buf->ver, "dcons");
- crom_add_entry(&buf->unit, DCONS_CSR_KEY_HI, ADDR_HI(dcons_paddr));
- crom_add_entry(&buf->unit, DCONS_CSR_KEY_LO, ADDR_LO(dcons_paddr));
-}
-
-void
-fw_crom(struct fwohci_softc *sc)
-{
- struct crom_src *src;
- void *newrom;
-
- fw_reset_crom(sc);
- dcons_crom(sc);
-
- newrom = malloc(CROMSIZE);
- src = &sc->crom_src_buf->src;
- crom_load(src, (uint32_t *)newrom, CROMSIZE);
- if (bcmp(newrom, sc->config_rom, CROMSIZE) != 0) {
- /* Bump generation and reload. */
- src->businfo.generation++;
-
- /* Handle generation count wraps. */
- if (src->businfo.generation < 2)
- src->businfo.generation = 2;
-
- /* Recalculate CRC to account for generation change. */
- crom_load(src, (uint32_t *)newrom, CROMSIZE);
- bcopy(newrom, (void *)sc->config_rom, CROMSIZE);
- }
- free(newrom);
-}
-
-static int
-fw_busreset(struct fwohci_softc *sc)
-{
- int count;
-
- if (sc->state < FWOHCI_STATE_ENABLED) {
- printf("fwohci not enabled\n");
- return(CMD_OK);
- }
- fw_crom(sc);
- fwohci_ibr(sc);
- count = 0;
- while (sc->state< FWOHCI_STATE_NORMAL) {
- fwohci_poll(sc);
- count ++;
- if (count > 1000) {
- printf("give up to wait bus initialize\n");
- return (-1);
- }
- }
- printf("poll count = %d\n", count);
- 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 ++) {
- sc = &fwinfo[i];
- if (sc->state != FWOHCI_STATE_INIT)
- break;
-
- sc->config_rom = (uint32_t *)
- (((uint32_t)sc->config_rom_buf
- + (CROMSIZE - 1)) & ~(CROMSIZE - 1));
-#if 0
- printf("configrom: %08p %08p\n",
- sc->config_rom_buf, sc->config_rom);
-#endif
- if (fwohci_init(sc, 0) == 0) {
- sc->state = FWOHCI_STATE_ENABLED;
- fw_busreset(sc);
- } else
- sc->state = FWOHCI_STATE_DEAD;
- }
-}
-
-void
-fw_poll(void)
-{
- struct fwohci_softc *sc;
- int i;
-
- if (fw_initialized == 0)
- return;
-
- for (i = 0; i < MAX_OHCI; i ++) {
- sc = &fwinfo[i];
- if (sc->state < FWOHCI_STATE_ENABLED)
- break;
- fwohci_poll(sc);
- }
-}
-
-#if 0 /* for debug */
-static int
-fw_busreset_cmd(int argc, char *argv[])
-{
- struct fwohci_softc *sc;
- int i;
-
- for (i = 0; i < MAX_OHCI; i ++) {
- sc = &fwinfo[i];
- if (sc->state < FWOHCI_STATE_INIT)
- break;
- fw_busreset(sc);
- }
- return(CMD_OK);
-}
-
-static int
-fw_poll_cmd(int argc, char *argv[])
-{
- fw_poll();
- return(CMD_OK);
-}
-
-static int
-fw_enable_cmd(int argc, char *argv[])
-{
- fw_print(0);
- fw_enable();
- return(CMD_OK);
-}
-
-
-static int
-dcons_enable(int argc, char *argv[])
-{
- dconsole.c_init(0);
- fw_enable();
- dconsole.c_flags |= C_ACTIVEIN | C_ACTIVEOUT;
- return(CMD_OK);
-}
-
-static int
-dcons_read(int argc, char *argv[])
-{
- char c;
- while (dconsole.c_ready()) {
- c = dconsole.c_in();
- printf("%c", c);
- }
- printf("\r\n");
- return(CMD_OK);
-}
-
-static int
-dcons_write(int argc, char *argv[])
-{
- int len, i;
- if (argc < 2)
- return(CMD_OK);
-
- len = strlen(argv[1]);
- for (i = 0; i < len; i ++)
- dconsole.c_out(argv[1][i]);
- dconsole.c_out('\r');
- dconsole.c_out('\n');
- return(CMD_OK);
-}
-COMMAND_SET(firewire, "firewire", "enable firewire", fw_enable_cmd);
-COMMAND_SET(fwbusreset, "fwbusreset", "firewire busreset", fw_busreset_cmd);
-COMMAND_SET(fwpoll, "fwpoll", "firewire poll", fw_poll_cmd);
-COMMAND_SET(dcons, "dcons", "enable dcons", dcons_enable);
-COMMAND_SET(dread, "dread", "read from dcons", dcons_read);
-COMMAND_SET(dwrite, "dwrite", "write to dcons", dcons_write);
-#endif
diff --git a/stand/i386/libfirewire/fwohci.c b/stand/i386/libfirewire/fwohci.c
deleted file mode 100644
index 85e6173dc9be..000000000000
--- a/stand/i386/libfirewire/fwohci.c
+++ /dev/null
@@ -1,474 +0,0 @@
-/*
- * Copyright (c) 2003 Hidetoshi Shimokawa
- * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
- * 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
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the acknowledgement as bellow:
- *
- * This product includes software developed by K. Kobayashi and H. Shimokawa
- *
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
- *
- * $FreeBSD$
- *
- */
-
-#include <stand.h>
-#include <btxv86.h>
-#include <bootstrap.h>
-
-#include <dev/firewire/firewire.h>
-#include "fwohci.h"
-#include <dev/firewire/fwohcireg.h>
-#include <dev/firewire/firewire_phy.h>
-
-static uint32_t fwphy_wrdata ( struct fwohci_softc *, uint32_t, uint32_t);
-static uint32_t fwphy_rddata ( struct fwohci_softc *, uint32_t);
-int firewire_debug=0;
-
-#if 0
-#define device_printf(a, x, ...) printf("FW1394: " x, ## __VA_ARGS__)
-#else
-#define device_printf(a, x, ...)
-#endif
-
-#define device_t int
-#define DELAY(x) delay(x)
-
-#define MAX_SPEED 3
-#define MAXREC(x) (2 << (x))
-char *linkspeed[] = {
- "S100", "S200", "S400", "S800",
- "S1600", "S3200", "undef", "undef"
-};
-
-/*
- * Communication with PHY device
- */
-static uint32_t
-fwphy_wrdata( struct fwohci_softc *sc, uint32_t addr, uint32_t data)
-{
- uint32_t fun;
-
- addr &= 0xf;
- data &= 0xff;
-
- fun = (PHYDEV_WRCMD | (addr << PHYDEV_REGADDR) | (data << PHYDEV_WRDATA));
- OWRITE(sc, OHCI_PHYACCESS, fun);
- DELAY(100);
-
- return(fwphy_rddata( sc, addr));
-}
-
-static uint32_t
-fwphy_rddata(struct fwohci_softc *sc, u_int addr)
-{
- uint32_t fun, stat;
- u_int i, retry = 0;
-
- addr &= 0xf;
-#define MAX_RETRY 100
-again:
- OWRITE(sc, FWOHCI_INTSTATCLR, OHCI_INT_REG_FAIL);
- fun = PHYDEV_RDCMD | (addr << PHYDEV_REGADDR);
- OWRITE(sc, OHCI_PHYACCESS, fun);
- for ( i = 0 ; i < MAX_RETRY ; i ++ ){
- fun = OREAD(sc, OHCI_PHYACCESS);
- if ((fun & PHYDEV_RDCMD) == 0 && (fun & PHYDEV_RDDONE) != 0)
- break;
- DELAY(100);
- }
- if(i >= MAX_RETRY) {
- if (firewire_debug)
- device_printf(sc->fc.dev, "phy read failed(1).\n");
- if (++retry < MAX_RETRY) {
- DELAY(100);
- goto again;
- }
- }
- /* Make sure that SCLK is started */
- stat = OREAD(sc, FWOHCI_INTSTAT);
- if ((stat & OHCI_INT_REG_FAIL) != 0 ||
- ((fun >> PHYDEV_REGADDR) & 0xf) != addr) {
- if (firewire_debug)
- device_printf(sc->fc.dev, "phy read failed(2).\n");
- if (++retry < MAX_RETRY) {
- DELAY(100);
- goto again;
- }
- }
- if (firewire_debug || retry >= MAX_RETRY)
- device_printf(sc->fc.dev,
- "fwphy_rddata: 0x%x loop=%d, retry=%d\n", addr, i, retry);
-#undef MAX_RETRY
- return((fun >> PHYDEV_RDDATA )& 0xff);
-}
-
-
-static int
-fwohci_probe_phy(struct fwohci_softc *sc, device_t dev)
-{
- uint32_t reg, reg2;
- int e1394a = 1;
- int nport, speed;
-/*
- * probe PHY parameters
- * 0. to prove PHY version, whether compliance of 1394a.
- * 1. to probe maximum speed supported by the PHY and
- * number of port supported by core-logic.
- * It is not actually available port on your PC .
- */
- OWRITE(sc, OHCI_HCCCTL, OHCI_HCC_LPS);
- DELAY(500);
-
- reg = fwphy_rddata(sc, FW_PHY_SPD_REG);
-
- if((reg >> 5) != 7 ){
- nport = reg & FW_PHY_NP;
- speed = reg & FW_PHY_SPD >> 6;
- if (speed > MAX_SPEED) {
- device_printf(dev, "invalid speed %d (fixed to %d).\n",
- speed, MAX_SPEED);
- speed = MAX_SPEED;
- }
- device_printf(dev,
- "Phy 1394 only %s, %d ports.\n",
- linkspeed[speed], nport);
- }else{
- reg2 = fwphy_rddata(sc, FW_PHY_ESPD_REG);
- nport = reg & FW_PHY_NP;
- speed = (reg2 & FW_PHY_ESPD) >> 5;
- if (speed > MAX_SPEED) {
- device_printf(dev, "invalid speed %d (fixed to %d).\n",
- speed, MAX_SPEED);
- speed = MAX_SPEED;
- }
- device_printf(dev,
- "Phy 1394a available %s, %d ports.\n",
- linkspeed[speed], nport);
-
- /* check programPhyEnable */
- reg2 = fwphy_rddata(sc, 5);
-#if 0
- if (e1394a && (OREAD(sc, OHCI_HCCCTL) & OHCI_HCC_PRPHY)) {
-#else /* XXX force to enable 1394a */
- if (e1394a) {
-#endif
- if (firewire_debug)
- device_printf(dev,
- "Enable 1394a Enhancements\n");
- /* enable EAA EMC */
- reg2 |= 0x03;
- /* set aPhyEnhanceEnable */
- OWRITE(sc, OHCI_HCCCTL, OHCI_HCC_PHYEN);
- OWRITE(sc, OHCI_HCCCTLCLR, OHCI_HCC_PRPHY);
- } else {
- /* for safe */
- reg2 &= ~0x83;
- }
- reg2 = fwphy_wrdata(sc, 5, reg2);
- }
- sc->speed = speed;
-
- reg = fwphy_rddata(sc, FW_PHY_SPD_REG);
- if((reg >> 5) == 7 ){
- reg = fwphy_rddata(sc, 4);
- reg |= 1 << 6;
- fwphy_wrdata(sc, 4, reg);
- reg = fwphy_rddata(sc, 4);
- }
- return 0;
-}
-
-
-void
-fwohci_reset(struct fwohci_softc *sc, device_t dev)
-{
- int i, max_rec, speed;
- uint32_t reg, reg2;
-
- /* Disable interrupts */
- OWRITE(sc, FWOHCI_INTMASKCLR, ~0);
*** 534 LINES SKIPPED ***