[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

patch for L-Router



L-Router用のパッチ(暫定)です。

実装方法は適当なので、本家にmergeする前にはもっとブラッシュアップする必
要がありますが、取りあえずの叩き台にはなると思います。

末尾のshell archiveを展開すると、以下の4つのファイルができます。

ファイル	場所			内容
--------------------------------------------------------------------------
LROUTER		arch/hpcmips/conf	L-Router用コンフィグファイル
i82557.c.diff	dev/ic			EEPROMのフォーマットに対応する変更
locore.S.diff	arch/mips/mips		ROM用いんちきブートローダ
lrouter.diff	arch/hpcmips		L-Router用の変更(適当)

コンフィグファイル以外はそれぞれの場所でpatchを適用してください。

[変更内容の概略]

1) i82557.c.diff

EEPROMのフォーマットが特殊なので、それに対応するための変更です。実行時に
見分ける方法を思い付かなかったので、#ifdefになっています。

FlashROMに書かれているlinuxが変なMACアドレスで動いてもかまわないのであれ
ば、EEPROMを標準的なフォーマットに書き直してしまうという手もありますが......

2) locore.S.diff

FlashROMからRAMにカーネルをコピーして実行するだけのいんちきブートローダ
をカーネルの先頭に仕込んでみました。ブートローダの分離は検討中です。

3) lrouter.diff

arch/hpcmips以下のファイルに対する変更です。

conf/files.hpcmips	VRC4173の有無を見分けたかったのでneed-flagを追加
hpcmips/machdep.c	bootinfoが渡されなかった場合のNULLポインタ参照対
			策
include/pci_machdep.h	IDEコントローラがcompatibility modeに設定されて
			いるため(?)それに対応
vr/rtc.c		debug printfのフォーマット修正
vr/rtcreg.h		RTCの設定値がCEと異なるため、YBASEとEPOCHYEARを
			変更できるように修正
vr/vr.c			メモリのイメージをチェックすると32MB全部がprobe
			されなかったのでイメージを無視できるように修正
vr/vrpciu.c		VRC4173がなかったらL-Routerであると決め付けてあ
			れこれ変更(汚い)。L-Router固有の処理については
			#ifdef LROUTERも併用。L-Routerの場合はPCI memory
			spaceを無効にしている。

vrpciu.cに対する変更点が一番汚い部分です。PCIデバイスの割り込み信号の接
続関係はプラットフォーム毎に異なるため、これを吸収できるような仕組みが必
要であると思われます。また、fxpドライバがPCI memory space経由では動作し
なかったため、memory spaceを無効にしています。

OHCIのようにmemory spaceがないと動作しない(と思われる)デバイスと、fxpの
ようにI/O spaceでないと動作しないデバイスを共存させることができるかどう
かは未検討です。

[既知の問題]

IDEドライバはDMAを有効にするとなぜかlost interruptになって動きません。現
在はコンフィグファイルでDMAを禁止しています。PIOで使う分には問題ないよう
です。

