PERFORCE change 110116 for review
Jung-uk Kim
jkim at FreeBSD.org
Thu Nov 16 18:12:16 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=110116
Change 110116 by jkim at jkim_hammer on 2006/11/16 18:11:31
IFC
Affected files ...
.. //depot/projects/linuxolator/src/sys/amd64/amd64/db_trace.c#3 integrate
.. //depot/projects/linuxolator/src/sys/amd64/amd64/machdep.c#7 integrate
.. //depot/projects/linuxolator/src/sys/amd64/amd64/msi.c#2 integrate
.. //depot/projects/linuxolator/src/sys/amd64/include/reg.h#2 integrate
.. //depot/projects/linuxolator/src/sys/boot/arm/at91/boot0/Makefile#2 integrate
.. //depot/projects/linuxolator/src/sys/boot/arm/at91/boot0/arm_init.s#2 delete
.. //depot/projects/linuxolator/src/sys/boot/arm/at91/boot0iic/Makefile#2 integrate
.. //depot/projects/linuxolator/src/sys/boot/arm/at91/boot0iic/main.c#3 integrate
.. //depot/projects/linuxolator/src/sys/boot/arm/at91/boot0spi/Makefile#2 integrate
.. //depot/projects/linuxolator/src/sys/boot/arm/at91/boot0spi/main.c#3 integrate
.. //depot/projects/linuxolator/src/sys/boot/arm/at91/boot2/Makefile#3 integrate
.. //depot/projects/linuxolator/src/sys/boot/arm/at91/boot2/boot2.c#3 integrate
.. //depot/projects/linuxolator/src/sys/boot/arm/at91/bootiic/Makefile#3 integrate
.. //depot/projects/linuxolator/src/sys/boot/arm/at91/bootiic/arm_init.S#2 delete
.. //depot/projects/linuxolator/src/sys/boot/arm/at91/bootspi/Makefile#4 integrate
.. //depot/projects/linuxolator/src/sys/boot/arm/at91/bootspi/arm_init.S#3 delete
.. //depot/projects/linuxolator/src/sys/boot/arm/at91/libat91/arm_init.S#1 branch
.. //depot/projects/linuxolator/src/sys/boot/arm/at91/libat91/mci_device.c#3 delete
.. //depot/projects/linuxolator/src/sys/boot/i386/loader/main.c#3 integrate
.. //depot/projects/linuxolator/src/sys/dev/bce/if_bce.c#7 integrate
.. //depot/projects/linuxolator/src/sys/dev/bce/if_bcereg.h#5 integrate
.. //depot/projects/linuxolator/src/sys/dev/em/if_em.c#9 integrate
.. //depot/projects/linuxolator/src/sys/dev/em/if_em.h#5 integrate
.. //depot/projects/linuxolator/src/sys/dev/isp/isp.c#4 integrate
.. //depot/projects/linuxolator/src/sys/dev/isp/isp_library.c#4 integrate
.. //depot/projects/linuxolator/src/sys/dev/isp/ispmbox.h#3 integrate
.. //depot/projects/linuxolator/src/sys/dev/mpt/mpt.c#2 integrate
.. //depot/projects/linuxolator/src/sys/dev/mpt/mpt.h#2 integrate
.. //depot/projects/linuxolator/src/sys/dev/mpt/mpt_cam.c#5 integrate
.. //depot/projects/linuxolator/src/sys/dev/mpt/mpt_pci.c#2 integrate
.. //depot/projects/linuxolator/src/sys/dev/pci/pci.c#9 integrate
.. //depot/projects/linuxolator/src/sys/dev/syscons/syscons.c#6 integrate
.. //depot/projects/linuxolator/src/sys/i386/i386/db_trace.c#3 integrate
.. //depot/projects/linuxolator/src/sys/i386/i386/machdep.c#5 integrate
.. //depot/projects/linuxolator/src/sys/i386/i386/msi.c#2 integrate
.. //depot/projects/linuxolator/src/sys/i386/i386/pmap.c#4 integrate
.. //depot/projects/linuxolator/src/sys/i386/include/reg.h#2 integrate
.. //depot/projects/linuxolator/src/sys/kern/kern_condvar.c#2 integrate
.. //depot/projects/linuxolator/src/sys/kern/kern_synch.c#3 integrate
.. //depot/projects/linuxolator/src/sys/kern/subr_sleepqueue.c#2 integrate
.. //depot/projects/linuxolator/src/sys/sun4v/include/tte_hash.h#3 integrate
.. //depot/projects/linuxolator/src/sys/sun4v/sun4v/pmap.c#5 integrate
.. //depot/projects/linuxolator/src/sys/sun4v/sun4v/tte_hash.c#3 integrate
.. //depot/projects/linuxolator/src/sys/sys/sleepqueue.h#2 integrate
Differences ...
==== //depot/projects/linuxolator/src/sys/amd64/amd64/db_trace.c#3 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/db_trace.c,v 1.76 2006/10/20 09:44:20 bde Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/db_trace.c,v 1.77 2006/11/15 19:53:47 jhb Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -202,8 +202,8 @@
static char * watchtype_str(int type);
int amd64_set_watch(int watchnum, unsigned long watchaddr, int size,
- int access, struct dbreg * d);
-int amd64_clr_watch(int watchnum, struct dbreg * d);
+ int access, struct dbreg *d);
+int amd64_clr_watch(int watchnum, struct dbreg *d);
/*
* Figure out how many arguments were passed into the frame at "fp".
@@ -536,11 +536,11 @@
unsigned long watchaddr;
int size;
int access;
- struct dbreg * d;
+ struct dbreg *d;
{
int i;
unsigned int mask;
-
+
if (watchnum == -1) {
for (i = 0, mask = 0x3; i < 4; i++, mask <<= 2)
if ((d->dr[7] & mask) == 0)
@@ -550,7 +550,7 @@
else
return (-1);
}
-
+
switch (access) {
case DBREG_DR7_EXEC:
size = 1; /* size must be 1 for an execution breakpoint */
@@ -558,9 +558,10 @@
case DBREG_DR7_WRONLY:
case DBREG_DR7_RDWR:
break;
- default : return (-1);
+ default:
+ return (-1);
}
-
+
/*
* we can watch a 1, 2, or 4 byte sized location
*/
@@ -577,7 +578,7 @@
d->dr[7] &= ~((0x3 << (watchnum*2)) | (0x0f << (watchnum*4+16)));
/* set drN register to the address, N=watchnum */
- DBREG_DRX(d,watchnum) = watchaddr;
+ DBREG_DRX(d, watchnum) = watchaddr;
/* enable the watchpoint */
d->dr[7] |= (0x2 << (watchnum*2)) | (mask << (watchnum*4+16));
@@ -589,15 +590,15 @@
int
amd64_clr_watch(watchnum, d)
int watchnum;
- struct dbreg * d;
+ struct dbreg *d;
{
if (watchnum < 0 || watchnum >= 4)
return (-1);
-
+
d->dr[7] = d->dr[7] & ~((0x3 << (watchnum*2)) | (0x0f << (watchnum*4+16)));
- DBREG_DRX(d,watchnum) = 0;
-
+ DBREG_DRX(d, watchnum) = 0;
+
return (0);
}
@@ -607,22 +608,21 @@
db_expr_t addr;
db_expr_t size;
{
- int avail, wsize;
- int i;
struct dbreg d;
-
+ int avail, i, wsize;
+
fill_dbregs(NULL, &d);
-
+
avail = 0;
- for(i=0; i<4; i++) {
+ for(i = 0; i < 4; i++) {
if ((d.dr[7] & (3 << (i*2))) == 0)
avail++;
}
-
- if (avail*4 < size)
+
+ if (avail * 4 < size)
return (-1);
-
- for (i=0; i<4 && (size != 0); i++) {
+
+ for (i = 0; i < 4 && (size != 0); i++) {
if ((d.dr[7] & (3<<(i*2))) == 0) {
if (size > 4)
wsize = 4;
@@ -630,15 +630,15 @@
wsize = size;
if (wsize == 3)
wsize++;
- amd64_set_watch(i, addr, wsize,
+ amd64_set_watch(i, addr, wsize,
DBREG_DR7_WRONLY, &d);
addr += wsize;
size -= wsize;
}
}
-
+
set_dbregs(NULL, &d);
-
+
return(0);
}
@@ -653,22 +653,22 @@
fill_dbregs(NULL, &d);
- for(i=0; i<4; i++) {
+ for(i = 0; i < 4; i++) {
if (d.dr[7] & (3 << (i*2))) {
- if ((DBREG_DRX((&d), i) >= addr) &&
+ if ((DBREG_DRX((&d), i) >= addr) &&
(DBREG_DRX((&d), i) < addr+size))
amd64_clr_watch(i, &d);
-
+
}
}
-
+
set_dbregs(NULL, &d);
-
+
return(0);
}
-static
+static
char *
watchtype_str(type)
int type;
@@ -685,30 +685,29 @@
void
db_md_list_watchpoints()
{
- int i;
struct dbreg d;
+ int i, len, type;
fill_dbregs(NULL, &d);
db_printf("\nhardware watchpoints:\n");
db_printf(" watch status type len address\n");
db_printf(" ----- -------- ---------- --- ----------\n");
- for (i=0; i<4; i++) {
+ for (i = 0; i < 4; i++) {
if (d.dr[7] & (0x03 << (i*2))) {
- unsigned type, len;
type = (d.dr[7] >> (16+(i*4))) & 3;
len = (d.dr[7] >> (16+(i*4)+2)) & 3;
db_printf(" %-5d %-8s %10s %3d 0x%016lx\n",
- i, "enabled", watchtype_str(type),
+ i, "enabled", watchtype_str(type),
len + 1, DBREG_DRX((&d), i));
}
else {
db_printf(" %-5d disabled\n", i);
}
}
-
+
db_printf("\ndebug register values:\n");
- for (i=0; i<8; i++) {
+ for (i = 0; i < 8; i++) {
db_printf(" dr%d 0x%016lx\n", i, DBREG_DRX((&d), i));
}
db_printf("\n");
==== //depot/projects/linuxolator/src/sys/amd64/amd64/machdep.c#7 (text+ko) ====
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/machdep.c,v 1.660 2006/11/07 21:57:18 ru Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/machdep.c,v 1.661 2006/11/15 19:53:47 jhb Exp $");
#include "opt_atalk.h"
#include "opt_atpic.h"
@@ -1832,9 +1832,8 @@
addr[nbp++] = (caddr_t)rdr3();
}
- for (i=0; i<nbp; i++) {
- if (addr[i] <
- (caddr_t)VM_MAXUSER_ADDRESS) {
+ for (i = 0; i < nbp; i++) {
+ if (addr[i] < (caddr_t)VM_MAXUSER_ADDRESS) {
/*
* addr[i] is in user space
*/
==== //depot/projects/linuxolator/src/sys/amd64/amd64/msi.c#2 (text+ko) ====
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/msi.c,v 1.1 2006/11/13 22:23:32 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/msi.c,v 1.2 2006/11/15 18:40:00 jhb Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -315,7 +315,7 @@
/* We need count - cnt more sources starting at index 'cnt'. */
*newirq = cnt;
*newcount = count - cnt;
- for (j = 0; j < *newirq; j++) {
+ for (j = 0; j < *newcount; j++) {
/* Create a new MSI source. */
msi = malloc(sizeof(struct msi_intsrc), M_MSI,
==== //depot/projects/linuxolator/src/sys/amd64/include/reg.h#2 (text+ko) ====
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* from: @(#)reg.h 5.5 (Berkeley) 1/18/91
- * $FreeBSD: src/sys/amd64/include/reg.h,v 1.35 2004/04/05 23:55:14 imp Exp $
+ * $FreeBSD: src/sys/amd64/include/reg.h,v 1.36 2006/11/15 19:53:48 jhb Exp $
*/
#ifndef _MACHINE_REG_H_
@@ -92,11 +92,13 @@
/* Index 8-15: reserved */
};
-#define DBREG_DR7_EXEC 0x00 /* break on execute */
-#define DBREG_DR7_WRONLY 0x01 /* break on write */
-#define DBREG_DR7_RDWR 0x03 /* break on read or write */
-#define DBREG_DRX(d,x) ((d)->dr[(x)]) /* reference dr0 - dr15 by
- register number */
+#define DBREG_DR7_EXEC 0x00 /* break on execute */
+#define DBREG_DR7_WRONLY 0x01 /* break on write */
+#define DBREG_DR7_RDWR 0x03 /* break on read or write */
+
+#define DBREG_DRX(d,x) ((d)->dr[(x)]) /* reference dr0 - dr15 by
+ register number */
+
#ifdef _KERNEL
/*
* XXX these interfaces are MI, so they should be declared in a MI place.
==== //depot/projects/linuxolator/src/sys/boot/arm/at91/boot0/Makefile#2 (text) ====
@@ -1,11 +1,14 @@
-# $FreeBSD: src/sys/boot/arm/at91/boot0/Makefile,v 1.4 2006/08/18 20:26:54 imp Exp $
+# $FreeBSD: src/sys/boot/arm/at91/boot0/Makefile,v 1.5 2006/11/16 00:53:27 imp Exp $
+
+.PATH: ${.CURDIR}/../libat91
P=boot0
FILES=${P}
-SRCS=arm_init.s main.c
+SRCS=arm_init.S main.c
NO_MAN=
LDFLAGS=-e 0 -T ${.CURDIR}/linker.cfg
OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
.include <bsd.prog.mk>
+CFLAGS+=-DBOOT_BOOT0
==== //depot/projects/linuxolator/src/sys/boot/arm/at91/boot0iic/Makefile#2 (text) ====
@@ -1,12 +1,14 @@
-# $FreeBSD: src/sys/boot/arm/at91/boot0iic/Makefile,v 1.2 2006/08/16 23:14:52 imp Exp $
+# $FreeBSD: src/sys/boot/arm/at91/boot0iic/Makefile,v 1.3 2006/11/16 00:53:27 imp Exp $
-.PATH: ${.CURDIR}/../boot0
+.PATH: ${.CURDIR}/../libat91
P=boot0iic
FILES=${P}
-SRCS=arm_init.s main.c
+SRCS=arm_init.S main.c
NO_MAN=
LDFLAGS=-e 0 -T ${.CURDIR}/../linker.cfg
OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
.include <bsd.prog.mk>
+
+CFLAGS+=-DBOOT_BOOT0
==== //depot/projects/linuxolator/src/sys/boot/arm/at91/boot0iic/main.c#3 (text) ====
@@ -21,7 +21,7 @@
* (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: src/sys/boot/arm/at91/boot0iic/main.c,v 1.3 2006/11/09 19:55:25 imp Exp $
+ * $FreeBSD: src/sys/boot/arm/at91/boot0iic/main.c,v 1.4 2006/11/16 00:49:50 imp Exp $
*/
#include "at91rm9200.h"
@@ -32,12 +32,19 @@
main(void)
{
char *addr = (char *)SDRAM_BASE + (1 << 20); /* Load to base + 1MB */
+ int len, sec;
- while (xmodem_rx(addr) == -1)
+ printf("\nSend data to be written into EEPROM\n");
+ while ((len = xmodem_rx(addr)) == -1)
+ continue;
+ sec = GetSeconds() + 1;
+ while (sec >= GetSeconds())
continue;
+ printf("\nWriting EEPROM from 0x%x to addr 0, 0x%x bytes\n", addr,
+ len);
InitEEPROM();
- printf("Writing EEPROM from 0x%x to addr 0\n", addr);
- WriteEEPROM(0, addr, 8192);
- printf("Write complete. Press reset\n");
+ printf("init done\n");
+ WriteEEPROM(0, addr, len);
+ printf("\nWrote %d bytes. Press reset\n", len);
return (1);
}
==== //depot/projects/linuxolator/src/sys/boot/arm/at91/boot0spi/Makefile#2 (text) ====
@@ -1,13 +1,14 @@
-# $FreeBSD: src/sys/boot/arm/at91/boot0spi/Makefile,v 1.2 2006/08/16 23:18:07 imp Exp $
+# $FreeBSD: src/sys/boot/arm/at91/boot0spi/Makefile,v 1.3 2006/11/16 00:53:27 imp Exp $
-.PATH: ${.CURDIR}/../boot0
+.PATH: ${.CURDIR}/../libat91
P=boot0spi
FILES=${P}
-SRCS=arm_init.s main.c
+SRCS=arm_init.S main.c
NO_MAN=
LDFLAGS=-e 0 -T ${.CURDIR}/../linker.cfg
OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
.include <bsd.prog.mk>
+CFLAGS+=-DBOOT_BOOT0
==== //depot/projects/linuxolator/src/sys/boot/arm/at91/boot0spi/main.c#3 (text) ====
@@ -21,7 +21,7 @@
* (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: src/sys/boot/arm/at91/boot0spi/main.c,v 1.3 2006/10/21 22:43:07 imp Exp $
+ * $FreeBSD: src/sys/boot/arm/at91/boot0spi/main.c,v 1.4 2006/11/16 00:48:53 imp Exp $
*/
#include "at91rm9200.h"
@@ -29,21 +29,23 @@
#include "at91rm9200_lowlevel.h"
#include "spi_flash.h"
-#define OFFSET 0
+#define LOADER_OFFSET 0
+#define FPGA_OFFSET (15 * FLASH_PAGE_SIZE)
+#define OFFSET LOADER_OFFSET
int
main(void)
{
int len, i, j, off;
- char *addr = (char *)SDRAM_BASE + (1 << 20); /* Load to base + 1MB */
- char *addr2 = (char *)SDRAM_BASE + (2 << 20); /* Load to base + 2MB */
- char *addr3 = (char *)SDRAM_BASE + (3 << 20); /* Load to base + 2MB */
+ char *addr = (char *)SDRAM_BASE + (1 << 20); /* download at + 1MB */
+ char *addr2 = (char *)SDRAM_BASE + (2 << 20); /* readback to + 2MB */
+ char *addr3 = (char *)SDRAM_BASE + (3 << 20); /* extra copy at + 3MB */
SPI_InitFlash();
printf("Waiting for data\n");
while ((len = xmodem_rx(addr)) == -1)
continue;
- printf("\nDownloaded %u bytes.\n", len);
+ // Need extra copy at addr3
memcpy(addr3, addr, (len + FLASH_PAGE_SIZE - 1) / FLASH_PAGE_SIZE * FLASH_PAGE_SIZE);
printf("Writing %u bytes to flash at %u\n", len, OFFSET);
for (i = 0; i < len; i+= FLASH_PAGE_SIZE) {
@@ -57,5 +59,6 @@
if (j >= 10)
printf("Bad Readback at %u\n", i);
}
+ printf("Done\n");
return (1);
}
==== //depot/projects/linuxolator/src/sys/boot/arm/at91/boot2/Makefile#3 (text+ko) ====
@@ -1,19 +1,16 @@
-# $FreeBSD: src/sys/boot/arm/at91/boot2/Makefile,v 1.2 2006/11/09 20:07:26 imp Exp $
+# $FreeBSD: src/sys/boot/arm/at91/boot2/Makefile,v 1.3 2006/11/16 00:48:04 imp Exp $
-.PATH: ${.CURDIR}/../libat91
+.PATH: ${.CURDIR}/../libat91 ${.CURDIR}/../bootspi
P=boot2
FILES=${P}
-SRCS=arm_init.S boot2.c ${BOOT_FLAVOR}_board.c
+SRCS=arm_init.S boot2.c ${BOOT_FLAVOR:L}_board.c
NO_MAN=
LDFLAGS=-e 0 -T ${.CURDIR}/../linker.cfg
OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
.include <bsd.prog.mk>
-.if ${BOOT_FLAVOR} == "tsc"
-SRCS+=ee.c
-.endif
.if ${BOOT_FLAVOR} == "kb920x"
CFLAGS+=-DBOOT_IIC
.endif
==== //depot/projects/linuxolator/src/sys/boot/arm/at91/boot2/boot2.c#3 (text+ko) ====
@@ -14,7 +14,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/boot/arm/at91/boot2/boot2.c,v 1.2 2006/11/09 20:07:26 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/boot/arm/at91/boot2/boot2.c,v 1.3 2006/11/16 00:47:31 imp Exp $");
#include <sys/param.h>
#include <sys/disklabel.h>
@@ -29,7 +29,6 @@
#include "emac.h"
#include "lib.h"
#include "sd-card.h"
-#include "ee.h"
#include "board.h"
#define RBX_ASKNAME 0x0 /* -a */
==== //depot/projects/linuxolator/src/sys/boot/arm/at91/bootiic/Makefile#3 (text) ====
@@ -1,6 +1,6 @@
-# $FreeBSD: src/sys/boot/arm/at91/bootiic/Makefile,v 1.4 2006/11/09 20:23:51 imp Exp $
+# $FreeBSD: src/sys/boot/arm/at91/bootiic/Makefile,v 1.5 2006/11/16 00:53:27 imp Exp $
-.PATH: ${.CURDIR}/../libat91
+.PATH: ${.CURDIR}/../libat91
P=bootiic
FILES=${P}
@@ -11,4 +11,4 @@
.include <bsd.prog.mk>
-CFLAGS += -DBOOT_IIC
+CFLAGS += -DBOOT_IIC -DBOOT_COMMANDS
==== //depot/projects/linuxolator/src/sys/boot/arm/at91/bootspi/Makefile#4 (text) ====
@@ -1,6 +1,6 @@
-# $FreeBSD: src/sys/boot/arm/at91/bootspi/Makefile,v 1.5 2006/11/09 20:45:22 imp Exp $
+# $FreeBSD: src/sys/boot/arm/at91/bootspi/Makefile,v 1.6 2006/11/16 00:53:27 imp Exp $
-.PATH: ${.CURDIR}/../libat91
+.PATH: ${.CURDIR}/../libat91
P=bootspi
FILES=${P}
@@ -14,3 +14,4 @@
.if ${MK_FPGA} == "yes"
CFLAGS += -DTSC_FPGA
.endif
+CFLAGS += -DBOOT_COMMANDS
==== //depot/projects/linuxolator/src/sys/boot/i386/loader/main.c#3 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/boot/i386/loader/main.c,v 1.38 2006/11/02 01:23:18 marcel Exp $");
+__FBSDID("$FreeBSD: src/sys/boot/i386/loader/main.c,v 1.39 2006/11/16 13:32:30 ru Exp $");
/*
* MD bootstrap main() and assorted miscellaneous
@@ -191,7 +191,7 @@
extract_currdev(void)
{
struct i386_devdesc new_currdev;
- int major, biosdev = -1;
+ int biosdev = -1;
/* Assume we are booting from a BIOS disk by default */
new_currdev.d_dev = &biosdisk;
@@ -222,7 +222,6 @@
B_CONTROLLER(initial_bootdev) - 1;
new_currdev.d_kind.biosdisk.partition = B_PARTITION(initial_bootdev);
biosdev = initial_bootinfo->bi_bios_dev;
- major = B_TYPE(initial_bootdev);
/*
* If we are booted by an old bootstrap, we have to guess at the BIOS
==== //depot/projects/linuxolator/src/sys/dev/bce/if_bce.c#7 (text) ====
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.18 2006/10/31 03:28:25 scottl Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.21 2006/11/16 06:28:54 scottl Exp $");
/*
* The following controllers are supported by this driver:
@@ -452,7 +452,7 @@
struct bce_softc *sc;
struct ifnet *ifp;
u32 val;
- int mbuf, rid, rc = 0;
+ int count, mbuf, rid, rc = 0;
sc = device_get_softc(dev);
sc->bce_dev = dev;
@@ -485,7 +485,12 @@
sc->bce_vhandle = (vm_offset_t) rman_get_virtual(sc->bce_res);
/* Allocate PCI IRQ resources. */
- rid = 0;
+ count = pci_msi_count(dev);
+ if (count == 1 && pci_alloc_msi(dev, &count) == 0) {
+ rid = 1;
+ sc->bce_flags |= BCE_USING_MSI_FLAG;
+ } else
+ rid = 0;
sc->bce_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
RF_SHAREABLE | RF_ACTIVE);
@@ -2539,9 +2544,12 @@
if (sc->bce_irq != NULL)
bus_release_resource(dev,
SYS_RES_IRQ,
- 0,
+ sc->bce_flags & BCE_USING_MSI_FLAG ? 1 : 0,
sc->bce_irq);
+ if (sc->bce_flags & BCE_USING_MSI_FLAG)
+ pci_release_msi(dev);
+
if (sc->bce_res != NULL)
bus_release_resource(dev,
SYS_RES_MEMORY,
@@ -4253,7 +4261,7 @@
if (sc->tx_mbuf_ptr[sw_tx_chain_cons] != NULL) {
/* Validate that this is the last tx_bd. */
- DBRUNIF((!(txbd->tx_bd_vlan_tag_flags & TX_BD_FLAGS_END)),
+ DBRUNIF((!(txbd->tx_bd_flags & TX_BD_FLAGS_END)),
BCE_PRINTF(sc, "%s(%d): tx_bd END flag not set but "
"txmbuf == NULL!\n", __FILE__, __LINE__);
bce_breakpoint(sc));
@@ -4521,9 +4529,9 @@
bus_dmamap_t map;
struct tx_bd *txbd = NULL;
struct mbuf *m0;
- u32 vlan_tag_flags = 0;
+ u16 vlan_tag = 0, flags = 0;
+ u16 chain_prod, prod;
u32 prod_bseq;
- u16 chain_prod, prod;
#ifdef BCE_DEBUG
u16 debug_prod;
@@ -4534,15 +4542,16 @@
m0 = *m_head;
if (m0->m_pkthdr.csum_flags) {
if (m0->m_pkthdr.csum_flags & CSUM_IP)
- vlan_tag_flags |= TX_BD_FLAGS_IP_CKSUM;
+ flags |= TX_BD_FLAGS_IP_CKSUM;
if (m0->m_pkthdr.csum_flags & (CSUM_TCP | CSUM_UDP))
- vlan_tag_flags |= TX_BD_FLAGS_TCP_UDP_CKSUM;
+ flags |= TX_BD_FLAGS_TCP_UDP_CKSUM;
}
/* Transfer any VLAN tags to the bd. */
- if (m0->m_flags & M_VLANTAG)
- vlan_tag_flags |= (TX_BD_FLAGS_VLAN_TAG |
- (m0->m_pkthdr.ether_vtag << 16));
+ if (m0->m_flags & M_VLANTAG) {
+ flags |= TX_BD_FLAGS_VLAN_TAG;
+ vlan_tag = m0->m_pkthdr.ether_vtag;
+ }
/* Map the mbuf into DMAable memory. */
prod = sc->tx_prod;
@@ -4626,15 +4635,16 @@
txbd->tx_bd_haddr_lo = htole32(BCE_ADDR_LO(segs[i].ds_addr));
txbd->tx_bd_haddr_hi = htole32(BCE_ADDR_HI(segs[i].ds_addr));
txbd->tx_bd_mss_nbytes = htole16(segs[i].ds_len);
- txbd->tx_bd_vlan_tag_flags = htole16(vlan_tag_flags);
+ txbd->tx_bd_vlan_tag = htole16(vlan_tag);
+ txbd->tx_bd_flags = htole16(flags);
prod_bseq += segs[i].ds_len;
if (i == 0)
- txbd->tx_bd_vlan_tag_flags |=htole16(TX_BD_FLAGS_START);
+ txbd->tx_bd_flags |= htole16(TX_BD_FLAGS_START);
prod = NEXT_TX_BD(prod);
}
/* Set the END flag on the last TX buffer descriptor. */
- txbd->tx_bd_vlan_tag_flags |= htole16(TX_BD_FLAGS_END);
+ txbd->tx_bd_flags |= htole16(TX_BD_FLAGS_END);
DBRUN(BCE_INFO_SEND, bce_dump_tx_chain(sc, debug_prod, nseg));
@@ -4644,17 +4654,14 @@
__FUNCTION__, prod, chain_prod, prod_bseq);
/*
- * Ensure that the map for this transmission
+ * Ensure that the mbuf pointer for this transmission
* is placed at the array index of the last
* descriptor in this chain. This is done
* because a single map is used for all
* segments of the mbuf and we don't want to
- * delete the map before all of the segments
+ * unload the map before all of the segments
* have been freed.
*/
- sc->tx_mbuf_map[TX_CHAIN_IDX(sc->tx_prod)] =
- sc->tx_mbuf_map[chain_prod];
- sc->tx_mbuf_map[chain_prod] = map;
sc->tx_mbuf_ptr[chain_prod] = m0;
sc->used_tx_bd += nsegs;
@@ -4665,7 +4672,7 @@
DBRUN(BCE_VERBOSE_SEND, bce_dump_tx_mbuf_chain(sc, chain_prod, nsegs));
- /* prod still points the last used tx_bd at this point. */
+ /* prod points to the next free tx_bd at this point. */
sc->tx_prod = prod;
sc->tx_prod_bseq = prod_bseq;
@@ -4703,8 +4710,11 @@
"tx_prod_bseq = 0x%08X\n",
__FUNCTION__, tx_prod, tx_chain_prod, sc->tx_prod_bseq);
- /* Keep adding entries while there is space in the ring. */
- while (sc->tx_mbuf_ptr[tx_chain_prod] == NULL) {
+ /*
+ * Keep adding entries while there is space in the ring. We keep
+ * BCE_TX_SLACK_SPACE entries unused at all times.
+ */
+ while (sc->used_tx_bd < USABLE_TX_BD - BCE_TX_SLACK_SPACE) {
/* Check for any frames to send. */
IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head);
@@ -6153,9 +6163,10 @@
else
/* Normal tx_bd entry. */
BCE_PRINTF(sc, "tx_bd[0x%04X]: haddr = 0x%08X:%08X, nbytes = 0x%08X, "
- "flags = 0x%08X\n", idx,
+ "vlan tag= 0x%4X, "flags = 0x%04X\n", idx,
txbd->tx_bd_haddr_hi, txbd->tx_bd_haddr_lo,
- txbd->tx_bd_mss_nbytes, txbd->tx_bd_vlan_tag_flags);
+ txbd->tx_bd_mss_nbytes, txbd->tx_bd_vlan_tag,
+ txbd->tx_bd_flags);
}
==== //depot/projects/linuxolator/src/sys/dev/bce/if_bcereg.h#5 (text) ====
@@ -26,7 +26,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/sys/dev/bce/if_bcereg.h,v 1.9 2006/10/24 08:24:31 scottl Exp $
+ * $FreeBSD: src/sys/dev/bce/if_bcereg.h,v 1.10 2006/11/16 06:28:54 scottl Exp $
*/
#ifndef _BCE_H_DEFINED
@@ -737,7 +737,8 @@
u32 tx_bd_haddr_hi;
u32 tx_bd_haddr_lo;
u32 tx_bd_mss_nbytes;
- u32 tx_bd_vlan_tag_flags;
+ u16 tx_bd_flags;
+ u16 tx_bd_vlan_tag;
#define TX_BD_FLAGS_CONN_FAULT (1<<0)
#define TX_BD_FLAGS_TCP_UDP_CKSUM (1<<1)
#define TX_BD_FLAGS_IP_CKSUM (1<<2)
==== //depot/projects/linuxolator/src/sys/dev/em/if_em.c#9 (text+ko) ====
@@ -31,7 +31,7 @@
***************************************************************************/
-/*$FreeBSD: src/sys/dev/em/if_em.c,v 1.163 2006/11/09 16:00:18 glebius Exp $*/
+/*$FreeBSD: src/sys/dev/em/if_em.c,v 1.164 2006/11/15 20:04:56 jhb Exp $*/
#ifdef HAVE_KERNEL_OPTION_HEADERS
#include "opt_device_polling.h"
@@ -2200,7 +2200,12 @@
rman_get_bushandle(adapter->flash_mem);
}
- rid = 0x0;
+ val = pci_msi_count(dev);
+ if (val == 1 && pci_alloc_msi(dev, &val) == 0) {
+ rid = 1;
+ adapter->msi = 1;
+ } else
+ rid = 0;
adapter->res_interrupt = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
RF_SHAREABLE | RF_ACTIVE);
if (adapter->res_interrupt == NULL) {
@@ -2279,7 +2284,11 @@
device_t dev = adapter->dev;
if (adapter->res_interrupt != NULL)
- bus_release_resource(dev, SYS_RES_IRQ, 0, adapter->res_interrupt);
+ bus_release_resource(dev, SYS_RES_IRQ, adapter->msi ? 1 : 0,
+ adapter->res_interrupt);
+
+ if (adapter->msi)
+ pci_release_msi(dev);
if (adapter->res_memory != NULL)
bus_release_resource(dev, SYS_RES_MEMORY, PCIR_BAR(0),
==== //depot/projects/linuxolator/src/sys/dev/em/if_em.h#5 (text+ko) ====
@@ -31,7 +31,7 @@
***************************************************************************/
-/*$FreeBSD: src/sys/dev/em/if_em.h,v 1.55 2006/11/09 16:00:18 glebius Exp $*/
+/*$FreeBSD: src/sys/dev/em/if_em.h,v 1.56 2006/11/15 20:04:56 jhb Exp $*/
#ifndef _EM_H_DEFINED_
#define _EM_H_DEFINED_
@@ -288,6 +288,7 @@
struct callout tx_fifo_timer;
int watchdog_timer;
int io_rid;
+ int msi;
int if_flags;
struct mtx mtx;
int em_insert_vlan_header;
==== //depot/projects/linuxolator/src/sys/dev/isp/isp.c#4 (text+ko) ====
@@ -26,8 +26,9 @@
/*
* Machine and OS Independent (well, as best as possible)
- * code for the Qlogic ISP SCSI adapters.
+ * code for the Qlogic ISP SCSI and FC-SCSI adapters.
*/
+
/*
* Inspiration and ideas about this driver are from Erik Moe's Linux driver
* (qlogicisp.c) and Dave Miller's SBus version of same (qlogicisp.c). Some
@@ -42,7 +43,7 @@
#endif
#ifdef __FreeBSD__
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/isp/isp.c,v 1.129 2006/11/14 08:45:47 mjacob Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/isp/isp.c,v 1.131 2006/11/16 00:39:56 mjacob Exp $");
#include <dev/isp/isp_freebsd.h>
#endif
#ifdef __OpenBSD__
@@ -2231,9 +2232,8 @@
}
mbs.param[2] = portid >> 16;
mbs.param[3] = portid;
-
mbs.logval = MBLOGNONE;
- mbs.timeout = 250000;
+ mbs.timeout = 500000;
isp_mboxcmd(isp, &mbs);
switch (mbs.param[0]) {
@@ -2286,6 +2286,7 @@
mbs.param[1] = handle << 8;
}
mbs.logval = MBLOGNONE;
+ mbs.timeout = 100000;
isp_mboxcmd(isp, &mbs);
}
@@ -2314,6 +2315,7 @@
mbs.param[3] = DMA_WD0(fcp->isp_scdma);
mbs.param[6] = DMA_WD3(fcp->isp_scdma);
mbs.param[7] = DMA_WD2(fcp->isp_scdma);
+ mbs.timeout = 250000;
mbs.logval = MBLOGALL & ~MBOX_COMMAND_PARAM_ERROR;
if (dolock) {
FC_SCRATCH_ACQUIRE(isp);
@@ -2368,7 +2370,6 @@
}
}
mbs.logval = MBLOGALL & ~MBOX_COMMAND_PARAM_ERROR;
- mbs.timeout = 30000;
isp_mboxcmd(isp, &mbs);
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
return (wwn);
@@ -2928,7 +2929,13 @@
* which shift on a loop.
*/
if (tmp.node_wwn == 0 || tmp.port_wwn == 0 || tmp.portid == 0) {
- isp_prt(isp, ISP_LOGWARN, "bad pdb @ loop %d", handle);
+ int a, b, c;
+ a = (tmp.node_wwn == 0);
+ b = (tmp.port_wwn == 0);
+ c = (tmp.portid == 0);
+ isp_prt(isp, ISP_LOGWARN,
+ "bad pdb (%1d%1d%1d) @ handle 0x%x", a, b, c,
+ handle);
isp_dump_portdb(isp);
continue;
}
@@ -2996,7 +3003,7 @@
* decide what to do.
*/
isp_prt(isp, ISP_LOGSANCFG,
- "Loop Port 0x%06x at 0x%x changed",
+ "Loop Port 0x%02x at 0x%x changed",
tmp.portid, tmp.handle);
lp->state = FC_PORTDB_STATE_CHANGED;
lp->new_portid = tmp.portid;
@@ -3035,7 +3042,7 @@
lp->port_wwn = tmp.port_wwn;
lp->node_wwn = tmp.node_wwn;
isp_prt(isp, ISP_LOGSANCFG,
- "Loop Port 0x%06x at 0x%x is New Entry",
+ "Loop Port 0x%02x at 0x%x is New Entry",
tmp.portid, tmp.handle);
}
fcp->isp_loopstate = LOOP_LSCAN_DONE;
@@ -4855,7 +4862,8 @@
switch (etype) {
case RQSTYPE_RESPONSE:
XS_SET_STATE_STAT(isp, xs, sp);
- if (resp) {
+ if (resp && rlen >= 4 &&
+ resp[FCP_RSPNS_CODE_OFFSET] != 0) {
isp_prt(isp, ISP_LOGWARN,
"%d.%d FCP RESPONSE: 0x%x",
XS_TGT(xs), XS_LUN(xs),
@@ -6796,7 +6804,6 @@
MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_GET_FW_STATE;
mbs.logval = MBLOGALL;
- mbs.timeout = 100000;
isp_mboxcmd(isp, &mbs);
if (mbs.param[0] == MBOX_COMMAND_COMPLETE) {
fcp->isp_fwstate = mbs.param[1];
==== //depot/projects/linuxolator/src/sys/dev/isp/isp_library.c#4 (text) ====
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 1999-2006 by Matthew Jacob
+ * Copyright (c) 2006 by Matthew Jacob
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -32,7 +32,7 @@
#endif
#ifdef __FreeBSD__
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/isp/isp_library.c,v 1.7 2006/11/14 08:45:48 mjacob Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/isp/isp_library.c,v 1.9 2006/11/16 00:39:56 mjacob Exp $");
#include <dev/isp/isp_freebsd.h>
#endif
#ifdef __OpenBSD__
@@ -268,9 +268,9 @@
} else {
SNPRINTF(mb, sizeof (mb), "---");
}
- isp_prt(isp, ISP_LOGALL, "%d: %s al%d tgt %s %s 0x%06x =>%s"
- " 0x%06x; WWNN 0x%08x%08x WWPN 0x%08x%08x", i,
- dbs[lp->state], lp->autologin, mb,
+ isp_prt(isp, ISP_LOGALL, "%d: hdl 0x%x %s al%d tgt %s %s "
+ "0x%06x =>%s 0x%06x; WWNN 0x%08x%08x WWPN 0x%08x%08x", i,
+ lp->handle, dbs[lp->state], lp->autologin, mb,
roles[lp->roles], lp->portid,
roles[lp->new_roles], lp->new_portid,
(uint32_t) (lp->node_wwn >> 32),
==== //depot/projects/linuxolator/src/sys/dev/isp/ispmbox.h#3 (text+ko) ====
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/dev/isp/ispmbox.h,v 1.53 2006/11/02 03:21:31 mjacob Exp $ */
+/* $FreeBSD: src/sys/dev/isp/ispmbox.h,v 1.54 2006/11/16 00:39:56 mjacob Exp $ */
/*-
* Mailbox and Queue Entry Definitions for for Qlogic ISP SCSI adapters.
*
@@ -1347,4 +1347,30 @@
#define els_recv_dsd_a4732 inout.out._els_recv_dsd_a4732
#define els_recv_dsd_a6348 inout.out._els_recv_dsd_a6348
} els_t;
+
+/*
+ * A handy package structure for running FC-SCSI commands via RUN IOCB A64.
+ */
+typedef struct {
+ uint16_t handle;
+ uint16_t lun;
+ uint32_t portid;
+ uint32_t timeout;
+ union {
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list