PERFORCE change 60275 for review
Robert Watson
rwatson at FreeBSD.org
Sun Aug 22 10:21:37 PDT 2004
http://perforce.freebsd.org/chv.cgi?CH=60275
Change 60275 by rwatson at rwatson_paprika on 2004/08/22 17:21:09
Integrate netperf_socket:
ATA DMA disabled on sparc64 by default and various ATA bug fixes.
GEOMified and fixed floppy disk driver.
netperf-centric:
GIANT_REQUIRED removed from setugidsafety() as KQueue is now MPSAFE.
GIANT_REQUIRED removed from firewire_output().
Routing socket netisr queue size tunable.
UDP link header optimization merged.
in6_pcbnotify() locking fix merged.
if_sk locking fixes.
Affected files ...
.. //depot/projects/netperf_socket/sys/boot/alpha/Makefile.inc#3 integrate
.. //depot/projects/netperf_socket/sys/boot/alpha/common/Makefile.common#3 integrate
.. //depot/projects/netperf_socket/sys/boot/alpha/common/ldscript#1 branch
.. //depot/projects/netperf_socket/sys/boot/common/load.c#2 integrate
.. //depot/projects/netperf_socket/sys/boot/ficl/Makefile#3 integrate
.. //depot/projects/netperf_socket/sys/boot/sparc64/loader/main.c#3 integrate
.. //depot/projects/netperf_socket/sys/conf/NOTES#38 integrate
.. //depot/projects/netperf_socket/sys/conf/options.i386#6 integrate
.. //depot/projects/netperf_socket/sys/conf/options.pc98#7 integrate
.. //depot/projects/netperf_socket/sys/contrib/pf/net/pf_ioctl.c#10 integrate
.. //depot/projects/netperf_socket/sys/dev/acpica/acpi_pci_link.c#11 integrate
.. //depot/projects/netperf_socket/sys/dev/acpica/acpi_resource.c#10 integrate
.. //depot/projects/netperf_socket/sys/dev/aic7xxx/aic79xx_pci.c#5 integrate
.. //depot/projects/netperf_socket/sys/dev/aic7xxx/aic7xxx_pci.c#2 integrate
.. //depot/projects/netperf_socket/sys/dev/ata/ata-dma.c#6 integrate
.. //depot/projects/netperf_socket/sys/dev/ata/ata-pci.c#11 integrate
.. //depot/projects/netperf_socket/sys/dev/ata/ata-queue.c#12 integrate
.. //depot/projects/netperf_socket/sys/dev/fdc/fdc.c#9 integrate
.. //depot/projects/netperf_socket/sys/dev/fdc/fdc_acpi.c#3 integrate
.. //depot/projects/netperf_socket/sys/dev/fdc/fdc_isa.c#5 integrate
.. //depot/projects/netperf_socket/sys/dev/fdc/fdc_pccard.c#5 integrate
.. //depot/projects/netperf_socket/sys/dev/fdc/fdcreg.h#2 delete
.. //depot/projects/netperf_socket/sys/dev/fdc/fdcvar.h#4 integrate
.. //depot/projects/netperf_socket/sys/dev/mpt/mpt.c#2 integrate
.. //depot/projects/netperf_socket/sys/dev/mpt/mpt_debug.c#3 integrate
.. //depot/projects/netperf_socket/sys/dev/mpt/mpt_freebsd.c#2 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/usb_quirks.c#4 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/usbdevs#22 integrate
.. //depot/projects/netperf_socket/sys/geom/raid3/g_raid3.c#3 integrate
.. //depot/projects/netperf_socket/sys/geom/raid3/g_raid3.h#2 integrate
.. //depot/projects/netperf_socket/sys/geom/raid3/g_raid3_ctl.c#2 integrate
.. //depot/projects/netperf_socket/sys/geom/vinum/geom_vinum_rm.c#2 integrate
.. //depot/projects/netperf_socket/sys/geom/vinum/geom_vinum_subr.c#6 integrate
.. //depot/projects/netperf_socket/sys/i386/acpica/acpi_wakeup.c#8 integrate
.. //depot/projects/netperf_socket/sys/i386/conf/NOTES#26 integrate
.. //depot/projects/netperf_socket/sys/i386/i386/uio_machdep.c#5 integrate
.. //depot/projects/netperf_socket/sys/kern/kern_descrip.c#18 integrate
.. //depot/projects/netperf_socket/sys/kern/kern_module.c#4 integrate
.. //depot/projects/netperf_socket/sys/kern/kern_shutdown.c#14 integrate
.. //depot/projects/netperf_socket/sys/kern/kern_switch.c#10 integrate
.. //depot/projects/netperf_socket/sys/kern/sched_4bsd.c#13 integrate
.. //depot/projects/netperf_socket/sys/kern/subr_disk.c#2 integrate
.. //depot/projects/netperf_socket/sys/kern/subr_kdb.c#6 integrate
.. //depot/projects/netperf_socket/sys/kern/subr_rman.c#5 integrate
.. //depot/projects/netperf_socket/sys/kern/uipc_socket.c#38 integrate
.. //depot/projects/netperf_socket/sys/kern/vfs_subr.c#22 integrate
.. //depot/projects/netperf_socket/sys/modules/agp/Makefile#4 integrate
.. //depot/projects/netperf_socket/sys/net/if_fwsubr.c#6 integrate
.. //depot/projects/netperf_socket/sys/net/route.c#12 integrate
.. //depot/projects/netperf_socket/sys/net/rtsock.c#12 integrate
.. //depot/projects/netperf_socket/sys/netgraph/bluetooth/include/ng_btsocket.h#4 integrate
.. //depot/projects/netperf_socket/sys/netgraph/netgraph.h#8 integrate
.. //depot/projects/netperf_socket/sys/netgraph/ng_message.h#4 integrate
.. //depot/projects/netperf_socket/sys/netinet/ip_fw.h#10 integrate
.. //depot/projects/netperf_socket/sys/netinet/ip_fw2.c#16 integrate
.. //depot/projects/netperf_socket/sys/netinet/ip_fw_pfil.c#2 integrate
.. //depot/projects/netperf_socket/sys/netinet/ip_input.c#23 integrate
.. //depot/projects/netperf_socket/sys/netinet/ip_mroute.c#13 integrate
.. //depot/projects/netperf_socket/sys/netinet/ip_output.c#18 integrate
.. //depot/projects/netperf_socket/sys/netinet/raw_ip.c#14 integrate
.. //depot/projects/netperf_socket/sys/netinet/tcp_subr.c#19 integrate
.. //depot/projects/netperf_socket/sys/netinet/udp_usrreq.c#14 integrate
.. //depot/projects/netperf_socket/sys/netinet6/in6_pcb.c#10 integrate
.. //depot/projects/netperf_socket/sys/pc98/pc98/fd.c#13 integrate
.. //depot/projects/netperf_socket/sys/pci/agp_ali.c#5 integrate
.. //depot/projects/netperf_socket/sys/pci/agp_amd64.c#2 integrate
.. //depot/projects/netperf_socket/sys/pci/agp_intel.c#6 integrate
.. //depot/projects/netperf_socket/sys/pci/agp_sis.c#6 integrate
.. //depot/projects/netperf_socket/sys/pci/agp_via.c#8 integrate
.. //depot/projects/netperf_socket/sys/pci/if_sk.c#12 integrate
.. //depot/projects/netperf_socket/sys/pci/if_skreg.h#3 integrate
.. //depot/projects/netperf_socket/sys/security/mac_bsdextended/mac_bsdextended.c#4 integrate
.. //depot/projects/netperf_socket/sys/sparc64/sparc64/uio_machdep.c#6 integrate
.. //depot/projects/netperf_socket/sys/sys/bio.h#6 integrate
.. //depot/projects/netperf_socket/sys/sys/fdcio.h#2 integrate
.. //depot/projects/netperf_socket/sys/sys/param.h#26 integrate
.. //depot/projects/netperf_socket/sys/ufs/ufs/ufs_vnops.c#7 integrate
.. //depot/projects/netperf_socket/sys/vm/vm_fault.c#8 integrate
Differences ...
==== //depot/projects/netperf_socket/sys/boot/alpha/Makefile.inc#3 (text+ko) ====
@@ -1,9 +1,9 @@
-# $FreeBSD: src/sys/boot/alpha/Makefile.inc,v 1.9 2004/02/11 22:01:16 ru Exp $
+# $FreeBSD: src/sys/boot/alpha/Makefile.inc,v 1.10 2004/08/22 06:24:59 marcel Exp $
# Options used when building app-specific libalpha components
BINDIR?= /boot
-CFLAGS+= -ffreestanding -mno-fp-regs
+CFLAGS+= -ffreestanding -mno-fp-regs -Os
LDFLAGS+= -nostdlib
PRIMARY_LOAD_ADDRESS= 0x20000000 # "Region 1 start"
SECONDARY_LOAD_ADDRESS= 0x2000c000 # "Region 1 start" + 48k
==== //depot/projects/netperf_socket/sys/boot/alpha/common/Makefile.common#3 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/boot/alpha/common/Makefile.common,v 1.18 2004/02/11 22:01:17 ru Exp $
+# $FreeBSD: src/sys/boot/alpha/common/Makefile.common,v 1.19 2004/08/22 00:26:01 marcel Exp $
#
# Common Alpha loader build rules
@@ -40,7 +40,7 @@
vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
-LDFLAGS=-e start -N -Ttext ${LOAD_ADDRESS}
+LDFLAGS=-e start -Ttext ${LOAD_ADDRESS} -T ${.CURDIR}/../common/ldscript
FILES= ${BOOT}
# XXX INSTALLFLAGS_${BOOT}= -b
==== //depot/projects/netperf_socket/sys/boot/common/load.c#2 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/boot/common/load.c,v 1.3 2003/08/25 23:30:41 obrien Exp $");
+__FBSDID("$FreeBSD: src/sys/boot/common/load.c,v 1.5 2004/08/22 08:57:05 maxim Exp $");
#include <stand.h>
@@ -45,10 +45,10 @@
char *buf;
int fd;
size_t size, result;
-
+
if ((fd = open(path, F_READ | flags)) == -1)
return(NULL);
-
+
printf("%s open, flags 0x%x\n", path, files[fd].f_flags);
buf = alloc(LOAD_TINYBUF);
@@ -68,12 +68,11 @@
printf("tinybuf loaded, size %d\n", size);
getchar();
-
-
+
/* Read everything until we know how big it is */
for (;;) {
result = read(fd, buf, LOAD_TINYBUF);
- if (size == -1) {
+ if (result == -1) {
free(buf, LOAD_TINYBUF);
close(fd);
return(NULL);
@@ -82,7 +81,7 @@
break;
size += result;
}
-
+
/* discard the old buffer, close the file */
free(buf, LOAD_TINYBUF);
close(fd);
==== //depot/projects/netperf_socket/sys/boot/ficl/Makefile#3 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/boot/ficl/Makefile,v 1.37 2004/02/07 08:10:07 ru Exp $
+# $FreeBSD: src/sys/boot/ficl/Makefile,v 1.38 2004/08/22 06:24:59 marcel Exp $
#
.PATH: ${.CURDIR}/${MACHINE_ARCH:S/amd64/i386/}
BASE_SRCS= dict.c ficl.c fileaccess.c float.c loader.c math64.c \
@@ -8,7 +8,7 @@
CLEANFILES= softcore.c testmain testmain.o
CFLAGS+= -ffreestanding
.if ${MACHINE_ARCH} == "alpha"
-CFLAGS+= -mno-fp-regs
+CFLAGS+= -mno-fp-regs -Os
.endif
.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64"
CFLAGS+= -mpreferred-stack-boundary=2
==== //depot/projects/netperf_socket/sys/boot/sparc64/loader/main.c#3 (text+ko) ====
@@ -8,7 +8,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/boot/sparc64/loader/main.c,v 1.23 2004/08/16 15:45:25 marius Exp $");
+__FBSDID("$FreeBSD: src/sys/boot/sparc64/loader/main.c,v 1.24 2004/08/19 20:13:31 kensmith Exp $");
/*
* FreeBSD/sparc64 kernel loader - machine dependent part
@@ -197,7 +197,9 @@
static int
sparc64_autoload(void)
{
- printf("nothing to autoload yet.\n");
+ /* XXX - Temporary hack needed for new ATA to work. */
+ printf("Turning off DMA for ATA.\n");
+ setenv("hw.ata.ata_dma", "0", 1);
return 0;
}
==== //depot/projects/netperf_socket/sys/conf/NOTES#38 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/NOTES,v 1.1262 2004/08/19 06:38:26 jmg Exp $
+# $FreeBSD: src/sys/conf/NOTES,v 1.1263 2004/08/19 18:29:55 andre Exp $
#
# NOTES -- Lines that can be cut/pasted into kernel and hints configs.
#
@@ -599,6 +599,7 @@
# conjunction with the `ipfw' program. IPFIREWALL_VERBOSE sends
# logged packets to the system logger. IPFIREWALL_VERBOSE_LIMIT
# limits the number of times a matching entry can be logged.
+# IPFIREWALL requires the option PFIL_HOOKS.
#
# WARNING: IPFIREWALL defaults to a policy of "deny ip from any to any"
# and if you do not add other rules during startup to allow access,
==== //depot/projects/netperf_socket/sys/conf/options.i386#6 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/options.i386,v 1.214 2004/08/16 12:25:47 obrien Exp $
+# $FreeBSD: src/sys/conf/options.i386,v 1.215 2004/08/19 20:58:23 obrien Exp $
# Options specific to the i386 platform kernels
AUTO_EOI_1 opt_auto_eoi.h
@@ -162,6 +162,3 @@
# Device options
DEV_APIC opt_apic.h
DEV_NPX opt_npx.h
-
-# agp options
-AGP_AMD64_GART opt_agp.h
==== //depot/projects/netperf_socket/sys/conf/options.pc98#7 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/options.pc98,v 1.178 2004/08/18 03:46:39 rwatson Exp $
+# $FreeBSD: src/sys/conf/options.pc98,v 1.179 2004/08/22 15:13:08 nyan Exp $
# Options specific to the pc98 platform kernels
AUTO_EOI_1 opt_auto_eoi.h
@@ -108,6 +108,3 @@
DEV_APIC opt_apic.h
DEV_MECIA opt_mecia.h
DEV_NPX opt_npx.h
-
-# agp options
-AGP_AMD64_GART opt_agp.h
==== //depot/projects/netperf_socket/sys/contrib/pf/net/pf_ioctl.c#10 (text+ko) ====
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/contrib/pf/net/pf_ioctl.c,v 1.12 2004/08/12 14:15:42 mlaier Exp $ */
+/* $FreeBSD: src/sys/contrib/pf/net/pf_ioctl.c,v 1.13 2004/08/22 15:23:48 mlaier Exp $ */
/* $OpenBSD: pf_ioctl.c,v 1.112.2.2 2004/07/24 18:28:12 brad Exp $ */
/*
@@ -66,6 +66,7 @@
#ifdef __FreeBSD__
#include <sys/module.h>
#include <sys/conf.h>
+#include <sys/proc.h>
#else
#include <sys/timeout.h>
#include <sys/pool.h>
@@ -979,7 +980,11 @@
int error = 0;
/* XXX keep in sync with switch() below */
+#ifdef __FreeBSD__
+ if (securelevel_gt(td->td_ucred, 1))
+#else
if (securelevel > 1)
+#endif
switch (cmd) {
case DIOCGETRULES:
case DIOCGETRULE:
==== //depot/projects/netperf_socket/sys/dev/acpica/acpi_pci_link.c#11 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_pci_link.c,v 1.25 2004/08/18 16:39:59 njl Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_pci_link.c,v 1.26 2004/08/21 18:18:32 njl Exp $");
#include "opt_acpi.h"
#include <sys/param.h>
@@ -1018,7 +1018,7 @@
/* Walk through all PRT entries for this PCI bridge. */
ACPI_SERIAL_BEGIN(pci_link);
TAILQ_FOREACH(entry, &acpi_prt_entries, links) {
- if (entry->pcidev == dev || entry->pci_link == NULL)
+ if (entry->pcidev != dev || entry->pci_link == NULL)
continue;
link = entry->pci_link;
==== //depot/projects/netperf_socket/sys/dev/acpica/acpi_resource.c#10 (text+ko) ====
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_resource.c,v 1.28 2004/08/13 06:22:13 njl Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_resource.c,v 1.30 2004/08/20 17:04:49 njl Exp $");
#include "opt_acpi.h"
#include <sys/param.h>
@@ -504,6 +504,51 @@
void *ar_parent;
};
+/*
+ * Add a resource to the device's resource list. We define our own function
+ * for this since bus_set_resource() doesn't handle duplicates of any kind.
+ *
+ * XXX This should be merged into resource_list_add() eventually.
+ */
+static int
+acpi_reslist_add(device_t dev, int type, int rid, u_long start, u_long count)
+{
+ struct resource_list_entry *rle;
+ struct resource_list *rl;
+ u_long end;
+
+ end = start + count - 1;
+ rl = BUS_GET_RESOURCE_LIST(device_get_parent(dev), dev);
+
+ /*
+ * Loop through all current resources to see if the new one overlaps
+ * any existing ones. If so, the old one always takes precedence and
+ * the new one is adjusted (or rejected). We check for three cases:
+ *
+ * 1. Tail of new resource overlaps head of old resource: truncate the
+ * new resource so it is contiguous with the start of the old.
+ * 2. New resource wholly contained within the old resource: error.
+ * 3. Head of new resource overlaps tail of old resource: truncate the
+ * new resource so it is contiguous, following the old.
+ */
+ SLIST_FOREACH(rle, rl, link) {
+ if (rle->type == type) {
+ if (start < rle->start && end >= rle->start) {
+ count = rle->start - start;
+ break;
+ } else if (start >= rle->start && start <= rle->end) {
+ if (end > rle->end) {
+ start = rle->end + 1;
+ count = end - start + 1;
+ break;
+ } else
+ return (EEXIST);
+ }
+ }
+ }
+ return (bus_set_resource(dev, type, rid, start, count));
+}
+
static void
acpi_res_set_init(device_t dev, void *arg, void **context)
{
@@ -534,7 +579,7 @@
if (cp == NULL)
return;
- bus_set_resource(dev, SYS_RES_IOPORT, cp->ar_nio++, base, length);
+ acpi_reslist_add(dev, SYS_RES_IOPORT, cp->ar_nio++, base, length);
}
static void
@@ -557,7 +602,7 @@
if (cp == NULL)
return;
- bus_set_resource(dev, SYS_RES_MEMORY, cp->ar_nmem++, base, length);
+ acpi_reslist_add(dev, SYS_RES_MEMORY, cp->ar_nmem++, base, length);
}
static void
@@ -584,7 +629,7 @@
if (count != 1)
return;
- bus_set_resource(dev, SYS_RES_IRQ, cp->ar_nirq++, *irq, 1);
+ acpi_reslist_add(dev, SYS_RES_IRQ, cp->ar_nirq++, *irq, 1);
}
static void
@@ -599,7 +644,7 @@
if (count != 1)
return;
- bus_set_resource(dev, SYS_RES_DRQ, cp->ar_ndrq++, *drq, 1);
+ acpi_reslist_add(dev, SYS_RES_DRQ, cp->ar_ndrq++, *drq, 1);
}
static void
==== //depot/projects/netperf_socket/sys/dev/aic7xxx/aic79xx_pci.c#5 (text+ko) ====
@@ -46,7 +46,7 @@
#include "aic79xx_inline.h"
#else
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/aic7xxx/aic79xx_pci.c,v 1.20 2004/08/04 17:55:34 gibbs Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/aic7xxx/aic79xx_pci.c,v 1.21 2004/08/22 13:54:27 gibbs Exp $");
#include <dev/aic7xxx/aic79xx_osm.h>
#include <dev/aic7xxx/aic79xx_inline.h>
#endif
@@ -996,9 +996,9 @@
u_int devconfig1;
ahd->features |= AHD_RTI|AHD_NEW_IOCELL_OPTS
- | AHD_NEW_DFCNTRL_OPTS|AHD_FAST_CDB_DELIVERY
- | AHD_BUSFREEREV_BUG;
- ahd->bugs |= AHD_LQOOVERRUN_BUG|AHD_EARLY_REQ_BUG;
+ | AHD_NEW_DFCNTRL_OPTS|AHD_FAST_CDB_DELIVERY;
+ ahd->bugs |= AHD_LQOOVERRUN_BUG|AHD_EARLY_REQ_BUG
+ | AHD_BUSFREEREV_BUG;
/*
* Some issues have been resolved in the 7901B.
==== //depot/projects/netperf_socket/sys/dev/aic7xxx/aic7xxx_pci.c#2 (text+ko) ====
@@ -48,7 +48,7 @@
#include "aic7xxx_93cx6.h"
#else
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/aic7xxx/aic7xxx_pci.c,v 1.32 2003/12/17 00:02:10 gibbs Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/aic7xxx/aic7xxx_pci.c,v 1.33 2004/08/22 14:02:43 gibbs Exp $");
#include <dev/aic7xxx/aic7xxx_osm.h>
#include <dev/aic7xxx/aic7xxx_inline.h>
#include <dev/aic7xxx/aic7xxx_93cx6.h>
@@ -2119,12 +2119,13 @@
* that the OS doesn't know about and rely on our chip
* reset handler to handle the rest.
*/
- aic_pci_write_config(ahc->dev_softc, DEVCONFIG, /*bytes*/4,
- ahc->bus_softc.pci_softc.devconfig);
- aic_pci_write_config(ahc->dev_softc, PCIR_COMMAND, /*bytes*/1,
- ahc->bus_softc.pci_softc.command);
- aic_pci_write_config(ahc->dev_softc, CSIZE_LATTIME, /*bytes*/1,
- ahc->bus_softc.pci_softc.csize_lattime);
+ aic_pci_write_config(ahc->dev_softc, DEVCONFIG,
+ ahc->bus_softc.pci_softc.devconfig, /*bytes*/4);
+ aic_pci_write_config(ahc->dev_softc, PCIR_COMMAND,
+ ahc->bus_softc.pci_softc.command, /*bytes*/1);
+ aic_pci_write_config(ahc->dev_softc, CSIZE_LATTIME,
+ ahc->bus_softc.pci_softc.csize_lattime,
+ /*bytes*/1);
if ((ahc->flags & AHC_HAS_TERM_LOGIC) != 0) {
struct seeprom_descriptor sd;
u_int sxfrctl1;
==== //depot/projects/netperf_socket/sys/dev/ata/ata-dma.c#6 (text+ko) ====
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ata/ata-dma.c,v 1.129 2004/08/13 08:14:27 sos Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ata/ata-dma.c,v 1.130 2004/08/20 19:05:22 sos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -59,7 +59,6 @@
/* misc defines */
#define MAXTABSZ PAGE_SIZE
#define MAXWSPCSZ PAGE_SIZE
-#define MAXCTLDMASZ (2 * (MAXTABSZ + MAXPHYS))
struct ata_dc_cb_args {
bus_addr_t maddr;
@@ -95,10 +94,10 @@
{
struct ata_dc_cb_args ccba;
- if (bus_dma_tag_create(NULL, 1, 0,
+ if (bus_dma_tag_create(NULL, ch->dma->alignment, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR,
- NULL, NULL, MAXCTLDMASZ,
- ATA_DMA_ENTRIES, BUS_SPACE_MAXSIZE_32BIT,
+ NULL, NULL, 16*1024*1024,
+ ATA_DMA_ENTRIES, ch->dma->max_iosize,
BUS_DMA_ALLOCNOW, NULL, NULL, &ch->dma->dmatag))
goto error;
@@ -110,8 +109,8 @@
if (bus_dma_tag_create(ch->dma->dmatag,ch->dma->alignment,ch->dma->boundary,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR,
- NULL, NULL, ch->dma->max_iosize,
- ATA_DMA_ENTRIES, ch->dma->boundary,
+ NULL, NULL, 16*1024*1024,
+ ATA_DMA_ENTRIES, ch->dma->max_iosize,
BUS_DMA_ALLOCNOW, NULL, NULL, &ch->dma->ddmatag))
goto error;
==== //depot/projects/netperf_socket/sys/dev/ata/ata-pci.c#11 (text+ko) ====
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ata/ata-pci.c,v 1.87 2004/08/12 08:20:36 sos Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ata/ata-pci.c,v 1.88 2004/08/20 06:19:25 sos Exp $");
#include "opt_ata.h"
#include <sys/param.h>
@@ -535,7 +535,8 @@
ch->locking = ctlr->locking;
ch->reset = ctlr->reset;
- ctlr->dmainit(ch);
+ if (ctlr->r_res1)
+ ctlr->dmainit(ch);
if (ch->dma)
ch->dma->alloc(ch);
==== //depot/projects/netperf_socket/sys/dev/ata/ata-queue.c#12 (text+ko) ====
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ata/ata-queue.c,v 1.32 2004/08/16 09:32:35 sos Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ata/ata-queue.c,v 1.33 2004/08/22 15:54:08 sos Exp $");
#include "opt_ata.h"
#include <sys/param.h>
@@ -238,8 +238,16 @@
ATA_DEBUG_RQ(request, "completed called");
if (request->flags & ATA_R_TIMEOUT) {
- /* workaround for devices failing to interrupt */
- if (request->status == (ATA_S_READY | ATA_S_DSC)) {
+ /* workarounds for devices failing to interrupt */
+ if (!request->status) {
+ ata_prtdev(request->device,
+ "FAILURE - %s no interrupt\n",
+ ata_cmd2str(request));
+ request->result = ENXIO;
+ ATA_UNLOCK_CH(channel);
+ channel->locking(channel, ATA_LF_UNLOCK);
+ }
+ else if (request->status == (ATA_S_READY | ATA_S_DSC)) {
ata_prtdev(request->device,
"WARNING - %s no interrupt but good status\n",
ata_cmd2str(request));
==== //depot/projects/netperf_socket/sys/dev/fdc/fdc.c#9 (text+ko) ====
@@ -1,4 +1,5 @@
/*-
+ * Copyright (c) 2004 Poul-Henning Kamp
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
@@ -46,10 +47,11 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
+ *
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/fdc/fdc.c,v 1.283 2004/08/14 21:40:28 phk Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/fdc/fdc.c,v 1.285 2004/08/21 08:40:00 phk Exp $");
#include "opt_fdc.h"
@@ -62,36 +64,56 @@
#include <sys/fdcio.h>
#include <sys/filio.h>
#include <sys/kernel.h>
+#include <sys/kthread.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/rman.h>
+#include <sys/sysctl.h>
#include <sys/systm.h>
+#include <geom/geom.h>
+
#include <machine/bus.h>
#include <machine/clock.h>
#include <machine/stdarg.h>
#include <isa/isavar.h>
#include <isa/isareg.h>
-#include <dev/fdc/fdcreg.h>
#include <dev/fdc/fdcvar.h>
#include <isa/rtc.h>
-#define FDBIO_FORMAT BIO_CMD2
+#include <dev/ic/nec765.h>
+
+/*
+ * Runtime configuration hints/flags
+ */
+
+/* configuration flags for fd */
+#define FD_TYPEMASK 0x0f /* drive type, matches enum
+ * fd_drivetype; on i386 machines, if
+ * given as 0, use RTC type for fd0
+ * and fd1 */
+#define FD_NO_CHLINE 0x10 /* drive does not support changeline
+ * aka. unit attention */
+#define FD_NO_PROBE 0x20 /* don't probe drive (seek test), just
+ * assume it is there */
-/* configuration flags for fdc */
-#define FDC_NO_FIFO (1 << 2) /* do not enable FIFO */
+/*
+ * Things that could conceiveably considered parameters or tweakables
+ */
/*
- * Stop retrying after this many DMA overruns. Since each retry takes
- * one revolution, with 300 rpm., 25 retries take approximately 5
- * seconds which the read attempt will block in case the DMA overrun
- * is persistent.
+ * Maximal number of bytes in a cylinder.
+ * This is used for ISADMA bouncebuffer allocation and sets the max
+ * xfersize we support.
+ *
+ * 2.88M format has 2 x 36 x 512.
*/
-#define FDC_DMAOV_MAX 25
+
+#define MAX_BYTES_PER_CYL (2 * 40 * 512)
/*
* Timeout value for the PIO loops to wait until the FDC main status
@@ -105,230 +127,216 @@
#define FDSTS_TIMEOUT 100000
/*
- * Number of subdevices that can be used for different density types.
+ * After this many errors, stop whining. Close will reset this count.
*/
-#define NUMDENS 16
-
-#define FDBIO_RDSECTID BIO_CMD1
+#define FDC_ERRMAX 100 /* do not log more */
/*
- * List of native drive densities. Order must match enum fd_drivetype
- * in <sys/fdcio.h>. Upon attaching the drive, each of the
- * programmable subdevices is initialized with the native density
- * definition.
+ * AutoDensity search lists for each drive type.
*/
-static struct fd_type fd_native_types[] =
-{
-{ 0 }, /* FDT_NONE */
-{ 9,2,0xFF,0x2A,40, 720,FDC_250KBPS,2,0x50,1,0,FL_MFM }, /* FDT_360K */
-{ 15,2,0xFF,0x1B,80,2400,FDC_500KBPS,2,0x54,1,0,FL_MFM }, /* FDT_12M */
-{ 9,2,0xFF,0x20,80,1440,FDC_250KBPS,2,0x50,1,0,FL_MFM }, /* FDT_720K */
-{ 18,2,0xFF,0x1B,80,2880,FDC_500KBPS,2,0x6C,1,0,FL_MFM }, /* FDT_144M */
-#if 0 /* we currently don't handle 2.88 MB */
-{ 36,2,0xFF,0x1B,80,5760,FDC_1MBPS, 2,0x4C,1,1,FL_MFM|FL_PERPND } /*FDT_288M*/
-#else
-{ 18,2,0xFF,0x1B,80,2880,FDC_500KBPS,2,0x6C,1,0,FL_MFM }, /* FDT_144M */
-#endif
+
+static struct fd_type fd_searchlist_360k[] = {
+ { FDF_5_360 },
+ { 0 }
};
-/*
- * 360 KB 5.25" and 720 KB 3.5" drives don't have automatic density
- * selection, they just start out with their native density (or lose).
- * So 1.2 MB 5.25", 1.44 MB 3.5", and 2.88 MB 3.5" drives have their
- * respective lists of densities to search for.
- */
static struct fd_type fd_searchlist_12m[] = {
-{ 15,2,0xFF,0x1B,80,2400,FDC_500KBPS,2,0x54,1,0,FL_MFM }, /* 1.2M */
-{ 9,2,0xFF,0x23,40, 720,FDC_300KBPS,2,0x50,1,0,FL_MFM|FL_2STEP }, /* 360K */
-{ 9,2,0xFF,0x20,80,1440,FDC_300KBPS,2,0x50,1,0,FL_MFM }, /* 720K */
+ { FDF_5_1200 | FL_AUTO },
+ { FDF_5_360 | FL_2STEP | FL_AUTO},
+ { 0 }
+};
+
+static struct fd_type fd_searchlist_720k[] = {
+ { FDF_3_720 },
+ { 0 }
};
static struct fd_type fd_searchlist_144m[] = {
-{ 18,2,0xFF,0x1B,80,2880,FDC_500KBPS,2,0x6C,1,0,FL_MFM }, /* 1.44M */
-{ 9,2,0xFF,0x20,80,1440,FDC_250KBPS,2,0x50,1,0,FL_MFM }, /* 720K */
+ { FDF_3_1440 | FL_AUTO},
+ { FDF_3_720 | FL_AUTO},
+ { 0 }
};
-/* We search for 1.44M first since this is the most common case. */
static struct fd_type fd_searchlist_288m[] = {
-{ 18,2,0xFF,0x1B,80,2880,FDC_500KBPS,2,0x6C,1,0,FL_MFM }, /* 1.44M */
+ { FDF_3_1440 | FL_AUTO },
#if 0
-{ 36,2,0xFF,0x1B,80,5760,FDC_1MBPS, 2,0x4C,1,1,FL_MFM|FL_PERPND } /* 2.88M */
+ { FDF_3_2880 | FL_AUTO }, /* XXX: probably doesn't work */
#endif
-{ 9,2,0xFF,0x20,80,1440,FDC_250KBPS,2,0x50,1,0,FL_MFM }, /* 720K */
+ { FDF_3_720 | FL_AUTO},
+ { 0 }
+};
+
+/*
+ * Order must match enum fd_drivetype in <sys/fdcio.h>.
+ */
+static struct fd_type *fd_native_types[] = {
+ NULL, /* FDT_NONE */
+ fd_searchlist_360k, /* FDT_360K */
+ fd_searchlist_12m, /* FDT_12M */
+ fd_searchlist_720k, /* FDT_720K */
+ fd_searchlist_144m, /* FDT_144M */
+ fd_searchlist_288m, /* FDT_288M */
};
-#define MAX_SEC_SIZE (128 << 3)
-#define MAX_CYLINDER 85 /* some people really stress their drives
- * up to cyl 82 */
-#define MAX_HEAD 1
+/*
+ * Internals start here
+ */
+
+/* registers */
+#define FDOUT 2 /* Digital Output Register (W) */
+#define FDO_FDSEL 0x03 /* floppy device select */
+#define FDO_FRST 0x04 /* floppy controller reset */
+#define FDO_FDMAEN 0x08 /* enable floppy DMA and Interrupt */
+#define FDO_MOEN0 0x10 /* motor enable drive 0 */
+#define FDO_MOEN1 0x20 /* motor enable drive 1 */
+#define FDO_MOEN2 0x40 /* motor enable drive 2 */
+#define FDO_MOEN3 0x80 /* motor enable drive 3 */
+
+#define FDSTS 4 /* NEC 765 Main Status Register (R) */
+#define FDDATA 5 /* NEC 765 Data Register (R/W) */
+#define FDCTL 7 /* Control Register (W) */
+
+/*
+ * this is the secret PIO data port (offset from base)
+ */
+#define FDC_YE_DATAPORT 6
+
+#define FDI_DCHG 0x80 /* diskette has been changed */
+ /* requires drive and motor being selected */
+ /* is cleared by any step pulse to drive */
-devclass_t fdc_devclass;
+/*
+ * We have two private BIO commands for formatting and sector-id reading
+ */
+#define BIO_PROBE BIO_CMD0
+#define BIO_RDID BIO_CMD1
+#define BIO_FMT BIO_CMD2
/*
* Per drive structure (softc).
*/
struct fd_data {
+ u_char *fd_ioptr; /* IO pointer */
+ u_int fd_iosize; /* Size of IO chunks */
+ u_int fd_iocount; /* Outstanding requests */
struct fdc_data *fdc; /* pointer to controller structure */
int fdsu; /* this units number on this controller */
enum fd_drivetype type; /* drive type */
struct fd_type *ft; /* pointer to current type descriptor */
- struct fd_type fts[NUMDENS]; /* type descriptors */
+ struct fd_type fts; /* type descriptors */
+ int sectorsize;
int flags;
-#define FD_OPEN 0x01 /* it's open */
-#define FD_NONBLOCK 0x02 /* O_NONBLOCK set */
-#define FD_ACTIVE 0x04 /* it's active */
-#define FD_MOTOR 0x08 /* motor should be on */
-#define FD_MOTOR_WAIT 0x10 /* motor coming up */
-#define FD_UA 0x20 /* force unit attention */
- int skip;
- int hddrv;
-#define FD_NO_TRACK -2
+#define FD_WP (1<<0) /* Write protected */
+#define FD_MOTOR (1<<1) /* motor should be on */
+#define FD_MOTORWAIT (1<<2) /* motor should be on */
+#define FD_EMPTY (1<<3) /* no media */
+#define FD_NEWDISK (1<<4) /* media changed */
+#define FD_ISADMA (1<<5) /* isa dma started */
int track; /* where we think the head is */
- int options; /* user configurable options, see fdcio.h */
- struct callout_handle toffhandle;
- struct callout_handle tohandle;
- struct devstat *device_stats;
- struct cdev *masterdev;
+#define FD_NO_TRACK -2
+ int options; /* FDOPT_* */
+ struct callout toffhandle;
+ struct callout tohandle;
+ struct g_geom *fd_geom;
+ struct g_provider *fd_provider;
device_t dev;
- fdu_t fdu;
+ struct bio_queue_head fd_bq;
};
-struct fdc_ivars {
- int fdunit;
- int fdtype;
-};
+#define FD_NOT_VALID -2
+
+static driver_intr_t fdc_intr;
+static void fdc_reset(struct fdc_data *);
+
+SYSCTL_NODE(_debug, OID_AUTO, fdc, CTLFLAG_RW, 0, "fdc driver");
+
+static int fifo_threshold = 8;
+SYSCTL_INT(_debug_fdc, OID_AUTO, fifo, CTLFLAG_RW, &fifo_threshold, 0,
+ "FIFO threshold setting");
+
+static int debugflags = 0;
+SYSCTL_INT(_debug_fdc, OID_AUTO, debugflags, CTLFLAG_RW, &debugflags, 0,
+ "Debug flags");
+
+static int retries = 10;
+SYSCTL_INT(_debug_fdc, OID_AUTO, retries, CTLFLAG_RW, &retries, 0,
+ "Number of retries to attempt");
-static devclass_t fd_devclass;
+static int spec1 = 0xaf;
+SYSCTL_INT(_debug_fdc, OID_AUTO, spec1, CTLFLAG_RW, &spec1, 0,
+ "Specification byte one (step-rate + head unload)");
-/* configuration flags for fd */
-#define FD_TYPEMASK 0x0f /* drive type, matches enum
- * fd_drivetype; on i386 machines, if
- * given as 0, use RTC type for fd0
- * and fd1 */
-#define FD_DTYPE(flags) ((flags) & FD_TYPEMASK)
-#define FD_NO_CHLINE 0x10 /* drive does not support changeline
- * aka. unit attention */
-#define FD_NO_PROBE 0x20 /* don't probe drive (seek test), just
- * assume it is there */
+static int spec2 = 0x10;
+SYSCTL_INT(_debug_fdc, OID_AUTO, spec2, CTLFLAG_RW, &spec2, 0,
+ "Specification byte two (head load time + no-dma)");
-/*
- * Throughout this file the following conventions will be used:
- *
- * fd is a pointer to the fd_data struct for the drive in question
- * fdc is a pointer to the fdc_data struct for the controller
- * fdu is the floppy drive unit number
- * fdcu is the floppy controller unit number
- * fdsu is the floppy drive unit number on that controller. (sub-unit)
- */
+static int settle;
+SYSCTL_INT(_debug_fdc, OID_AUTO, settle, CTLFLAG_RW, &settle, 0,
+ "Head settling time in sec/hz");
-/*
- * Function declarations, same (chaotic) order as they appear in the
- * file. Re-ordering is too late now, it would only obfuscate the
- * diffs against old and offspring versions (like the PC98 one).
- *
- * Anyone adding functions here, please keep this sequence the same
- * as below -- makes locating a particular function in the body much
- * easier.
- */
-static u_int8_t fdsts_rd(fdc_p);
-static void fddata_wr(fdc_p, u_int8_t);
-static u_int8_t fddata_rd(fdc_p);
-#if 0
-static u_int8_t fdin_rd(fdc_p);
-#endif
-static int fdc_err(struct fdc_data *, const char *);
-static int enable_fifo(fdc_p fdc);
-static int fd_sense_drive_status(fdc_p, int *);
-static int fd_sense_int(fdc_p, int *, int *);
-static int fd_read_status(fdc_p);
-static int fd_probe(device_t);
-static int fd_attach(device_t);
-static int fd_detach(device_t);
-static void set_motor(struct fdc_data *, int, int);
-# define TURNON 1
-# define TURNOFF 0
-static timeout_t fd_turnoff;
-static timeout_t fd_motor_on;
-static void fd_turnon(struct fd_data *);
-static void fdc_reset(fdc_p);
-static int fd_in(struct fdc_data *, int *);
-static int out_fdc(struct fdc_data *, int);
-static d_open_t fdopen;
-static d_close_t fdclose;
-static d_strategy_t fdstrategy;
-static void fdstart(struct fdc_data *);
-static timeout_t fd_iotimeout;
-static timeout_t fd_pseudointr;
-static driver_intr_t fdc_intr;
-static int fdcpio(fdc_p, long, caddr_t, u_int);
-static int fdautoselect(struct cdev *);
-static int fdstate(struct fdc_data *);
-static int retrier(struct fdc_data *);
-static void fdbiodone(struct bio *);
-static int fdmisccmd(struct cdev *, u_int, void *);
-static d_ioctl_t fdioctl;
+static void
+fdprinttype(struct fd_type *ft)
+{
-static int fifo_threshold = 8; /* XXX: should be accessible via sysctl */
+ printf("(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,0x%x)",
+ ft->sectrac, ft->secsize, ft->datalen, ft->gap, ft->tracks,
+ ft->size, ft->trans, ft->heads, ft->f_gap, ft->f_inter,
+ ft->offset_side2, ft->flags);
+}
-#ifdef FDC_DEBUG
-/* CAUTION: fd_debug causes huge amounts of logging output */
-static int volatile fd_debug = 0;
-#define TRACE0(arg) do { if (fd_debug) printf(arg); } while (0)
-#define TRACE1(arg1, arg2) do { if (fd_debug) printf(arg1, arg2); } while (0)
-#else /* FDC_DEBUG */
-#define TRACE0(arg) do { } while (0)
-#define TRACE1(arg1, arg2) do { } while (0)
-#endif /* FDC_DEBUG */
+static void
+fdsettype(struct fd_data *fd, struct fd_type *ft)
+{
+ fd->ft = ft;
+ ft->size = ft->sectrac * ft->heads * ft->tracks;
+ fd->sectorsize = 128 << fd->ft->secsize;
+}
/*
* Bus space handling (access to low-level IO).
*/
-void
-fdout_wr(fdc_p fdc, u_int8_t v)
+static void
+fdctl_wr(struct fdc_data *fdc, u_int8_t v)
+{
+
+ bus_space_write_1(fdc->ctlt, fdc->ctlh, fdc->ctl_off, v);
+}
+
+static void
+fdout_wr(struct fdc_data *fdc, u_int8_t v)
{
+
bus_space_write_1(fdc->portt, fdc->porth, FDOUT+fdc->port_off, v);
}
static u_int8_t
-fdsts_rd(fdc_p fdc)
+fdsts_rd(struct fdc_data *fdc)
{
+
return bus_space_read_1(fdc->portt, fdc->porth, FDSTS+fdc->port_off);
}
static void
-fddata_wr(fdc_p fdc, u_int8_t v)
+fddata_wr(struct fdc_data *fdc, u_int8_t v)
{
+
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list