篠原

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  LROUTER i82557.c.diff locore.S.diff lrouter.diff
# Wrapped by shin@lachesis on Sun Dec 23 11:53:51 2001
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'LROUTER' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'LROUTER'\"
else
echo shar: Extracting \"'LROUTER'\" \(5699 characters\)
sed "s/^X//" >'LROUTER' <<'END_OF_FILE'
X#
X# 	$NetBSD: MPC303,v 1.4 2001/11/21 11:28:09 uch Exp $
X# 	From: NetBSD: GENERIC,v 1.91 2001/05/06 14:25:16 takemura Exp
X#
X# Kernel configuration file for Victor MP-C303; enami's test machine.
X#
X
Xinclude		"arch/hpcmips/conf/std.hpcmips"
X
Xoptions		LROUTER
Xoptions		BOOT_STANDALONE
Xoptions		SPEC_PLATFORM=platid_mask_MACH_LASER5_L_BOARD
X
Xmaxusers	16
X
Xoptions 	MIPS3			# R4000/R4400/R4600 CPUs
X
X# Support for specific models of H/PC MIPS
Xoptions 	MIPS3_4100		# VR4100 core
Xoptions 	VR41XX			# NEC VR41xx series
Xoptions 	VR4122			# NEC VR4122
Xoptions 	NOFPU			# No FPU
Xoptions 	SOFTFLOAT		# emulate FPU insn
Xoptions 	MIPS3_L2CACHE_ABSENT
X
X# Standard system options
Xoptions 	DDB			# in-kernel debugger
X#options 	DDB_ONPANIC=0		# don't enter debugger on panic
X#options 	KGDB			# remote debugger
Xoptions 	DIAGNOSTIC		# extra kernel debugging checks
X#options 	DEBUG			# extra kernel debugging support
X#options 	VRGIUDEBUG_CONF=2	# debug GIU intr
Xoptions 	KTRACE			# system call tracing support
Xoptions 	MSGBUFSIZE=16384	# dmesg buffer size
X
X## UVM options.
X#options 	UVM_PAGE_TRKOWN
X#options 	UVMHIST
X#options 	UVMHIST_PRINT	# Loud!
X
X#options 	SCSIVERBOSE		# human readable SCSI error messages
X
Xoptions 	YBASE=2000
Xoptions 	EPOCHYEAR=1970
Xoptions 	VR_IGNORE_MEMIMG	# ignore memory image
X
X#options 	RTC_OFFSET=0	# hardware clock is this many mins. west of GMT
X#options 	RTC_OFFSET=-540		# JST-9
X#options 	RTC_OFFSET=480		# PST8
X					# In NO RTC_OFFSET , inherit RTC_OFFSET
X					# from Windows CE.
Xoptions 	NTP			# network time protocol
X#options 	UCONSOLE		# users can redirect console (unsafe)
X
X#options 	WINCE_DEFAULT_SETTING	# Debugging use
X#options 	DUMP_GIU_LEVEL2_INTR	# Debugging use
X
X#options 	SYSCALL_DEBUG		# for debug
X
X#options 	VRRTCDEBUG
X#options 	VRRTCDEBUG_CONF=1
X
X# Filesystem options
Xfile-system 	FFS		# fast filesystem with user and group quotas
Xfile-system 	MFS		# memory-based filesystem
Xfile-system 	NFS		# Sun NFS-compatible filesystem (client)
X#file-system	LFS		# Log-based filesystem (still experimental)
Xfile-system 	CD9660		# ISO 9660 + Rock Ridge file system
Xfile-system 	MSDOSFS		# MS-DOS file system
X#file-system 	FDESC		# /dev/fd
Xfile-system 	KERNFS		# /kern (kernel informational filesystem)
X#file-system 	NULLFS		# loopback file system
X#file-system 	OVERLAY		# overlay file system
X#file-system 	PORTAL		# portal filesystem (still experimental)
Xfile-system 	PROCFS		# /proc
X#file-system 	UMAPFS		# NULLFS + uid and gid remapping
Xfile-system 	UNION
X
Xoptions 	NFSSERVER	# Sun NFS-compatible filesystem (server)
Xoptions 	SOFTDEP		# FFS soft updates support.
X#options 	QUOTA		# UFS quotas
Xoptions 	VNODE_OP_NOINLINE # don't inline vnode op calls
X
X# Networking options
X#options 	GATEWAY		# IP packet forwarding
Xoptions 	INET		# IP + ICMP + TCP + UDP
Xoptions 	INET6		# IPV6
X#options 	IPSEC		# IP security
X#options 	IPSEC_ESP	# IP security (encryption part; define w/ IPSEC)
X#options 	IPSEC_DEBUG	# debug for IP security
X#options 	MROUTING	# Multicast routing support
X#options 	ISO		# OSI networking
X#options 	TPIP		# TPIP
X#options 	EON		# OSI tunneling over IP
X#options 	CCITT,LLC,HDLC	# X.25
X
X# NetBSD backwards compatibility
Xoptions 	COMPAT_43
X
Xoptions 	NFS_BOOT_DHCP
X
Xconfig		netbsd		root on ? type ?
X#config		netbsd		root on ? type nfs
X
X
X# temporally power management
Xhpcapm0	at mainbus0			# power management
Xapmdev0	at hpcapm0			# APM
X
Xvrip*	at mainbus0
Xvrbcu*	at vrip? addr 0x0f000000 size 0x20
Xvrcmu*	at vrip? addr 0x0f000060 size 0x20
Xvrrtc*	at vrip? addr 0x0f000100 size 0x20 intr 2
X
Xoptions 	CONSPEED=115200
Xcom*	at vrip? addr 0x0f000800 size 0x20 intr 9 pwctl PWCTL_COM0
Xvrgiu*	at vrip? addr 0x0f000140 size 0x20 intr 8
Xvrpmu*	at vrip? addr 0x0f0000c0 size 0x20 intr 1 # power switch
X#vrpiu*	at vrip? addr 0x0b000120 size 0x1a0 intr 5
X#vrled*	at vrip? addr 0x0f000180 size 0x10 intr 17
Xvrpciu*	at vrip? addr 0x0f000c00 size 0x200 intr 22
X
X# PCI bus support
Xoptions 	MIIVERBOSE	# verbose PHY autoconfig messages
Xoptions 	PCIVERBOSE
Xpci*	at vrpciu?
X
Xoptions 	FXP_EEPROM_SPEC_FORMAT
X# PCI network interfaces
Xfxp*	at pci? dev ? function ? # Intel EtherExpress PRO 10+/100B
X
X# MII/PHY support
Xinphy*	at mii? phy ?			# Intel 82555 PHYs
Xukphy*	at mii? phy ?			# generic unknown PHYs
X
X# IDE and related devices
Xpciide* at pci? dev ? function ? flags 0x0000
X
X# IDE drives
Xwd*	at pciide? channel ? drive ? flags 0x0ff0
X
X# ATAPI bus support
Xatapibus* at pciide? channel ?
X
X# ATAPI devices
Xcd*	at atapibus? drive ? flags 0x0ff0 # ATAPI CD-ROM drives
Xsd*	at atapibus? drive ? flags 0x0ff0 # ATAPI disk drives
Xst*	at atapibus? drive ? flags 0x0ff0 # ATAPI tape drives
X
Xpseudo-device	loop		1	# network loopback
Xpseudo-device	ppp		2	# serial-line IP ports
Xpseudo-device	pty			# pseudo-terminals
Xpseudo-device	bpfilter	16	# packet filter ports
Xpseudo-device	ipfilter		# IP filter, NAT
X
Xpseudo-device	vnd		4	# virtual disk ick
X#pseudo-device	ccd		4	# concatenated disks
Xpseudo-device	rnd			# /dev/random and in-kernel generator
X
X#pseudo-device	biconsdev	1	# build-in console device
X#pseudo-device	wsmux			# mouse & keyboard multiplexor
X#options 	MEMORY_DISK_HOOKS
X#options 	MEMORY_DISK_IS_ROOT	# force root on memory disk
X#options 	MEMORY_DISK_SERVER=0	# no userspace memory disk support
X#options 	MEMORY_DISK_DYNAMIC	# fs image don't exist in data section.
Xpseudo-device	md		1	# memory disk device (ramdisk)
X
X#pseudo-device	raid		4	# RAIDframe disk driver
X#options 	RAID_AUTOCONFIG		# auto-configuration of RAID components
X
X# for IPv6
Xpseudo-device	gif		4	# IPv[46] over IPv[46] tunnel (RFC1933)
X#pseudo-device	faith		1	# IPv[46] tcp relay translation i/f
X#pseudo-device	stf		1	# 6to4 IPv6 over IPv4 encapsulation
X
X## IEEE 802.1Q Virtual LAN encapsulation, see vlan(4).
Xpseudo-device	vlan
END_OF_FILE
if test 5699 -ne `wc -c <'LROUTER'`; then
    echo shar: \"'LROUTER'\" unpacked with wrong size!
