From owner-p4-projects@FreeBSD.ORG Mon Jun 16 06:04:47 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 311BD1065673; Mon, 16 Jun 2008 06:04:47 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CEAC61065678 for ; Mon, 16 Jun 2008 06:04:46 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id BC8178FC19 for ; Mon, 16 Jun 2008 06:04:46 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m5G64k3T062215 for ; Mon, 16 Jun 2008 06:04:46 GMT (envelope-from jb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m5G64krI062213 for perforce@freebsd.org; Mon, 16 Jun 2008 06:04:46 GMT (envelope-from jb@freebsd.org) Date: Mon, 16 Jun 2008 06:04:46 GMT Message-Id: <200806160604.m5G64krI062213@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jb@freebsd.org using -f From: John Birrell To: Perforce Change Reviews Cc: Subject: PERFORCE change 143568 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jun 2008 06:04:47 -0000 http://perforce.freebsd.org/chv.cgi?CH=143568 Change 143568 by jb@freebsd3 on 2008/06/16 06:03:49 IF7 Affected files ... .. //depot/projects/dtrace7/src/sbin/geom/class/part/geom_part.c#2 integrate .. //depot/projects/dtrace7/src/sbin/geom/class/part/gpart.8#2 integrate .. //depot/projects/dtrace7/src/sbin/geom/misc/subr.c#2 integrate .. //depot/projects/dtrace7/src/sbin/geom/misc/subr.h#2 integrate .. //depot/projects/dtrace7/src/share/man/man4/ciss.4#3 integrate .. //depot/projects/dtrace7/src/share/sendmail/Makefile#2 integrate .. //depot/projects/dtrace7/src/sys/dev/ciss/ciss.c#4 integrate .. //depot/projects/dtrace7/src/sys/dev/gem/if_gem.c#3 integrate .. //depot/projects/dtrace7/src/sys/dev/gem/if_gem_pci.c#3 integrate .. //depot/projects/dtrace7/src/sys/dev/gem/if_gemreg.h#3 integrate .. //depot/projects/dtrace7/src/sys/dev/gem/if_gemvar.h#3 integrate .. //depot/projects/dtrace7/src/sys/dev/hme/if_hme.c#2 integrate .. //depot/projects/dtrace7/src/sys/dev/hme/if_hme_pci.c#2 integrate .. //depot/projects/dtrace7/src/sys/dev/hme/if_hme_sbus.c#2 integrate .. //depot/projects/dtrace7/src/sys/dev/hme/if_hmereg.h#2 integrate .. //depot/projects/dtrace7/src/sys/dev/hme/if_hmevar.h#2 integrate .. //depot/projects/dtrace7/src/sys/dev/mfi/mfi.c#4 integrate .. //depot/projects/dtrace7/src/sys/dev/mfi/mfi_ioctl.h#2 integrate .. //depot/projects/dtrace7/src/sys/dev/mfi/mfi_pci.c#2 integrate .. //depot/projects/dtrace7/src/sys/dev/usb/ums.c#4 integrate .. //depot/projects/dtrace7/src/sys/dev/usb/usbdevs#8 integrate .. //depot/projects/dtrace7/src/sys/geom/geom.h#2 integrate .. //depot/projects/dtrace7/src/sys/geom/geom_subr.c#2 integrate .. //depot/projects/dtrace7/src/sys/geom/part/g_part.c#4 integrate .. //depot/projects/dtrace7/src/sys/geom/part/g_part.h#4 integrate .. //depot/projects/dtrace7/src/sys/geom/part/g_part_apm.c#2 integrate .. //depot/projects/dtrace7/src/sys/geom/part/g_part_bsd.c#2 integrate .. //depot/projects/dtrace7/src/sys/geom/part/g_part_gpt.c#3 integrate .. //depot/projects/dtrace7/src/sys/geom/part/g_part_if.m#2 integrate .. //depot/projects/dtrace7/src/sys/geom/part/g_part_mbr.c#3 integrate .. //depot/projects/dtrace7/src/sys/geom/part/g_part_pc98.c#1 branch .. //depot/projects/dtrace7/src/sys/geom/part/g_part_vtoc8.c#2 integrate .. //depot/projects/dtrace7/src/sys/modules/geom/Makefile#4 integrate .. //depot/projects/dtrace7/src/sys/modules/geom/geom_part/Makefile#1 branch .. //depot/projects/dtrace7/src/sys/modules/geom/geom_part/geom_part_apm/Makefile#1 branch .. //depot/projects/dtrace7/src/sys/modules/geom/geom_part/geom_part_bsd/Makefile#1 branch .. //depot/projects/dtrace7/src/sys/modules/geom/geom_part/geom_part_gpt/Makefile#1 branch .. //depot/projects/dtrace7/src/sys/modules/geom/geom_part/geom_part_mbr/Makefile#1 branch .. //depot/projects/dtrace7/src/sys/modules/geom/geom_part/geom_part_pc98/Makefile#1 branch .. //depot/projects/dtrace7/src/sys/modules/geom/geom_part/geom_part_vtoc8/Makefile#1 branch .. //depot/projects/dtrace7/src/sys/nlm/nlm_prot_impl.c#5 integrate .. //depot/projects/dtrace7/src/usr.bin/shar/shar.sh#2 integrate .. //depot/projects/dtrace7/src/usr.bin/tar/matching.c#2 integrate .. //depot/projects/dtrace7/src/usr.sbin/pkg_install/add/main.c#4 integrate .. //depot/projects/dtrace7/src/usr.sbin/pkg_install/add/pkg_add.1#4 integrate .. //depot/projects/dtrace7/src/usr.sbin/pkg_install/create/create.h#2 integrate .. //depot/projects/dtrace7/src/usr.sbin/pkg_install/create/main.c#3 integrate .. //depot/projects/dtrace7/src/usr.sbin/pkg_install/create/perform.c#2 integrate .. //depot/projects/dtrace7/src/usr.sbin/pkg_install/create/pkg_create.1#3 integrate .. //depot/projects/dtrace7/src/usr.sbin/pkg_install/delete/main.c#3 integrate .. //depot/projects/dtrace7/src/usr.sbin/pkg_install/delete/pkg_delete.1#3 integrate .. //depot/projects/dtrace7/src/usr.sbin/pkg_install/info/main.c#4 integrate .. //depot/projects/dtrace7/src/usr.sbin/pkg_install/info/pkg_info.1#3 integrate .. //depot/projects/dtrace7/src/usr.sbin/pkg_install/lib/lib.h#4 integrate .. //depot/projects/dtrace7/src/usr.sbin/pkg_install/updating/main.c#2 integrate .. //depot/projects/dtrace7/src/usr.sbin/pkg_install/updating/pkg_updating.1#2 integrate .. //depot/projects/dtrace7/src/usr.sbin/pkg_install/version/main.c#3 integrate .. //depot/projects/dtrace7/src/usr.sbin/pkg_install/version/pkg_version.1#4 integrate .. //depot/projects/dtrace7/src/usr.sbin/rpc.lockd/lockd.c#4 integrate .. //depot/projects/dtrace7/src/usr.sbin/tzsetup/tzsetup.c#2 integrate Differences ... ==== //depot/projects/dtrace7/src/sbin/geom/class/part/geom_part.c#2 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sbin/geom/class/part/geom_part.c,v 1.1.2.1 2007/10/29 06:18:03 marcel Exp $"); +__FBSDID("$FreeBSD: src/sbin/geom/class/part/geom_part.c,v 1.1.2.2 2008/06/10 03:19:33 marcel Exp $"); #include #include @@ -39,28 +39,48 @@ #include #include #include +#include #include "core/geom.h" #include "misc/subr.h" -uint32_t lib_version = G_LIB_VERSION; -uint32_t version = 0; +#ifdef STATIC_GEOM_CLASSES +#define PUBSYM(x) gpart_##x +#else +#define PUBSYM(x) x +#endif + +uint32_t PUBSYM(lib_version) = G_LIB_VERSION; +uint32_t PUBSYM(version) = 0; static char optional[] = ""; static char flags[] = "C"; -static void gpart_show(struct gctl_req *, unsigned); +static char bootcode_param[] = "bootcode"; +static char index_param[] = "index"; +static char partcode_param[] = "partcode"; + +static void gpart_bootcode(struct gctl_req *, unsigned int); +static void gpart_show(struct gctl_req *, unsigned int); -struct g_command class_commands[] = { +struct g_command PUBSYM(class_commands)[] = { { "add", 0, NULL, { { 'b', "start", NULL, G_TYPE_STRING }, { 's', "size", NULL, G_TYPE_STRING }, { 't', "type", NULL, G_TYPE_STRING }, - { 'i', "index", optional, G_TYPE_STRING }, + { 'i', index_param, optional, G_TYPE_STRING }, { 'l', "label", optional, G_TYPE_STRING }, { 'f', "flags", flags, G_TYPE_STRING }, G_OPT_SENTINEL }, - "geom", NULL, + "geom", NULL + }, + { "bootcode", 0, gpart_bootcode, { + { 'b', bootcode_param, optional, G_TYPE_STRING }, + { 'p', partcode_param, optional, G_TYPE_STRING }, + { 'i', index_param, optional, G_TYPE_STRING }, + { 'f', "flags", flags, G_TYPE_STRING }, + G_OPT_SENTINEL }, + "geom", NULL }, { "commit", 0, NULL, G_NULL_OPTS, "geom", NULL }, { "create", 0, NULL, { @@ -71,7 +91,7 @@ "provider", NULL }, { "delete", 0, NULL, { - { 'i', "index", NULL, G_TYPE_STRING }, + { 'i', index_param, NULL, G_TYPE_STRING }, { 'f', "flags", flags, G_TYPE_STRING }, G_OPT_SENTINEL }, "geom", NULL @@ -81,7 +101,7 @@ G_OPT_SENTINEL }, "geom", NULL }, { "modify", 0, NULL, { - { 'i', "index", NULL, G_TYPE_STRING }, + { 'i', index_param, NULL, G_TYPE_STRING }, { 'l', "label", optional, G_TYPE_STRING }, { 't', "type", optional, G_TYPE_STRING }, { 'f', "flags", flags, G_TYPE_STRING }, @@ -235,7 +255,7 @@ } static void -gpart_show(struct gctl_req *req, unsigned fl __unused) +gpart_show(struct gctl_req *req, unsigned int fl __unused) { struct gmesh mesh; struct gclass *classp; @@ -271,3 +291,151 @@ } geom_deletetree(&mesh); } + +static void * +gpart_bootfile_read(const char *bootfile, ssize_t *size) +{ + struct stat sb; + void *code; + int fd; + + if (stat(bootfile, &sb) == -1) + err(EXIT_FAILURE, "%s", bootfile); + if (!S_ISREG(sb.st_mode)) + errx(EXIT_FAILURE, "%s: not a regular file", bootfile); + if (sb.st_size == 0) + errx(EXIT_FAILURE, "%s: empty file", bootfile); + if (*size > 0 && sb.st_size >= *size) + errx(EXIT_FAILURE, "%s: file too big (%zu limit)", bootfile, + *size); + + *size = sb.st_size; + + fd = open(bootfile, O_RDONLY); + if (fd == -1) + err(EXIT_FAILURE, "%s", bootfile); + code = malloc(*size); + if (code == NULL) + err(EXIT_FAILURE, NULL); + if (read(fd, code, *size) != *size) + err(EXIT_FAILURE, "%s", bootfile); + close(fd); + + return (code); +} + +static void +gpart_write_partcode(struct gctl_req *req, int idx, void *code, ssize_t size) +{ + char dsf[128]; + struct gmesh mesh; + struct gclass *classp; + struct ggeom *gp; + struct gprovider *pp; + const char *s; + int error, fd; + + s = gctl_get_ascii(req, "class"); + if (s == NULL) + abort(); + error = geom_gettree(&mesh); + if (error != 0) + errc(EXIT_FAILURE, error, "Cannot get GEOM tree"); + classp = find_class(&mesh, s); + if (classp == NULL) { + geom_deletetree(&mesh); + errx(EXIT_FAILURE, "Class %s not found.", s); + } + s = gctl_get_ascii(req, "geom"); + gp = find_geom(classp, s); + if (gp == NULL) + errx(EXIT_FAILURE, "No such geom: %s.", s); + + LIST_FOREACH(pp, &gp->lg_provider, lg_provider) { + s = find_provcfg(pp, "index"); + if (s == NULL) + continue; + if (atoi(s) == idx) + break; + } + + if (pp != NULL) { + snprintf(dsf, sizeof(dsf), "/dev/%s", pp->lg_name); + fd = open(dsf, O_WRONLY); + if (fd == -1) + err(EXIT_FAILURE, "%s", dsf); + if (lseek(fd, size, SEEK_SET) != size) + errx(EXIT_FAILURE, "%s: not enough space", dsf); + if (lseek(fd, 0, SEEK_SET) != 0) + err(EXIT_FAILURE, "%s", dsf); + if (write(fd, code, size) != size) + err(EXIT_FAILURE, "%s", dsf); + close(fd); + } else + errx(EXIT_FAILURE, "invalid partition index"); + + geom_deletetree(&mesh); +} + +static void +gpart_bootcode(struct gctl_req *req, unsigned int fl __unused) +{ + const char *s; + char *sp; + void *bootcode, *partcode; + size_t bootsize, partsize; + int error, idx; + + if (gctl_has_param(req, bootcode_param)) { + s = gctl_get_ascii(req, bootcode_param); + bootsize = 64 * 1024; /* Arbitrary limit. */ + bootcode = gpart_bootfile_read(s, &bootsize); + error = gctl_change_param(req, bootcode_param, bootsize, + bootcode); + if (error) + errc(EXIT_FAILURE, error, "internal error"); + } else { + bootcode = NULL; + bootsize = 0; + } + + if (gctl_has_param(req, partcode_param)) { + s = gctl_get_ascii(req, partcode_param); + partsize = bootsize * 1024; + partcode = gpart_bootfile_read(s, &partsize); + error = gctl_delete_param(req, partcode_param); + if (error) + errc(EXIT_FAILURE, error, "internal error"); + } else { + partcode = NULL; + partsize = 0; + } + + if (gctl_has_param(req, index_param)) { + if (partcode == NULL) + errx(EXIT_FAILURE, "-i is only valid with -p"); + s = gctl_get_ascii(req, index_param); + idx = strtol(s, &sp, 10); + if (idx < 1 || *s == '\0' || *sp != '\0') + errx(EXIT_FAILURE, "invalid partition index"); + error = gctl_delete_param(req, index_param); + if (error) + errc(EXIT_FAILURE, error, "internal error"); + } else + idx = 0; + + if (partcode != NULL) { + if (idx == 0) + errx(EXIT_FAILURE, "missing -i option"); + gpart_write_partcode(req, idx, partcode, partsize); + } else { + if (bootcode == NULL) + errx(EXIT_FAILURE, "no -b nor -p"); + } + + if (bootcode != NULL) { + s = gctl_issue(req); + if (s != NULL) + errx(EXIT_FAILURE, "%s", s); + } +} ==== //depot/projects/dtrace7/src/sbin/geom/class/part/gpart.8#2 (text+ko) ==== @@ -1,4 +1,4 @@ -.\" Copyright (c) 2007 Marcel Moolenaar +.\" Copyright (c) 2007, 2008 Marcel Moolenaar .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -22,9 +22,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/sbin/geom/class/part/gpart.8,v 1.1.2.1 2007/10/29 06:18:03 marcel Exp $ +.\" $FreeBSD: src/sbin/geom/class/part/gpart.8,v 1.1.2.2 2008/06/10 03:19:33 marcel Exp $ .\" -.Dd Oct 20, 2007 +.Dd Jun 6, 2008 .Dt GPART 8 .Os .Sh NAME @@ -36,16 +36,24 @@ lines in your kernel configuration file: .Bd -ragged -offset indent .Cd "options GEOM_PART_APM" +.Cd "options GEOM_PART_BSD" .Cd "options GEOM_PART_GPT" .Cd "options GEOM_PART_MBR" +.Cd "options GEOM_PART_PC98" +.Cd "options GEOM_PART_VTOC8" .Ed .Pp The GEOM_PART_APM option adds support for the Apple Partition Map (APM) found on Apple Macintosh computers. +The GEOM_PART_BSD option adds support for the traditional BSD disklabel. The GEOM_PART_GPT option adds support for the GUID Partition Table (GPT) found on Intel Itanium computers and Intel-based Macintosh computers. The GEOM_PART_MBR option adds support for the Master Boot Record (MBR) found on PCs and used on many removable media. +The GEOM_PART_PC98 option adds support for the MBR variant as used on +NEC PC-98 computers. +The GEOM_PART_VTOC8 option adds support for Sun's SMI VTOC8 label as +found on UltraSPARC-based computers. .Pp Usage of the .Xr gpart 8 @@ -61,6 +69,13 @@ .Op Fl l Ar label .Op Fl f Ar flags .Ar geom +.\" ==== BOOTCODE ==== +.Nm +.Cm bootcode +.Op Fl b Ar bootcode +.Op Fl p Ar partcode Fl i Ar index +.Op Fl f Ar flags +.Ar geom .\" ==== COMMIT ==== .Nm .Cm commit @@ -122,7 +137,7 @@ Partition types are discussed in the section entitled "Partition Types". .Pp Addition options include: -.Bl -tag -width ".Fl w Ar wwwwwww" +.Bl -tag -width ".Fl w Ar wwwwwwww" .It Fl i Ar index The index in the partition table at which the new partition is to be placed. The index determines the name of the device special file used @@ -136,6 +151,36 @@ See the section entitled "Operational flags" below for a discussion about its use. .El +.\" ==== BOOTCODE ==== +.It Cm bootcode +Embed bootstrap code into the partitioning scheme's metadata on the +.Ar geom +(using +.Fl b Ar bootcode ) +or write bootstrap code into a partition (using +.Fl p Ar partcode +and +.Fl i Ar index ) . +Not all partitioning schemes have embedded bootstrap code, so the +.Fl b Ar bootcode +option is scheme-specific in nature. +For the GPT scheme, embedded bootstrap code is supported. +The bootstrap code is embedded in the protective MBR rather than the GPT. +The +.Fl b Ar bootcode +option specifies a file that contains the bootstrap code. +The contents and size of the file are determined by the partitioning +scheme. +For the MBR scheme, it's a 512 byte file of which the first 446 bytes +are installed as bootstrap code. +The +.Fl p Ar partcode +option specifies a file that contains the bootstrap code intended to be +written to a partition. +The partition is specified by the +.Fl i Ar index +option. +The size of the file must be smaller than the size of the partition. .\" ==== COMMIT ==== .It Cm commit Commit any pending changes for geom ==== //depot/projects/dtrace7/src/sbin/geom/misc/subr.c#2 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sbin/geom/misc/subr.c,v 1.7 2007/01/25 11:35:27 pjd Exp $"); +__FBSDID("$FreeBSD: src/sbin/geom/misc/subr.c,v 1.7.2.1 2008/06/10 03:02:51 marcel Exp $"); #include #include @@ -414,3 +414,47 @@ } return (ENOENT); } + +int +gctl_delete_param(struct gctl_req *req, const char *name) +{ + struct gctl_req_arg *ap; + unsigned int i; + + if (req == NULL || req->error != NULL) + return (EDOOFUS); + + i = 0; + while (i < req->narg) { + ap = &req->arg[i]; + if (strcmp(ap->name, name) == 0) + break; + i++; + } + if (i == req->narg) + return (ENOENT); + + req->narg--; + while (i < req->narg) { + req->arg[i] = req->arg[i + 1]; + i++; + } + return (0); +} + +int +gctl_has_param(struct gctl_req *req, const char *name) +{ + struct gctl_req_arg *ap; + unsigned int i; + + if (req == NULL || req->error != NULL) + return (0); + + for (i = 0; i < req->narg; i++) { + ap = &req->arg[i]; + if (strcmp(ap->name, name) == 0) + return (1); + } + return (0); +} ==== //depot/projects/dtrace7/src/sbin/geom/misc/subr.h#2 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sbin/geom/misc/subr.h,v 1.8 2007/01/25 11:35:27 pjd Exp $ + * $FreeBSD: src/sbin/geom/misc/subr.h,v 1.8.2.1 2008/06/10 03:02:51 marcel Exp $ */ #ifndef _SUBR_H_ @@ -47,4 +47,7 @@ const char *gctl_get_ascii(struct gctl_req *req, const char *pfmt, ...) __printflike(2, 3); int gctl_change_param(struct gctl_req *req, const char *name, int len, const void *value); +int gctl_delete_param(struct gctl_req *req, const char *name); +int gctl_has_param(struct gctl_req *req, const char *name); + #endif /* !_SUBR_H_ */ ==== //depot/projects/dtrace7/src/share/man/man4/ciss.4#3 (text+ko) ==== @@ -1,4 +1,4 @@ -.\" $FreeBSD: src/share/man/man4/ciss.4,v 1.14.2.1 2008/02/14 17:01:32 iwasaki Exp $ +.\" $FreeBSD: src/share/man/man4/ciss.4,v 1.14.2.2 2008/06/10 18:11:14 ps Exp $ .\" Written by Tom Rhodes .\" This file is in the public domain. .\" @@ -119,14 +119,24 @@ .It HP Smart Array E200i .It +HP Smart Array P212 +.It HP Smart Array P400 .It HP Smart Array P400i .It +HP Smart Array P410 +.It +HP Smart Array P410i +.It +HP Smart Array P411 +.It HP Smart Array P600 .It HP Smart Array P800 .It +HP Smart Array P812 +.It HP Modular Smart Array 20 (MSA20) .It HP Modular Smart Array 500 (MSA500) ==== //depot/projects/dtrace7/src/share/sendmail/Makefile#2 (text+ko) ==== @@ -1,11 +1,11 @@ -# $FreeBSD: src/share/sendmail/Makefile,v 1.10 2004/12/21 08:46:54 ru Exp $ +# $FreeBSD: src/share/sendmail/Makefile,v 1.10.10.1 2008/06/15 20:12:11 remko Exp $ # # Doing a make install builds /usr/share/sendmail/ SENDMAIL_DIR=${.CURDIR}/../../contrib/sendmail CFDIR= cf -CFDIRS!= (cd ${SENDMAIL_DIR}; find -L ${CFDIR} \( -name CVS -prune \) -o -type d -print) -CFFILES!= (cd ${SENDMAIL_DIR}; find -L ${CFDIR} \( -name CVS -prune \) -o -type f -print) +CFDIRS!= (cd ${SENDMAIL_DIR}; find -L ${CFDIR} \( \( -name CVS -o -name .svn \) -prune \) -o -type d -print) +CFFILES!= (cd ${SENDMAIL_DIR}; find -L ${CFDIR} \( \( -name CVS -o -name .svn \) -prune \) -o -type f -print) DDIR= ${DESTDIR}/usr/share/sendmail ==== //depot/projects/dtrace7/src/sys/dev/ciss/ciss.c#4 (text+ko) ==== @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/ciss/ciss.c,v 1.81.2.4 2008/05/16 08:28:47 ps Exp $ + * $FreeBSD: src/sys/dev/ciss/ciss.c,v 1.81.2.5 2008/06/10 18:11:14 ps Exp $ */ /* @@ -298,6 +298,11 @@ { 0x103C, 0x323A, CISS_BOARD_SA5, "HP Smart Array" }, { 0x103C, 0x323B, CISS_BOARD_SA5, "HP Smart Array" }, { 0x103C, 0x323C, CISS_BOARD_SA5, "HP Smart Array" }, + { 0x103C, 0x3241, CISS_BOARD_SA5, "HP Smart Array P212" }, + { 0x103C, 0x3243, CISS_BOARD_SA5, "HP Smart Array P410" }, + { 0x103C, 0x3245, CISS_BOARD_SA5, "HP Smart Array P410i" }, + { 0x103C, 0x3247, CISS_BOARD_SA5, "HP Smart Array P411" }, + { 0x103C, 0x3249, CISS_BOARD_SA5, "HP Smart Array P812" }, { 0, 0, 0, NULL } }; ==== //depot/projects/dtrace7/src/sys/dev/gem/if_gem.c#3 (text+ko) ==== @@ -29,7 +29,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/gem/if_gem.c,v 1.44.2.3 2008/03/18 00:42:25 yongari Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/gem/if_gem.c,v 1.44.2.4 2008/06/11 21:10:06 marius Exp $"); /* * Driver for Apple GMAC, Sun ERI and Sun GEM Ethernet controllers @@ -96,8 +96,8 @@ #define GEM_CSUM_FEATURES (CSUM_TCP) static int gem_add_rxbuf(struct gem_softc *sc, int idx); -static int gem_bitwait(struct gem_softc *sc, bus_addr_t r, uint32_t clr, - uint32_t set); +static int gem_bitwait(struct gem_softc *sc, u_int bank, bus_addr_t r, + uint32_t clr, uint32_t set); static void gem_cddma_callback(void *xsc, bus_dma_segment_t *segs, int nsegs, int error); static int gem_disable_rx(struct gem_softc *sc); @@ -140,6 +140,11 @@ #define KTR_GEM KTR_CT2 #endif +#define GEM_BANK1_BITWAIT(sc, r, clr, set) \ + gem_bitwait((sc), GEM_RES_BANK1, (r), (clr), (set)) +#define GEM_BANK2_BITWAIT(sc, r, clr, set) \ + gem_bitwait((sc), GEM_RES_BANK2, (r), (clr), (set)) + int gem_attach(struct gem_softc *sc) { @@ -252,7 +257,7 @@ /* Bad things will happen when touching this register on ERI. */ if (sc->sc_variant != GEM_SUN_ERI) - bus_write_4(sc->sc_res[0], GEM_MII_DATAPATH_MODE, + GEM_BANK1_WRITE_4(sc, GEM_MII_DATAPATH_MODE, GEM_MII_DATAPATH_MII); gem_mifinit(sc); @@ -261,10 +266,10 @@ * Look for an external PHY. */ error = ENXIO; - v = bus_read_4(sc->sc_res[0], GEM_MIF_CONFIG); + v = GEM_BANK1_READ_4(sc, GEM_MIF_CONFIG); if ((v & GEM_MIF_CONFIG_MDI1) != 0) { v |= GEM_MIF_CONFIG_PHY_SEL; - bus_write_4(sc->sc_res[0], GEM_MIF_CONFIG, v); + GEM_BANK1_WRITE_4(sc, GEM_MIF_CONFIG, v); switch (sc->sc_variant) { case GEM_SUN_ERI: sc->sc_phyad = GEM_PHYAD_EXTERNAL; @@ -282,7 +287,7 @@ */ if (error != 0 && (v & GEM_MIF_CONFIG_MDI0) != 0) { v &= ~GEM_MIF_CONFIG_PHY_SEL; - bus_write_4(sc->sc_res[0], GEM_MIF_CONFIG, v); + GEM_BANK1_WRITE_4(sc, GEM_MIF_CONFIG, v); switch (sc->sc_variant) { case GEM_SUN_ERI: case GEM_APPLE_K2_GMAC: @@ -303,12 +308,11 @@ * Try the external PCS SERDES if we didn't find any PHYs. */ if (error != 0 && sc->sc_variant == GEM_SUN_GEM) { - bus_write_4(sc->sc_res[0], GEM_MII_DATAPATH_MODE, + GEM_BANK1_WRITE_4(sc, GEM_MII_DATAPATH_MODE, GEM_MII_DATAPATH_SERDES); - bus_write_4(sc->sc_res[0], GEM_MII_SLINK_CONTROL, + GEM_BANK1_WRITE_4(sc, GEM_MII_SLINK_CONTROL, GEM_MII_SLINK_LOOPBACK | GEM_MII_SLINK_EN_SYNC_D); - bus_write_4(sc->sc_res[0], GEM_MII_CONFIG, - GEM_MII_CONFIG_ENABLE); + GEM_BANK1_WRITE_4(sc, GEM_MII_CONFIG, GEM_MII_CONFIG_ENABLE); sc->sc_flags |= GEM_SERDES; sc->sc_phyad = GEM_PHYAD_EXTERNAL; error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus, @@ -327,12 +331,12 @@ * allocated. */ - /* Get RX FIFO size */ + /* Get RX FIFO size. */ sc->sc_rxfifosize = 64 * - bus_read_4(sc->sc_res[0], GEM_RX_FIFO_SIZE); + GEM_BANK1_READ_4(sc, GEM_RX_FIFO_SIZE); - /* Get TX FIFO size */ - v = bus_read_4(sc->sc_res[0], GEM_TX_FIFO_SIZE); + /* Get TX FIFO size. */ + v = GEM_BANK1_READ_4(sc, GEM_TX_FIFO_SIZE); device_printf(sc->sc_dev, "%ukB RX FIFO, %ukB TX FIFO\n", sc->sc_rxfifosize / 1024, v / 16); @@ -592,18 +596,18 @@ * Unload collision counters. */ ifp->if_collisions += - bus_read_4(sc->sc_res[0], GEM_MAC_NORM_COLL_CNT) + - bus_read_4(sc->sc_res[0], GEM_MAC_FIRST_COLL_CNT) + - bus_read_4(sc->sc_res[0], GEM_MAC_EXCESS_COLL_CNT) + - bus_read_4(sc->sc_res[0], GEM_MAC_LATE_COLL_CNT); + GEM_BANK1_READ_4(sc, GEM_MAC_NORM_COLL_CNT) + + GEM_BANK1_READ_4(sc, GEM_MAC_FIRST_COLL_CNT) + + GEM_BANK1_READ_4(sc, GEM_MAC_EXCESS_COLL_CNT) + + GEM_BANK1_READ_4(sc, GEM_MAC_LATE_COLL_CNT); /* - * then clear the hardware counters. + * Then clear the hardware counters. */ - bus_write_4(sc->sc_res[0], GEM_MAC_NORM_COLL_CNT, 0); - bus_write_4(sc->sc_res[0], GEM_MAC_FIRST_COLL_CNT, 0); - bus_write_4(sc->sc_res[0], GEM_MAC_EXCESS_COLL_CNT, 0); - bus_write_4(sc->sc_res[0], GEM_MAC_LATE_COLL_CNT, 0); + GEM_BANK1_WRITE_4(sc, GEM_MAC_NORM_COLL_CNT, 0); + GEM_BANK1_WRITE_4(sc, GEM_MAC_FIRST_COLL_CNT, 0); + GEM_BANK1_WRITE_4(sc, GEM_MAC_EXCESS_COLL_CNT, 0); + GEM_BANK1_WRITE_4(sc, GEM_MAC_LATE_COLL_CNT, 0); mii_tick(sc->sc_mii); @@ -614,13 +618,14 @@ } static int -gem_bitwait(struct gem_softc *sc, bus_addr_t r, uint32_t clr, uint32_t set) +gem_bitwait(struct gem_softc *sc, u_int bank, bus_addr_t r, uint32_t clr, + uint32_t set) { int i; uint32_t reg; for (i = TRIES; i--; DELAY(100)) { - reg = bus_read_4(sc->sc_res[0], r); + reg = GEM_BANKN_READ_M(bank, 4, sc, r); if ((reg & clr) == 0 && (reg & set) == set) return (1); } @@ -639,9 +644,9 @@ gem_reset_tx(sc); /* Do a full reset. */ - bus_write_4(sc->sc_res[0], GEM_RESET, GEM_RESET_RX | GEM_RESET_TX); - bus_barrier(sc->sc_res[0], GEM_RESET, 4, BUS_SPACE_BARRIER_WRITE); - if (!gem_bitwait(sc, GEM_RESET, GEM_RESET_RX | GEM_RESET_TX, 0)) + GEM_BANK2_WRITE_4(sc, GEM_RESET, GEM_RESET_RX | GEM_RESET_TX); + GEM_BANK2_BARRIER(sc, GEM_RESET, 4, BUS_SPACE_BARRIER_WRITE); + if (!GEM_BANK2_BITWAIT(sc, GEM_RESET, GEM_RESET_RX | GEM_RESET_TX, 0)) device_printf(sc->sc_dev, "cannot reset device\n"); } @@ -719,15 +724,16 @@ * disable DMA first. */ gem_disable_rx(sc); - bus_write_4(sc->sc_res[0], GEM_RX_CONFIG, 0); - bus_barrier(sc->sc_res[0], GEM_RX_CONFIG, 4, BUS_SPACE_BARRIER_WRITE); - if (!gem_bitwait(sc, GEM_RX_CONFIG, GEM_RX_CONFIG_RXDMA_EN, 0)) + GEM_BANK1_WRITE_4(sc, GEM_RX_CONFIG, 0); + GEM_BANK1_BARRIER(sc, GEM_RX_CONFIG, 4, BUS_SPACE_BARRIER_WRITE); + if (!GEM_BANK1_BITWAIT(sc, GEM_RX_CONFIG, GEM_RX_CONFIG_RXDMA_EN, 0)) device_printf(sc->sc_dev, "cannot disable RX DMA\n"); - /* Finally, reset the ERX */ - bus_write_4(sc->sc_res[0], GEM_RESET, GEM_RESET_RX); - bus_barrier(sc->sc_res[0], GEM_RESET, 4, BUS_SPACE_BARRIER_WRITE); - if (!gem_bitwait(sc, GEM_RESET, GEM_RESET_RX | GEM_RESET_TX, 0)) { + /* Finally, reset the ERX. */ + GEM_BANK2_WRITE_4(sc, GEM_RESET, GEM_RESET_RX); + GEM_BANK2_BARRIER(sc, GEM_RESET, 4, BUS_SPACE_BARRIER_WRITE); + if (!GEM_BANK2_BITWAIT(sc, GEM_RESET, GEM_RESET_RX | GEM_RESET_TX, + 0)) { device_printf(sc->sc_dev, "cannot reset receiver\n"); return (1); } @@ -756,28 +762,26 @@ GEM_CDSYNC(sc, BUS_DMASYNC_PREREAD); /* NOTE: we use only 32-bit DMA addresses here. */ - bus_write_4(sc->sc_res[0], GEM_RX_RING_PTR_HI, 0); - bus_write_4(sc->sc_res[0], GEM_RX_RING_PTR_LO, GEM_CDRXADDR(sc, 0)); - bus_write_4(sc->sc_res[0], GEM_RX_KICK, GEM_NRXDESC - 4); - bus_write_4(sc->sc_res[0], GEM_RX_CONFIG, + GEM_BANK1_WRITE_4(sc, GEM_RX_RING_PTR_HI, 0); + GEM_BANK1_WRITE_4(sc, GEM_RX_RING_PTR_LO, GEM_CDRXADDR(sc, 0)); + GEM_BANK1_WRITE_4(sc, GEM_RX_KICK, GEM_NRXDESC - 4); + GEM_BANK1_WRITE_4(sc, GEM_RX_CONFIG, gem_ringsize(GEM_NRXDESC /* XXX */) | ((ETHER_HDR_LEN + sizeof(struct ip)) << GEM_RX_CONFIG_CXM_START_SHFT) | (GEM_THRSH_1024 << GEM_RX_CONFIG_FIFO_THRS_SHIFT) | (2 << GEM_RX_CONFIG_FBOFF_SHFT)); - bus_write_4(sc->sc_res[0], GEM_RX_BLANKING, + GEM_BANK1_WRITE_4(sc, GEM_RX_BLANKING, (6 << GEM_RX_BLANKING_TIME_SHIFT) | 6); - bus_write_4(sc->sc_res[0], GEM_RX_PAUSE_THRESH, + GEM_BANK1_WRITE_4(sc, GEM_RX_PAUSE_THRESH, (3 * sc->sc_rxfifosize / 256) | ((sc->sc_rxfifosize / 256) << 12)); - bus_write_4(sc->sc_res[0], GEM_RX_CONFIG, - bus_read_4(sc->sc_res[0], GEM_RX_CONFIG) | - GEM_RX_CONFIG_RXDMA_EN); - bus_write_4(sc->sc_res[0], GEM_MAC_RX_MASK, + GEM_BANK1_WRITE_4(sc, GEM_RX_CONFIG, + GEM_BANK1_READ_4(sc, GEM_RX_CONFIG) | GEM_RX_CONFIG_RXDMA_EN); + GEM_BANK1_WRITE_4(sc, GEM_MAC_RX_MASK, GEM_MAC_RX_DONE | GEM_MAC_RX_FRAME_CNT); - bus_write_4(sc->sc_res[0], GEM_MAC_RX_CONFIG, - bus_read_4(sc->sc_res[0], GEM_MAC_RX_CONFIG) | - GEM_MAC_RX_ENABLE); + GEM_BANK1_WRITE_4(sc, GEM_MAC_RX_CONFIG, + GEM_BANK1_READ_4(sc, GEM_MAC_RX_CONFIG) | GEM_MAC_RX_ENABLE); } static int @@ -789,15 +793,16 @@ * disable DMA first. */ gem_disable_tx(sc); - bus_write_4(sc->sc_res[0], GEM_TX_CONFIG, 0); - bus_barrier(sc->sc_res[0], GEM_TX_CONFIG, 4, BUS_SPACE_BARRIER_WRITE); - if (!gem_bitwait(sc, GEM_TX_CONFIG, GEM_TX_CONFIG_TXDMA_EN, 0)) + GEM_BANK1_WRITE_4(sc, GEM_TX_CONFIG, 0); + GEM_BANK1_BARRIER(sc, GEM_TX_CONFIG, 4, BUS_SPACE_BARRIER_WRITE); + if (!GEM_BANK1_BITWAIT(sc, GEM_TX_CONFIG, GEM_TX_CONFIG_TXDMA_EN, 0)) device_printf(sc->sc_dev, "cannot disable TX DMA\n"); - /* Finally, reset the ETX */ - bus_write_4(sc->sc_res[0], GEM_RESET, GEM_RESET_TX); - bus_barrier(sc->sc_res[0], GEM_RESET, 4, BUS_SPACE_BARRIER_WRITE); - if (!gem_bitwait(sc, GEM_RESET, GEM_RESET_RX | GEM_RESET_TX, 0)) { + /* Finally, reset the ETX. */ + GEM_BANK2_WRITE_4(sc, GEM_RESET, GEM_RESET_TX); + GEM_BANK2_BARRIER(sc, GEM_RESET, 4, BUS_SPACE_BARRIER_WRITE); + if (!GEM_BANK2_BITWAIT(sc, GEM_RESET, GEM_RESET_RX | GEM_RESET_TX, + 0)) { device_printf(sc->sc_dev, "cannot reset transmitter\n"); return (1); } @@ -807,30 +812,23 @@ static int gem_disable_rx(struct gem_softc *sc) { - uint32_t cfg; - cfg = bus_read_4(sc->sc_res[0], GEM_MAC_RX_CONFIG); - cfg &= ~GEM_MAC_RX_ENABLE; - bus_write_4(sc->sc_res[0], GEM_MAC_RX_CONFIG, cfg); - bus_barrier(sc->sc_res[0], GEM_MAC_RX_CONFIG, 4, - BUS_SPACE_BARRIER_WRITE); - return (gem_bitwait(sc, GEM_MAC_RX_CONFIG, GEM_MAC_RX_ENABLE, 0)); + GEM_BANK1_WRITE_4(sc, GEM_MAC_RX_CONFIG, + GEM_BANK1_READ_4(sc, GEM_MAC_RX_CONFIG) & ~GEM_MAC_RX_ENABLE); + GEM_BANK1_BARRIER(sc, GEM_MAC_RX_CONFIG, 4, BUS_SPACE_BARRIER_WRITE); + return (GEM_BANK1_BITWAIT(sc, GEM_MAC_RX_CONFIG, GEM_MAC_RX_ENABLE, + 0)); } -/* - * disable transmitter. - */ static int gem_disable_tx(struct gem_softc *sc) { - uint32_t cfg; - cfg = bus_read_4(sc->sc_res[0], GEM_MAC_TX_CONFIG); - cfg &= ~GEM_MAC_TX_ENABLE; - bus_write_4(sc->sc_res[0], GEM_MAC_TX_CONFIG, cfg); - bus_barrier(sc->sc_res[0], GEM_MAC_TX_CONFIG, 4, - BUS_SPACE_BARRIER_WRITE); - return (gem_bitwait(sc, GEM_MAC_TX_CONFIG, GEM_MAC_TX_ENABLE, 0)); + GEM_BANK1_WRITE_4(sc, GEM_MAC_TX_CONFIG, + GEM_BANK1_READ_4(sc, GEM_MAC_TX_CONFIG) & ~GEM_MAC_TX_ENABLE); + GEM_BANK1_BARRIER(sc, GEM_MAC_TX_CONFIG, 4, BUS_SPACE_BARRIER_WRITE); + return (GEM_BANK1_BITWAIT(sc, GEM_MAC_TX_CONFIG, GEM_MAC_TX_ENABLE, + 0)); } static int @@ -964,18 +962,18 @@ /* step 6 & 7. Program Descriptor Ring Base Addresses. */ /* NOTE: we use only 32-bit DMA addresses here. */ - bus_write_4(sc->sc_res[0], GEM_TX_RING_PTR_HI, 0); - bus_write_4(sc->sc_res[0], GEM_TX_RING_PTR_LO, GEM_CDTXADDR(sc, 0)); + GEM_BANK1_WRITE_4(sc, GEM_TX_RING_PTR_HI, 0); + GEM_BANK1_WRITE_4(sc, GEM_TX_RING_PTR_LO, GEM_CDTXADDR(sc, 0)); - bus_write_4(sc->sc_res[0], GEM_RX_RING_PTR_HI, 0); - bus_write_4(sc->sc_res[0], GEM_RX_RING_PTR_LO, GEM_CDRXADDR(sc, 0)); + GEM_BANK1_WRITE_4(sc, GEM_RX_RING_PTR_HI, 0); + GEM_BANK1_WRITE_4(sc, GEM_RX_RING_PTR_LO, GEM_CDRXADDR(sc, 0)); #ifdef GEM_DEBUG CTR3(KTR_GEM, "loading RX ring %lx, TX ring %lx, cddma %lx", GEM_CDRXADDR(sc, 0), GEM_CDTXADDR(sc, 0), sc->sc_cddma); #endif /* step 8. Global Configuration & Interrupt Mask */ - bus_write_4(sc->sc_res[0], GEM_INTMASK, + GEM_BANK1_WRITE_4(sc, GEM_INTMASK, ~(GEM_INTR_TX_INTME | GEM_INTR_TX_EMPTY | GEM_INTR_RX_DONE | GEM_INTR_RX_NOBUF | GEM_INTR_RX_TAG_ERR | GEM_INTR_PERR | GEM_INTR_BERR @@ -983,15 +981,15 @@ | GEM_INTR_PCS | GEM_INTR_MIF #endif )); - bus_write_4(sc->sc_res[0], GEM_MAC_RX_MASK, + GEM_BANK1_WRITE_4(sc, GEM_MAC_RX_MASK, GEM_MAC_RX_DONE | GEM_MAC_RX_FRAME_CNT); - bus_write_4(sc->sc_res[0], GEM_MAC_TX_MASK, + GEM_BANK1_WRITE_4(sc, GEM_MAC_TX_MASK, GEM_MAC_TX_XMIT_DONE | GEM_MAC_TX_DEFER_EXP); #ifdef GEM_DEBUG - bus_write_4(sc->sc_res[0], GEM_MAC_CONTROL_MASK, + GEM_BANK1_WRITE_4(sc, GEM_MAC_CONTROL_MASK, ~(GEM_MAC_PAUSED | GEM_MAC_PAUSE | GEM_MAC_RESUME)); #else - bus_write_4(sc->sc_res[0], GEM_MAC_CONTROL_MASK, + GEM_BANK1_WRITE_4(sc, GEM_MAC_CONTROL_MASK, GEM_MAC_PAUSED | GEM_MAC_PAUSE | GEM_MAC_RESUME); #endif @@ -999,7 +997,7 @@ /* Enable DMA. */ v = gem_ringsize(GEM_NTXDESC /* XXX */); - bus_write_4(sc->sc_res[0], GEM_TX_CONFIG, + GEM_BANK1_WRITE_4(sc, GEM_TX_CONFIG, v | GEM_TX_CONFIG_TXDMA_EN | ((0x400 << 10) & GEM_TX_CONFIG_TXFIFO_TH)); @@ -1012,37 +1010,36 @@ GEM_RX_CONFIG_CXM_START_SHFT); /* Enable DMA. */ - bus_write_4(sc->sc_res[0], GEM_RX_CONFIG, + GEM_BANK1_WRITE_4(sc, GEM_RX_CONFIG, v | (GEM_THRSH_1024 << GEM_RX_CONFIG_FIFO_THRS_SHIFT) | (2 << GEM_RX_CONFIG_FBOFF_SHFT) | GEM_RX_CONFIG_RXDMA_EN); - bus_write_4(sc->sc_res[0], GEM_RX_BLANKING, + GEM_BANK1_WRITE_4(sc, GEM_RX_BLANKING, (6 << GEM_RX_BLANKING_TIME_SHIFT) | 6); /* * The following value is for an OFF Threshold of about 3/4 full * and an ON Threshold of 1/4 full. */ - bus_write_4(sc->sc_res[0], GEM_RX_PAUSE_THRESH, + GEM_BANK1_WRITE_4(sc, GEM_RX_PAUSE_THRESH, (3 * sc->sc_rxfifosize / 256) | ((sc->sc_rxfifosize / 256) << 12)); /* step 11. Configure Media. */ /* step 12. RX_MAC Configuration Register */ - v = bus_read_4(sc->sc_res[0], GEM_MAC_RX_CONFIG); + v = GEM_BANK1_READ_4(sc, GEM_MAC_RX_CONFIG); v |= GEM_MAC_RX_STRIP_CRC; - bus_write_4(sc->sc_res[0], GEM_MAC_RX_CONFIG, 0); - bus_barrier(sc->sc_res[0], GEM_MAC_RX_CONFIG, 4, - BUS_SPACE_BARRIER_WRITE); - if (!gem_bitwait(sc, GEM_MAC_RX_CONFIG, GEM_MAC_RX_ENABLE, 0)) + GEM_BANK1_WRITE_4(sc, GEM_MAC_RX_CONFIG, 0); + GEM_BANK1_BARRIER(sc, GEM_MAC_RX_CONFIG, 4, BUS_SPACE_BARRIER_WRITE); + if (!GEM_BANK1_BITWAIT(sc, GEM_MAC_RX_CONFIG, GEM_MAC_RX_ENABLE, 0)) device_printf(sc->sc_dev, "cannot disable RX MAC\n"); - bus_write_4(sc->sc_res[0], GEM_MAC_RX_CONFIG, v); + GEM_BANK1_WRITE_4(sc, GEM_MAC_RX_CONFIG, v); /* step 14. Issue Transmit Pending command. */ /* step 15. Give the reciever a swift kick. */ - bus_write_4(sc->sc_res[0], GEM_RX_KICK, GEM_NRXDESC - 4); + GEM_BANK1_WRITE_4(sc, GEM_RX_KICK, GEM_NRXDESC - 4); ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; @@ -1090,6 +1087,9 @@ } } else if (error != 0) return (error); + /* If nsegs is wrong then the stack is corrupt. */ + KASSERT(nsegs <= GEM_NTXSEGS, + ("%s: too many DMA segments (%d)", __func__, nsegs)); if (nsegs == 0) { m_freem(*m_head); *m_head = NULL; @@ -1183,60 +1183,59 @@ /* These registers are not cleared on reset. */ if ((sc->sc_flags & GEM_INITED) == 0) { /* magic values */ - bus_write_4(sc->sc_res[0], GEM_MAC_IPG0, 0); - bus_write_4(sc->sc_res[0], GEM_MAC_IPG1, 8); - bus_write_4(sc->sc_res[0], GEM_MAC_IPG2, 4); + GEM_BANK1_WRITE_4(sc, GEM_MAC_IPG0, 0); + GEM_BANK1_WRITE_4(sc, GEM_MAC_IPG1, 8); + GEM_BANK1_WRITE_4(sc, GEM_MAC_IPG2, 4); - bus_write_4(sc->sc_res[0], GEM_MAC_MAC_MIN_FRAME, - ETHER_MIN_LEN); + GEM_BANK1_WRITE_4(sc, GEM_MAC_MAC_MIN_FRAME, ETHER_MIN_LEN); /* max frame and max burst size */ - bus_write_4(sc->sc_res[0], GEM_MAC_MAC_MAX_FRAME, + GEM_BANK1_WRITE_4(sc, GEM_MAC_MAC_MAX_FRAME, (ETHER_MAX_LEN + ETHER_VLAN_ENCAP_LEN) | (0x2000 << 16)); - bus_write_4(sc->sc_res[0], GEM_MAC_PREAMBLE_LEN, 0x7); - bus_write_4(sc->sc_res[0], GEM_MAC_JAM_SIZE, 0x4); - bus_write_4(sc->sc_res[0], GEM_MAC_ATTEMPT_LIMIT, 0x10); + GEM_BANK1_WRITE_4(sc, GEM_MAC_PREAMBLE_LEN, 0x7); + GEM_BANK1_WRITE_4(sc, GEM_MAC_JAM_SIZE, 0x4); + GEM_BANK1_WRITE_4(sc, GEM_MAC_ATTEMPT_LIMIT, 0x10); /* dunno... */ - bus_write_4(sc->sc_res[0], GEM_MAC_CONTROL_TYPE, 0x8088); - bus_write_4(sc->sc_res[0], GEM_MAC_RANDOM_SEED, >>> TRUNCATED FOR MAIL (1000 lines) <<<