fi
# end of 'LROUTER'
fi
if test -f 'i82557.c.diff' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'i82557.c.diff'\"
else
echo shar: Extracting \"'i82557.c.diff'\" \(852 characters\)
sed "s/^X//" >'i82557.c.diff' <<'END_OF_FILE'
XIndex: i82557.c
X===================================================================
XRCS file: /cvsroot/syssrc/sys/dev/ic/i82557.c,v
Xretrieving revision 1.61
Xdiff -u -r1.61 i82557.c
X--- i82557.c	2001/11/13 13:14:38	1.61
X+++ i82557.c	2001/12/16 02:33:54
X@@ -570,6 +570,17 @@
X 	/*
X 	 * Read MAC address.
X 	 */
X+#ifdef FXP_EEPROM_SPEC_FORMAT
X+	fxp_read_eeprom(sc, &myea[0], 0, 1);
X+	fxp_read_eeprom(sc, &myea[1], 2, 1);
X+	fxp_read_eeprom(sc, &myea[2], 4, 1);
X+	enaddr[0] = myea[0] & 0xff;
X+	enaddr[1] = myea[0] >> 8;
X+	enaddr[2] = myea[1] & 0xff;
X+	enaddr[3] = myea[1] >> 8;
X+	enaddr[4] = myea[2] & 0xff;
X+	enaddr[5] = myea[2] >> 8;
X+#else
X 	fxp_read_eeprom(sc, myea, 0, 3);
X 	enaddr[0] = myea[0] & 0xff;
X 	enaddr[1] = myea[0] >> 8;
X@@ -577,6 +588,7 @@
X 	enaddr[3] = myea[1] >> 8;
X 	enaddr[4] = myea[2] & 0xff;
X 	enaddr[5] = myea[2] >> 8;
X+#endif
X }
X 
X /*
END_OF_FILE
if test 852 -ne `wc -c <'i82557.c.diff'`; then
    echo shar: \"'i82557.c.diff'\" unpacked with wrong size!
fi
# end of 'i82557.c.diff'
fi
if test -f 'locore.S.diff' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'locore.S.diff'\"
else
echo shar: Extracting \"'locore.S.diff'\" \(1022 characters\)
sed "s/^X//" >'locore.S.diff' <<'END_OF_FILE'
XIndex: locore.S
X===================================================================
XRCS file: /cvsroot/syssrc/sys/arch/mips/mips/locore.S,v
Xretrieving revision 1.129
Xdiff -u -r1.129 locore.S
X--- locore.S	2001/12/08 11:15:43	1.129
X+++ locore.S	2001/12/16 04:55:58
X@@ -91,6 +91,42 @@
X 	.globl	start
X 	.globl	_C_LABEL(kernel_text)		# libkvm refers this
X start:
X+#ifdef LROUTER	/*XXX:shin*/
X+1:	bal	2f
X+	nop
X+2:	subu	a0, ra, 8
X+	la	a1, kernel_text
X+	la	t2, start
X+	subu	a1, t2
X+	addu	a0, a1
X+	la	a1, kernel_text
X+	la	t3, edata
X+	or	a1, MIPS_KSEG1_START
X+	or	t3, MIPS_KSEG1_START
X+3:
X+	lw	v0, 0(a0)
X+	sw	v0, 0(a1)
X+	addu	a0, 4
X+	bltu	a1, t3, 3b
X+	addu	a1, 4				# BDSLOT
X+
X+	lw	a0, argc
X+	la	a1, argv
X+	move	a2, zero
X+	move	a3, zero
X+	la	t9, kernel_text
X+	jr	t9
X+	nop
X+
X+	.data
X+argc:	.word	2
X+argv:	.word	argv0
X+	.word	argv1
X+	.word	0
X+argv0:	.asciiz	"netbsd"
X+argv1:	.asciiz	"h"
X+	.text
X+#endif	/* LROUTER */
X _C_LABEL(kernel_text):
X #if defined(MIPS3) & !defined(MIPS1)
X 	/* keep firmware exception handler until we hook. */
END_OF_FILE
if test 1022 -ne `wc -c <'locore.S.diff'`; then
    echo shar: \"'locore.S.diff'\" unpacked with wrong size!
fi
# end of 'locore.S.diff'
fi
if test -f 'lrouter.diff' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'lrouter.diff'\"
else
echo shar: Extracting \"'lrouter.diff'\" \(9977 characters\)
sed "s/^X//" >'lrouter.diff' <<'END_OF_FILE'
XIndex: conf/files.hpcmips
X===================================================================
XRCS file: /cvsroot/syssrc/sys/arch/hpcmips/conf/files.hpcmips,v
Xretrieving revision 1.64
Xdiff -u -r1.64 files.hpcmips
X--- conf/files.hpcmips	2001/11/28 10:21:14	1.64
X+++ conf/files.hpcmips	2001/12/16 02:08:27
X@@ -182,7 +182,7 @@
X 
X device vrc4173bcu: vrc4173if
X attach vrc4173bcu at pci
X-file arch/hpcmips/vr/vrc4173bcu.c		vrc4173bcu
X+file arch/hpcmips/vr/vrc4173bcu.c		vrc4173bcu needs-flag
X 
X device vrc4173cmu
X attach vrc4173cmu at vrc4173if
XIndex: hpcmips/machdep.c
X===================================================================
XRCS file: /cvsroot/syssrc/sys/arch/hpcmips/hpcmips/machdep.c,v
Xretrieving revision 1.64
Xdiff -u -r1.64 machdep.c
X--- hpcmips/machdep.c	2001/11/10 06:56:35	1.64
X+++ hpcmips/machdep.c	2001/12/16 02:19:53
X@@ -247,6 +247,10 @@
X #error see platid_mask.c for platid_mask_MACH_xxx_yyy.
X #else
X 	memcpy(&platid, &SPEC_PLATFORM, sizeof(platid));
X+	if (bi == NULL) {
X+		memset(&bi_copy, 0, sizeof(struct bootinfo));
X+		bootinfo = &bi_copy;
X+	}
X #endif
X #endif /* defined(BOOT_STANDALONE) && defined(SPEC_PLATFORM) */
X 	/*
XIndex: include/pci_machdep.h
X===================================================================
XRCS file: /cvsroot/syssrc/sys/arch/hpcmips/include/pci_machdep.h,v
Xretrieving revision 1.1
Xdiff -u -r1.1 pci_machdep.h
X--- include/pci_machdep.h	2001/06/13 07:32:47	1.1
X+++ include/pci_machdep.h	2001/12/16 02:01:51
X@@ -35,6 +35,8 @@
X  */
X #define	__PCI_BUS_DEVORDER
X 
X+#define	__HAVE_PCIIDE_MACHDEP_COMPAT_INTR_ESTABLISH
X+
X /*
X  * Types provided to machine-independent PCI code
X  */
XIndex: vr/rtc.c
X===================================================================
XRCS file: /cvsroot/syssrc/sys/arch/hpcmips/vr/rtc.c,v
Xretrieving revision 1.10
Xdiff -u -r1.10 rtc.c
X--- vr/rtc.c	2001/09/30 11:24:07	1.10
X+++ vr/rtc.c	2001/12/16 02:02:06
X@@ -226,7 +226,7 @@
X 	timeh = (timeh << 16) | bus_space_read_2(iot, ioh, ETIME_M_REG_W);
X 	timel = bus_space_read_2(iot, ioh, ETIME_L_REG_W);
X 
X-	DPRINTF(("clock_get: timeh %08lx timel %08lx\n", timeh, timel));
X+	DPRINTF(("clock_get: timeh %08x timel %08x\n", timeh, timel));
X 
X 	cvt_timehl_ymdhms(timeh, timel, dt);
X 
X@@ -313,7 +313,7 @@
X 		sec2 = LEAPYEAR4(year)?SEC2YR+SEC2DAY:SEC2YR;
X 	}
X 
X-	DPRINTF(("cvt_timehl_ymdhms: timeh %08lx year %ld yrref %ld\n", 
X+	DPRINTF(("cvt_timehl_ymdhms: timeh %08x year %d yrref %d\n", 
X 	    timeh, year, sec2));
X 
X 	month = 0; /* now month is 0..11 */
X@@ -327,14 +327,14 @@
X 	}
X 	month +=1; /* now month is 1..12 */
X 
X-	DPRINTF(("cvt_timehl_ymdhms: timeh %08lx month %ld mref %ld\n", 
X+	DPRINTF(("cvt_timehl_ymdhms: timeh %08x month %d mref %d\n", 
X 	    timeh, month, sec2));
X 
X 	sec2 = SEC2DAY;
X 	date = timeh/sec2+1; /* date is 1..31 */
X 	timeh -= (date-1)*sec2;
X 
X-	DPRINTF(("cvt_timehl_ymdhms: timeh %08lx date %ld dref %ld\n", 
X+	DPRINTF(("cvt_timehl_ymdhms: timeh %08x date %d dref %d\n", 
X 	    timeh, date, sec2));
X 
X 	sec2 = SEC2HOUR;
X@@ -347,7 +347,7 @@
X 
X 	sec = timeh*2 + timel/ETIME_L_HZ;	
X 
X-	DPRINTF(("cvt_timehl_ymdhms: hour %ld min %ld sec %ld\n", hour, min, sec));
X+	DPRINTF(("cvt_timehl_ymdhms: hour %d min %d sec %d\n", hour, min, sec));
X 
X 	if (dt) {
X 		dt->dt_year	= year - YBASE; /* base 1900 */
XIndex: vr/rtcreg.h
X===================================================================
XRCS file: /cvsroot/syssrc/sys/arch/hpcmips/vr/rtcreg.h,v
Xretrieving revision 1.5
Xdiff -u -r1.5 rtcreg.h
X--- vr/rtcreg.h	2001/09/30 11:24:07	1.5
X+++ vr/rtcreg.h	2001/12/16 02:02:18
X@@ -47,10 +47,14 @@
X #define	MREF		1
X #define	DREF		1
X 
X+#ifndef YBASE
X #define YBASE		1900
X+#endif
X 
X #define EPOCHOFF	0			/* epoch offset */
X+#ifndef EPOCHYEAR
X #define EPOCHYEAR	1850	/* XXX */	/* WINCE epoch year */
X+#endif
X #define EPOCHMONTH	1			/* WINCE epoch month of year */
X #define EPOCHDATE	1			/* WINCE epoch date of month */
X 
XIndex: vr/vr.c
X===================================================================
XRCS file: /cvsroot/syssrc/sys/arch/hpcmips/vr/vr.c,v
Xretrieving revision 1.32
Xdiff -u -r1.32 vr.c
X--- vr/vr.c	2001/11/18 08:19:41	1.32
X+++ vr/vr.c	2001/12/22 08:22:03
X@@ -234,9 +234,11 @@
X 		if (badaddr(page, 4))
X 			goto bad;
X 
X+#if !defined(VR_IGNORE_MEMIMG)
X 		/* stop memory probing at first memory image */
X 		if (bcmp(page, (void *)MIPS_PHYS_TO_KSEG0(0), 128) == 0)
X 			return;
X+#endif
X 
X 		*(volatile int *)(page+0) = 0xa5a5a5a5;
X 		*(volatile int *)(page+4) = 0x5a5a5a5a;
XIndex: vr/vrpciu.c
X===================================================================
XRCS file: /cvsroot/syssrc/sys/arch/hpcmips/vr/vrpciu.c,v
Xretrieving revision 1.2
Xdiff -u -r1.2 vrpciu.c
X--- vr/vrpciu.c	2001/11/22 14:24:33	1.2
X+++ vr/vrpciu.c	2001/12/16 02:24:54
X@@ -35,11 +35,18 @@
X #include <machine/bus_dma_hpcmips.h>
X 
X #include <dev/pci/pcivar.h>
X+#ifdef LROUTER
X+#include <dev/pci/pciidereg.h>
X+#include <dev/pci/pciidevar.h>
X+#endif
X 
X #include <hpcmips/vr/icureg.h>
X #include <hpcmips/vr/vripvar.h>
X #include <hpcmips/vr/vrpciureg.h>
X+#include "vrc4173bcu.h"
X+#if NVRC4173BCU > 0
X #include <hpcmips/vr/vrc4173bcuvar.h>
X+#endif
X 
X #include "pci.h"
X 
X@@ -49,6 +56,17 @@
X #define	DPRINTF(args)
X #endif
X 
X+#if NVRC4173BCU == 0
X+int	lrouter_pci_bus_devorder(pci_chipset_tag_t, int, char *);
X+int	lrouter_pci_intr_map(struct pci_attach_args *, pci_intr_handle_t *);
X+const char *
X+	lrouter_pci_intr_string(pci_chipset_tag_t, pci_intr_handle_t);
X+const struct evcnt *
X+	lrouter_pci_intr_evcnt(pci_chipset_tag_t, pci_intr_handle_t);
X+void	*pciide_machdep_compat_intr_establish(struct device *,
X+	    struct pci_attach_args *, int, int (*)(void *), void *);
X+#endif
X+
X struct vrpciu_softc {
X 	struct device sc_dev;
X 
X@@ -246,14 +264,24 @@
X 	pc->pc_dev = &sc->sc_dev;
X 	pc->pc_attach_hook = vrpciu_attach_hook;
X 	pc->pc_bus_maxdevs = vrpciu_bus_maxdevs;
X+#if NVRC4173BCU > 0
X 	pc->pc_bus_devorder = vrc4173bcu_pci_bus_devorder;
X+#else
X+	pc->pc_bus_devorder = lrouter_pci_bus_devorder;
X+#endif
X 	pc->pc_make_tag = vrpciu_make_tag;
X 	pc->pc_decompose_tag = vrpciu_decompose_tag;
X 	pc->pc_conf_read = vrpciu_conf_read;
X 	pc->pc_conf_write = vrpciu_conf_write;
X+#if NVRC4173BCU > 0
X 	pc->pc_intr_map = vrc4173bcu_pci_intr_map;
X 	pc->pc_intr_string = vrc4173bcu_pci_intr_string;
X 	pc->pc_intr_evcnt = vrc4173bcu_pci_intr_evcnt;
X+#else
X+	pc->pc_intr_map = lrouter_pci_intr_map;
X+	pc->pc_intr_string = lrouter_pci_intr_string;
X+	pc->pc_intr_evcnt = lrouter_pci_intr_evcnt;
X+#endif
X 	pc->pc_intr_establish = vrpciu_intr_establish;
X 	pc->pc_intr_disestablish = vrpciu_intr_disestablish;
X 	pc->pc_vrcintr_establish = vrpciu_vrcintr_establish;
X@@ -293,8 +321,13 @@
X 	pba.pba_memt = sc->sc_iot;
X 	pba.pba_dmat = &hpcmips_default_bus_dma_tag.bdt;
X 	pba.pba_bus = 0;
X+#ifdef LROUTER
X+	/* user I/O access only */
X+	pba.pba_flags = PCI_FLAGS_IO_ENABLED;
X+#else
X 	pba.pba_flags = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED |
X 	    PCI_FLAGS_MRL_OKAY;
X+#endif
X 	pba.pba_pc = pc;
X 
X 	config_found(self, &pba, vrpciu_print);
X@@ -416,21 +449,34 @@
X vrpciu_intr_establish(pci_chipset_tag_t pc, pci_intr_handle_t ih, int level,
X     int (*func)(void *), void *arg)
X {
X+#if NVRC4173BCU > 0
X 	struct vrpciu_softc *sc = (struct vrpciu_softc *)pc->pc_dev;
X+#endif
X 
X 	if (ih == -1)
X 		return (NULL);
X-	DPRINTF(("vrpciu_intr_establish: %p\n", sc));
X+#if NVRC4173BCU > 0
X+	DPRINTF(("vrpciu_intr_establish: %p %d\n", sc, (int)ih));
X 	return (vrc4173bcu_intr_establish(sc->sc_bcu, ih, func, arg));
X+#else
X+	return pci_vrcintr_establish(pc, ih, func, arg);
X+	return NULL;
X+#endif
X }
X 
X void
X vrpciu_intr_disestablish(pci_chipset_tag_t pc, void *cookie)
X {
X+#if NVRC4173BCU > 0
X 	struct vrpciu_softc *sc = (struct vrpciu_softc *)pc->pc_dev;
X+#endif
X 
X+#if NVRC4173BCU > 0
X 	DPRINTF(("vrpciu_intr_disestablish: %p\n", sc));
X 	vrc4173bcu_intr_disestablish(sc->sc_bcu, cookie);
X+#else
X+	return pci_vrcintr_disestablish(pc, cookie);
X+#endif
X }
X 
X void *
X@@ -442,9 +488,14 @@
X 	void *ih;
X 
X 	sc->sc_bcu = arg;
X-	ih = hpcio_intr_establish(vsc->sc_gpio_chips[VRIP_IOCHIP_VRGIU],
X-	    port, HPCIO_INTR_LEVEL | HPCIO_INTR_LOW | HPCIO_INTR_HOLD,
X-	    func, arg);
X+	if (port & 0x100)
X+		ih = hpcio_intr_establish(
X+		    vsc->sc_gpio_chips[VRIP_IOCHIP_VRGIU],
X+		    port & ~0x100, HPCIO_INTR_LEVEL_HIGH_THROUGH, func, arg);
X+	else
X+		ih = hpcio_intr_establish(
X+		    vsc->sc_gpio_chips[VRIP_IOCHIP_VRGIU],
X+		    port, HPCIO_INTR_LEVEL_LOW_THROUGH, func, arg);
X 
X 	return (ih);
X }
X@@ -458,3 +509,73 @@
X 	return (vrip_intr_disestablish(vsc->sc_gpio_chips[VRIP_IOCHIP_VRGIU],
X 	    ih));
X }
X+
X+#if NVRC4173BCU == 0
X+int
X+lrouter_pci_bus_devorder(pci_chipset_tag_t pc, int busno, char *devs)
X+{
X+	int i;
X+
X+	for (i = 0; i < 32; i++)
X+		*devs++ = i;
X+	return i;
X+}
X+
X+int
X+lrouter_pci_intr_map(struct pci_attach_args *pa, pci_intr_handle_t *ihp)
X+{
X+	pci_chipset_tag_t pc = pa->pa_pc;
X+	pcitag_t intrtag = pa->pa_intrtag;
X+	int bus, dev, func;
X+#ifdef DEBUG
X+	int line = pa->pa_intrline;
X+	int pin = pa->pa_intrpin;
X+#endif
X+
X+	pci_decompose_tag(pc, intrtag, &bus, &dev, &func);
X+	DPRINTF(("%s(%d, %d, %d): line = %d, pin = %d\n", pc->pc_dev->dv_xname,
X+	    bus, dev, func, line, pin));
X+
X+	*ihp = -1;
X+	switch (dev) {
X+	case 0:			/* i82559 #0 LAN(eth0) */
X+		*ihp = 12;
X+		break;
X+	case 1:			/* i82559 #1 WAN(eth1) */
X+		*ihp = 13;
X+		break;
X+	case 16:		/* M1543C/M5229 (IDE controller) */
X+		*ihp = 11 + 0x100;
X+		break;
X+	}
X+
X+	return (*ihp == -1);
X+}
X+
X+const char *
X+lrouter_pci_intr_string(pci_chipset_tag_t pc, pci_intr_handle_t ih)
X+{
X+	static char irqstr[8 + sizeof("PCI intr")];
X+
X+	snprintf(irqstr, sizeof(irqstr), "GPIO %x", (int)ih);
X+	return (irqstr);
X+}
X+
X+const struct evcnt *
X+lrouter_pci_intr_evcnt(pci_chipset_tag_t pc, pci_intr_handle_t ih)
X+{
X+
X+	/* XXX for now, no evcnt parent reported */
X+	return (NULL);
X+}
X+
X+void *
X+pciide_machdep_compat_intr_establish(struct device *devp,
X+    struct pci_attach_args *pa, int chan, int (*func)(void *), void *arg)
X+{
X+	pci_intr_handle_t ih;
X+
X+	lrouter_pci_intr_map(pa, &ih);
X+	return pci_vrcintr_establish(pa->pa_pc, ih, func, arg);
X+}
X+#endif
END_OF_FILE
if test 9977 -ne `wc -c <'lrouter.diff'`; then
    echo shar: \"'lrouter.diff'\" unpacked with wrong size!
fi
# end of 'lrouter.diff'
fi
echo shar: End of shell archive.
exit 0