svn commit: r209923 - in projects/ppc64: lib share/mk sys/arm/conf sys/arm/include sys/boot/fdt/dts sys/boot/uboot/common sys/conf sys/dev/bwi sys/dev/cfi sys/dev/fdt sys/dev/pci sys/dev/quicc sys/...

Nathan Whitehorn nwhitehorn at FreeBSD.org
Mon Jul 12 01:09:00 UTC 2010


Author: nwhitehorn
Date: Mon Jul 12 01:08:59 2010
New Revision: 209923
URL: http://svn.freebsd.org/changeset/base/209923

Log:
  IFC @ 209922
  
  One last merge back to this branch now that all userland components are
  in HEAD. Remaining things to merge:
  
  - Build system tweaks and config(8) update (pending review)
  - Kernel sources

Added:
  projects/ppc64/sys/dev/cfi/cfi_bus_fdt.c
     - copied unchanged from r209922, head/sys/dev/cfi/cfi_bus_fdt.c
  projects/ppc64/sys/dev/fdt/fdt_powerpc.c
     - copied unchanged from r209922, head/sys/dev/fdt/fdt_powerpc.c
  projects/ppc64/sys/dev/quicc/quicc_bfe_fdt.c
     - copied unchanged from r209922, head/sys/dev/quicc/quicc_bfe_fdt.c
  projects/ppc64/sys/dev/tsec/if_tsec_fdt.c
     - copied unchanged from r209922, head/sys/dev/tsec/if_tsec_fdt.c
  projects/ppc64/sys/powerpc/include/fdt.h
     - copied unchanged from r209922, head/sys/powerpc/include/fdt.h
  projects/ppc64/sys/powerpc/mpc85xx/ds1553_bus_fdt.c
     - copied unchanged from r209922, head/sys/powerpc/mpc85xx/ds1553_bus_fdt.c
  projects/ppc64/sys/powerpc/mpc85xx/openpic_fdt.c
     - copied unchanged from r209922, head/sys/powerpc/mpc85xx/openpic_fdt.c
  projects/ppc64/sys/powerpc/mpc85xx/pci_fdt.c
     - copied unchanged from r209922, head/sys/powerpc/mpc85xx/pci_fdt.c
Deleted:
  projects/ppc64/sys/arm/include/bootinfo.h
  projects/ppc64/sys/dev/cfi/cfi_bus_lbc.c
  projects/ppc64/sys/dev/quicc/quicc_bfe_ocp.c
  projects/ppc64/sys/dev/tsec/if_tsec_ocp.c
  projects/ppc64/sys/dev/uart/uart_bus_ocp.c
  projects/ppc64/sys/powerpc/include/bootinfo.h
  projects/ppc64/sys/powerpc/include/ocpbus.h
  projects/ppc64/sys/powerpc/mpc85xx/ds1553_bus_lbc.c
  projects/ppc64/sys/powerpc/mpc85xx/ocpbus.c
  projects/ppc64/sys/powerpc/mpc85xx/ocpbus.h
  projects/ppc64/sys/powerpc/mpc85xx/opic.c
  projects/ppc64/sys/powerpc/mpc85xx/pci_ocp.c
Modified:
  projects/ppc64/lib/Makefile
  projects/ppc64/sys/arm/include/metadata.h
  projects/ppc64/sys/boot/fdt/dts/mpc8555cds.dts
  projects/ppc64/sys/boot/uboot/common/metadata.c
  projects/ppc64/sys/conf/Makefile.powerpc
  projects/ppc64/sys/conf/files.powerpc
  projects/ppc64/sys/conf/options.powerpc
  projects/ppc64/sys/dev/bwi/if_bwi_pci.c
  projects/ppc64/sys/dev/fdt/fdt_common.c
  projects/ppc64/sys/dev/fdt/fdt_pci.c
  projects/ppc64/sys/dev/fdt/simplebus.c
  projects/ppc64/sys/dev/pci/pcireg.h
  projects/ppc64/sys/dev/sec/sec.c
  projects/ppc64/sys/dev/tsec/if_tsec.c
  projects/ppc64/sys/dev/tsec/if_tsec.h
  projects/ppc64/sys/dev/uart/uart_cpu_powerpc.c
  projects/ppc64/sys/dev/usb/wlan/if_run.c
  projects/ppc64/sys/kern/kern_tc.c
  projects/ppc64/sys/kern/vfs_bio.c
  projects/ppc64/sys/powerpc/booke/locore.S
  projects/ppc64/sys/powerpc/booke/machdep.c
  projects/ppc64/sys/powerpc/booke/platform_bare.c
  projects/ppc64/sys/powerpc/booke/pmap.c
  projects/ppc64/sys/powerpc/conf/MPC85XX
  projects/ppc64/sys/powerpc/include/metadata.h
  projects/ppc64/sys/powerpc/mpc85xx/atpic.c
  projects/ppc64/sys/powerpc/mpc85xx/i2c.c
  projects/ppc64/sys/powerpc/mpc85xx/lbc.c
  projects/ppc64/sys/powerpc/mpc85xx/lbc.h
  projects/ppc64/sys/powerpc/mpc85xx/mpc85xx.c
  projects/ppc64/sys/powerpc/mpc85xx/mpc85xx.h
  projects/ppc64/sys/powerpc/mpc85xx/nexus.c
  projects/ppc64/sys/powerpc/powerpc/intr_machdep.c
  projects/ppc64/sys/x86/x86/timeevents.c
Directory Properties:
  projects/ppc64/   (props changed)
  projects/ppc64/cddl/contrib/opensolaris/   (props changed)
  projects/ppc64/contrib/ee/   (props changed)
  projects/ppc64/contrib/expat/   (props changed)
  projects/ppc64/contrib/file/   (props changed)
  projects/ppc64/contrib/gdb/   (props changed)
  projects/ppc64/contrib/gnu-sort/   (props changed)
  projects/ppc64/contrib/groff/   (props changed)
  projects/ppc64/contrib/less/   (props changed)
  projects/ppc64/contrib/libpcap/   (props changed)
  projects/ppc64/contrib/ncurses/   (props changed)
  projects/ppc64/contrib/one-true-awk/   (props changed)
  projects/ppc64/contrib/openbsm/   (props changed)
  projects/ppc64/contrib/openpam/   (props changed)
  projects/ppc64/contrib/pf/   (props changed)
  projects/ppc64/contrib/tcpdump/   (props changed)
  projects/ppc64/contrib/tcsh/   (props changed)
  projects/ppc64/contrib/tzcode/stdtime/   (props changed)
  projects/ppc64/contrib/tzcode/zic/   (props changed)
  projects/ppc64/contrib/tzdata/   (props changed)
  projects/ppc64/contrib/wpa/   (props changed)
  projects/ppc64/lib/libutil/   (props changed)
  projects/ppc64/lib/libz/   (props changed)
  projects/ppc64/sbin/   (props changed)
  projects/ppc64/sbin/ipfw/   (props changed)
  projects/ppc64/share/mk/bsd.arch.inc.mk   (props changed)
  projects/ppc64/sys/   (props changed)
  projects/ppc64/sys/amd64/include/xen/   (props changed)
  projects/ppc64/sys/arm/conf/SHEEVAPLUG   (props changed)
  projects/ppc64/sys/cddl/contrib/opensolaris/   (props changed)
  projects/ppc64/sys/contrib/dev/acpica/   (props changed)
  projects/ppc64/sys/contrib/x86emu/   (props changed)
  projects/ppc64/sys/dev/xen/xenpci/   (props changed)
  projects/ppc64/usr.bin/csup/   (props changed)
  projects/ppc64/usr.bin/procstat/   (props changed)

Modified: projects/ppc64/lib/Makefile
==============================================================================
--- projects/ppc64/lib/Makefile	Mon Jul 12 00:56:35 2010	(r209922)
+++ projects/ppc64/lib/Makefile	Mon Jul 12 01:08:59 2010	(r209923)
@@ -188,7 +188,7 @@ _libsmb=	libsmb
 _libvgl=	libvgl
 .endif
 
-.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpc64"
+.if ${MACHINE_CPUARCH} == "powerpc"
 _libsmb=	libsmb
 .endif
 

Modified: projects/ppc64/sys/arm/include/metadata.h
==============================================================================
--- projects/ppc64/sys/arm/include/metadata.h	Mon Jul 12 00:56:35 2010	(r209922)
+++ projects/ppc64/sys/arm/include/metadata.h	Mon Jul 12 01:08:59 2010	(r209923)
@@ -31,10 +31,4 @@
 
 #define	MODINFOMD_DTBP		0x1001
 
-/*
- * XXX this is for tinderbox compilation sake only and will go away once the
- * FDT transition is complete.
- */
-#define MODINFOMD_BOOTINFO	0x2000
-
 #endif /* !_MACHINE_METADATA_H_ */

Modified: projects/ppc64/sys/boot/fdt/dts/mpc8555cds.dts
==============================================================================
--- projects/ppc64/sys/boot/fdt/dts/mpc8555cds.dts	Mon Jul 12 00:56:35 2010	(r209922)
+++ projects/ppc64/sys/boot/fdt/dts/mpc8555cds.dts	Mon Jul 12 01:08:59 2010	(r209923)
@@ -343,6 +343,7 @@
 			compatible = "fsl,mpc8555-cpm", "fsl,cpm2";
 			reg = <0x80000 0x20000>;
 			interrupts = <46 2>;
+			interrupt-parent = <&mpic>;
 		};
 	};
 

Modified: projects/ppc64/sys/boot/uboot/common/metadata.c
==============================================================================
--- projects/ppc64/sys/boot/uboot/common/metadata.c	Mon Jul 12 00:56:35 2010	(r209922)
+++ projects/ppc64/sys/boot/uboot/common/metadata.c	Mon Jul 12 01:08:59 2010	(r209923)
@@ -36,9 +36,6 @@ __FBSDID("$FreeBSD$");
 
 #include <machine/elf.h>
 #include <machine/metadata.h>
-#if !defined(LOADER_FDT_SUPPORT)
-#include <machine/bootinfo.h>
-#endif
 
 #include "api_public.h"
 #include "bootstrap.h"
@@ -259,114 +256,6 @@ md_copymodules(vm_offset_t addr)
 	return(addr);
 }
 
-#if !defined(LOADER_FDT_SUPPORT)
-/*
- * Prepare the bootinfo structure. Put a ptr to the allocated struct in addr,
- * return size.
- */
-static int
-md_bootinfo(struct bootinfo **addr)
-{
-#define	TMP_MAX_ETH	8
-#define	TMP_MAX_MR	8
-	struct bootinfo		*bi;
-	struct bi_mem_region	tmp_mr[TMP_MAX_MR];
-	struct bi_eth_addr	tmp_eth[TMP_MAX_ETH];
-	struct sys_info		*si;
-	char			*str, *end;
-	const char		*env;
-	void			*ptr;
-	u_int8_t		tmp_addr[6];
-	int			i, n, mr_no, eth_no, size;
-
-	if ((si = ub_get_sys_info()) == NULL)
-		panic("can't retrieve U-Boot sysinfo");
-
-	/*
-	 * Handle mem regions (we only care about DRAM)
-	 */
-	for (i = 0, mr_no = 0; i < si->mr_no; i++) {
-		if (si->mr[i].flags == MR_ATTR_DRAM) {
-			if (mr_no >= TMP_MAX_MR) {
-				printf("too many memory regions: %d\n", mr_no);
-				break;
-			}
-			tmp_mr[mr_no].mem_base = si->mr[i].start;
-			tmp_mr[mr_no].mem_size = si->mr[i].size;
-			mr_no++;
-			continue;
-		}
-	}
-	if (mr_no == 0)
-		panic("can't retrieve RAM info");
-
-	size = (mr_no * sizeof(struct bi_mem_region) - sizeof(bi->bi_data));
-
-	/*
-	 * Handle Ethernet addresses: parse u-boot env for eth%daddr
-	 */
-	env = NULL;
-	eth_no = 0;
-	while ((env = ub_env_enum(env)) != NULL) {
-		if (strncmp(env, "eth", 3) == 0 &&
-		    strncmp(env + (strlen(env) - 4), "addr", 4) == 0) {
-
-			/* Extract interface number */
-			i = strtol(env + 3, &end, 10);
-			if (end == (env + 3))
-				/* 'ethaddr' means interface 0 address */
-				n = 0;
-			else
-				n = i;
-
-			if (n >= TMP_MAX_MR) {
-				printf("Ethernet interface number too high: %d. "
-				    "Skipping...\n");
-				continue;
-			}
-
-			str = ub_env_get(env);
-			for (i = 0; i < 6; i++) {
-				tmp_addr[i] = str ? strtol(str, &end, 16) : 0;
-				if (str)
-					str = (*end) ? end + 1 : end;
-
-				tmp_eth[n].mac_addr[i] = tmp_addr[i];
-			}
-
-			/* eth_no is 1-based number of all interfaces defined */
-			if (n + 1 > eth_no)
-				eth_no = n + 1;
-		}
-	}
-
-	size += (eth_no * sizeof(struct bi_eth_addr)) + sizeof(struct bootinfo);
-
-	/*
-	 * Once its whole size is calculated, allocate space for the bootinfo
-	 * and copy over the contents from temp containers.
-	 */
-	if ((bi = malloc(size)) == NULL)
-		panic("can't allocate mem for bootinfo");
-
-	ptr = (struct bi_mem_region *)bi->bi_data;
-	bcopy(tmp_mr, ptr, mr_no * sizeof(struct bi_mem_region));
-	ptr += mr_no * sizeof(struct bi_mem_region);
-	bcopy(tmp_eth, ptr, eth_no * sizeof(struct bi_eth_addr));
-
-	bi->bi_mem_reg_no = mr_no;
-	bi->bi_eth_addr_no = eth_no;
-	bi->bi_version = BI_VERSION;
-	bi->bi_bar_base = si->bar;
-	bi->bi_cpu_clk = si->clk_cpu;
-	bi->bi_bus_clk = si->clk_bus;
-
-	*addr = bi;
-
-	return (size);
-}
-#endif
-
 /*
  * Load the information expected by a kernel.
  *
@@ -390,7 +279,6 @@ md_load(char *args, vm_offset_t *modulep
 	vm_offset_t		dtbp;
 	char			*rootdevname;
 	int			howto;
-	int			bisize;
 	int			i;
 
 	/*
@@ -434,11 +322,6 @@ md_load(char *args, vm_offset_t *modulep
 	/* Pad to a page boundary */
 	addr = roundup(addr, PAGE_SIZE);
 
-#if !defined(LOADER_FDT_SUPPORT)
-	/* prepare bootinfo */
-	bisize = md_bootinfo(&bip);
-#endif
-
 	kernend = 0;
 	kfp = file_findfile(NULL, "elf32 kernel");
 	if (kfp == NULL)
@@ -457,8 +340,6 @@ md_load(char *args, vm_offset_t *modulep
 
 	dtbp = bfp == NULL ? 0 : bfp->f_addr;
 	file_addmetadata(kfp, MODINFOMD_DTBP, sizeof dtbp, &dtbp);
-#else
-	file_addmetadata(kfp, MODINFOMD_BOOTINFO, bisize, bip);
 #endif
 
 	file_addmetadata(kfp, MODINFOMD_KERNEND, sizeof kernend, &kernend);

Modified: projects/ppc64/sys/conf/Makefile.powerpc
==============================================================================
--- projects/ppc64/sys/conf/Makefile.powerpc	Mon Jul 12 00:56:35 2010	(r209922)
+++ projects/ppc64/sys/conf/Makefile.powerpc	Mon Jul 12 01:08:59 2010	(r209923)
@@ -33,6 +33,8 @@ LDSCRIPT_NAME?= ldscript.${MACHINE_ARCH}
 
 .include "$S/conf/kern.pre.mk"
 
+INCLUDES+= -I$S/contrib/libfdt
+
 CFLAGS+= -msoft-float
 
 DDB_ENABLED!=	grep DDB opt_ddb.h || true

Modified: projects/ppc64/sys/conf/files.powerpc
==============================================================================
--- projects/ppc64/sys/conf/files.powerpc	Mon Jul 12 00:56:35 2010	(r209922)
+++ projects/ppc64/sys/conf/files.powerpc	Mon Jul 12 01:08:59 2010	(r209923)
@@ -14,7 +14,6 @@ font.h				optional	sc			\
 	no-obj no-implicit-rule before-depend				\
 	clean	"font.h ${SC_DFLT_FONT}-8x14 ${SC_DFLT_FONT}-8x16 ${SC_DFLT_FONT}-8x8"
 #
-
 crypto/blowfish/bf_enc.c	optional	crypto | ipsec
 crypto/des/des_enc.c		optional	crypto | ipsec | netsmb
 dev/bm/if_bm.c			optional	bm powermac
@@ -23,21 +22,23 @@ dev/adb/adb_kbd.c		optional	adb
 dev/adb/adb_mouse.c		optional	adb
 dev/adb/adb_hb_if.m		optional	adb
 dev/adb/adb_if.m		optional	adb
-dev/cfi/cfi_bus_lbc.c		optional	cfi
+dev/cfi/cfi_bus_fdt.c		optional	cfi fdt
 dev/fb/fb.c			optional	sc
+dev/fdt/fdt_powerpc.c		optional	fdt
 dev/hwpmc/hwpmc_powerpc.c	optional	hwpmc
 dev/kbd/kbd.c			optional	sc
-dev/ofw/openfirm.c		optional	aim
-dev/ofw/openfirmio.c		optional	aim
-dev/ofw/ofw_bus_if.m		optional	aim
-dev/ofw/ofw_if.m		optional	aim
-dev/ofw/ofw_bus_subr.c		optional	aim
+dev/ofw/openfirm.c		optional	aim | fdt
+dev/ofw/openfirmio.c		optional	aim | fdt
+dev/ofw/ofw_bus_if.m		optional	aim | fdt
+dev/ofw/ofw_if.m		optional	aim | fdt
+dev/ofw/ofw_bus_subr.c		optional	aim | fdt
 dev/ofw/ofw_console.c		optional	aim
 dev/ofw/ofw_disk.c		optional	ofwd aim
+dev/ofw/ofw_fdt.c		optional	fdt
 dev/ofw/ofw_iicbus.c		optional	iicbus aim
 dev/ofw/ofw_standard.c		optional	aim powerpc
 dev/powermac_nvram/powermac_nvram.c optional	powermac_nvram powermac
-dev/quicc/quicc_bfe_ocp.c	optional	quicc mpc85xx
+dev/quicc/quicc_bfe_fdt.c	optional	quicc mpc85xx
 dev/scc/scc_bfe_macio.c		optional	scc powermac
 dev/sec/sec.c			optional	sec mpc85xx
 dev/sound/macio/aoa.c		optional	snd_davbus | snd_ai2s powermac
@@ -49,9 +50,8 @@ dev/syscons/scgfbrndr.c		optional	sc
 dev/syscons/scterm-teken.c	optional	sc
 dev/syscons/scvtb.c		optional	sc
 dev/tsec/if_tsec.c		optional	tsec
-dev/tsec/if_tsec_ocp.c		optional	tsec mpc85xx
-dev/uart/uart_bus_ocp.c		optional	uart mpc85xx
-dev/uart/uart_cpu_powerpc.c	optional	uart
+dev/tsec/if_tsec_fdt.c		optional	tsec fdt
+dev/uart/uart_cpu_powerpc.c	optional	uart aim
 kern/syscalls.c			optional	ktr
 libkern/ashldi3.c		optional	powerpc
 libkern/ashrdi3.c		optional	powerpc
@@ -63,6 +63,7 @@ libkern/ffsl.c			standard
 libkern/fls.c			standard
 libkern/flsl.c			standard
 libkern/lshrdi3.c		optional	powerpc
+libkern/memchr.c		optional	fdt
 libkern/memmove.c		standard
 libkern/memset.c		standard
 libkern/moddi3.c		optional	powerpc
@@ -117,16 +118,15 @@ powerpc/mambo/mambo_console.c	optional	m
 powerpc/mambo/mambo_disk.c	optional	mambo
 powerpc/mambo/mambo_openpic.c	optional	mambo
 powerpc/mpc85xx/atpic.c		optional	mpc85xx isa
-powerpc/mpc85xx/ds1553_bus_lbc.c	optional	ds1553
+powerpc/mpc85xx/ds1553_bus_fdt.c	optional	ds1553 fdt
 powerpc/mpc85xx/ds1553_core.c	optional	ds1553
-powerpc/mpc85xx/i2c.c		optional	iicbus mpc85xx
+powerpc/mpc85xx/i2c.c		optional	iicbus fdt
 powerpc/mpc85xx/isa.c		optional	mpc85xx isa
 powerpc/mpc85xx/lbc.c		optional	mpc85xx
 powerpc/mpc85xx/mpc85xx.c	optional	mpc85xx
 powerpc/mpc85xx/nexus.c		optional	mpc85xx
-powerpc/mpc85xx/ocpbus.c	optional	mpc85xx
-powerpc/mpc85xx/opic.c		optional	mpc85xx
-powerpc/mpc85xx/pci_ocp.c	optional	pci mpc85xx
+powerpc/mpc85xx/openpic_fdt.c	optional	fdt
+powerpc/mpc85xx/pci_fdt.c	optional	pci mpc85xx
 powerpc/ofw/ofw_cpu.c		optional	aim
 powerpc/ofw/ofw_pcibus.c	optional	pci aim
 powerpc/ofw/ofw_pcib_pci.c	optional	pci aim

Modified: projects/ppc64/sys/conf/options.powerpc
==============================================================================
--- projects/ppc64/sys/conf/options.powerpc	Mon Jul 12 00:56:35 2010	(r209922)
+++ projects/ppc64/sys/conf/options.powerpc	Mon Jul 12 01:08:59 2010	(r209923)
@@ -16,8 +16,8 @@ GFB_DEBUG		opt_gfb.h
 GFB_NO_FONT_LOADING	opt_gfb.h
 GFB_NO_MODE_CHANGE	opt_gfb.h
 
-POWERMAC		opt_platform.h
 MPC85XX			opt_platform.h
+POWERMAC		opt_platform.h
 MAMBO			opt_platform.h
 PSIM
 

Modified: projects/ppc64/sys/dev/bwi/if_bwi_pci.c
==============================================================================
--- projects/ppc64/sys/dev/bwi/if_bwi_pci.c	Mon Jul 12 00:56:35 2010	(r209922)
+++ projects/ppc64/sys/dev/bwi/if_bwi_pci.c	Mon Jul 12 01:08:59 2010	(r209923)
@@ -91,7 +91,8 @@ static const struct bwi_dev {
 	{ PCI_VENDOR_BROADCOM, 0x4324,"Broadcom BCM4309 802.11a/b/g Wireless Lan" },
 	{ PCI_VENDOR_BROADCOM, 0x4318,"Broadcom BCM4318 802.11b/g Wireless Lan" },
 	{ PCI_VENDOR_BROADCOM, 0x4319,"Broadcom BCM4318 802.11a/b/g Wireless Lan" },
-	{ PCI_VENDOR_BROADCOM, 0x431a,"Broadcom BCM4318 802.11a Wireless Lan" }
+	{ PCI_VENDOR_BROADCOM, 0x431a,"Broadcom BCM4318 802.11a Wireless Lan" },
+	{ 0, 0, NULL }
 };
 
 static int

Copied: projects/ppc64/sys/dev/cfi/cfi_bus_fdt.c (from r209922, head/sys/dev/cfi/cfi_bus_fdt.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/ppc64/sys/dev/cfi/cfi_bus_fdt.c	Mon Jul 12 01:08:59 2010	(r209923, copy of r209922, head/sys/dev/cfi/cfi_bus_fdt.c)
@@ -0,0 +1,73 @@
+/*-
+ * Copyright (c) 2007, Juniper Networks, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the author nor the names of any co-contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/conf.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+
+#include <machine/bus.h>
+
+#include <dev/cfi/cfi_var.h>
+#include <dev/ofw/ofw_bus.h>
+#include <dev/ofw/ofw_bus_subr.h>
+
+static int cfi_fdt_probe(device_t);
+
+static device_method_t cfi_fdt_methods[] = {
+	/* device interface */
+	DEVMETHOD(device_probe,		cfi_fdt_probe),
+	DEVMETHOD(device_attach,	cfi_attach),
+	DEVMETHOD(device_detach,	cfi_detach),
+
+	{0, 0}
+};
+
+static driver_t cfi_fdt_driver = {
+	cfi_driver_name,
+	cfi_fdt_methods,
+	sizeof(struct cfi_softc),
+};
+
+DRIVER_MODULE (cfi, lbc, cfi_fdt_driver, cfi_devclass, 0, 0);
+
+static int
+cfi_fdt_probe(device_t dev)
+{
+
+	if (!ofw_bus_is_compatible(dev, "cfi-flash"))
+		return (ENXIO);
+
+	return (cfi_probe(dev));
+}

Modified: projects/ppc64/sys/dev/fdt/fdt_common.c
==============================================================================
--- projects/ppc64/sys/dev/fdt/fdt_common.c	Mon Jul 12 00:56:35 2010	(r209922)
+++ projects/ppc64/sys/dev/fdt/fdt_common.c	Mon Jul 12 01:08:59 2010	(r209923)
@@ -529,8 +529,8 @@ fdt_intr_to_rl(phandle_t node, struct re
 		debugf("decoded intr = %d, trig = %d, pol = %d\n", interrupt,
 		    trig, pol);
 
-		intr_sl[intr_num].trig = trig;
-		intr_sl[intr_num].pol = pol;
+		intr_sl[i].trig = trig;
+		intr_sl[i].pol = pol;
 
 		resource_list_add(rl, SYS_RES_IRQ, i, interrupt, interrupt, 1);
 	}

Modified: projects/ppc64/sys/dev/fdt/fdt_pci.c
==============================================================================
--- projects/ppc64/sys/dev/fdt/fdt_pci.c	Mon Jul 12 00:56:35 2010	(r209922)
+++ projects/ppc64/sys/dev/fdt/fdt_pci.c	Mon Jul 12 01:08:59 2010	(r209923)
@@ -325,8 +325,9 @@ fdt_pci_route_intr(int bus, int slot, in
 		debugf("decoded intr = %d, trig = %d, pol = %d\n", *interrupt,
 		    trig, pol);
 
-		/* XXX we should probably call powerpc_config() here... */
-
+#if defined(__powerpc__)
+		powerpc_config_intr(INTR_VEC(intr_par, *interrupt), trig, pol);
+#endif
 		return (0);
 
 next:

Copied: projects/ppc64/sys/dev/fdt/fdt_powerpc.c (from r209922, head/sys/dev/fdt/fdt_powerpc.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/ppc64/sys/dev/fdt/fdt_powerpc.c	Mon Jul 12 01:08:59 2010	(r209923, copy of r209922, head/sys/dev/fdt/fdt_powerpc.c)
@@ -0,0 +1,168 @@
+/*-
+ * Copyright (c) 2009-2010 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Semihalf under sponsorship from
+ * the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+#include <sys/bus.h>
+
+#include <machine/intr_machdep.h>
+
+#include <dev/ofw/ofw_bus.h>
+#include <dev/ofw/ofw_bus_subr.h>
+#include <dev/ofw/openfirm.h>
+
+#include "ofw_bus_if.h"
+#include "fdt_common.h"
+
+static void
+fdt_fixup_busfreq(phandle_t root)
+{
+	phandle_t sb, cpus, child;
+	pcell_t freq;
+
+	/*
+	 * Do a strict check so as to skip non-SOC nodes, which also claim
+	 * simple-bus compatibility such as eLBC etc.
+	 */
+	if ((sb = fdt_find_compatible(root, "simple-bus", 1)) == 0)
+		return;
+
+	/*
+	 * This fixup uses /cpus/ bus-frequency prop value to set simple-bus
+	 * bus-frequency property.
+	 */
+	if ((cpus = OF_finddevice("/cpus")) == 0)
+		return;
+
+	if ((child = OF_child(cpus)) == 0)
+		return;
+
+	if (OF_getprop(child, "bus-frequency", (void *)&freq,
+	    sizeof(freq)) <= 0)
+		return;
+
+	OF_setprop(sb, "bus-frequency", (void *)&freq, sizeof(freq));
+}
+
+struct fdt_fixup_entry fdt_fixup_table[] = {
+	{ "fsl,MPC8572DS", &fdt_fixup_busfreq },
+	{ "MPC8555CDS", &fdt_fixup_busfreq },
+	{ NULL, NULL }
+};
+
+static int
+fdt_pic_decode_iic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,
+    int *pol)
+{
+	if (!fdt_is_compatible(node, "chrp,iic"))
+		return (ENXIO);
+
+	*interrupt = intr[0];
+
+	switch (intr[1]) {
+	case 0:
+		/* Active L level */
+		*trig = INTR_TRIGGER_LEVEL;
+		*pol = INTR_POLARITY_LOW;
+		break;
+	case 1:
+		/* Active H level */
+		*trig = INTR_TRIGGER_LEVEL;
+		*pol = INTR_POLARITY_HIGH;
+		break;
+	case 2:
+		/* H to L edge */
+		*trig = INTR_TRIGGER_EDGE;
+		*pol = INTR_POLARITY_LOW;
+		break;
+	case 3:
+		/* L to H edge */
+		*trig = INTR_TRIGGER_EDGE;
+		*pol = INTR_POLARITY_HIGH;
+		break;
+	default:
+		*trig = INTR_TRIGGER_CONFORM;
+		*pol = INTR_POLARITY_CONFORM;
+	}
+	return (0);
+}
+
+static int
+fdt_pic_decode_openpic(phandle_t node, pcell_t *intr, int *interrupt,
+    int *trig, int *pol)
+{
+
+	if (!fdt_is_compatible(node, "chrp,open-pic"))
+		return (ENXIO);
+
+	/*
+	 * XXX The interrupt number read out from the MPC85XX device tree is
+	 * already offset by 16 to reflect the 'internal' IRQ range shift on
+	 * the OpenPIC.
+	 */
+	*interrupt = intr[0];
+
+	switch (intr[1]) {
+	case 0:
+		/* L to H edge */
+		*trig = INTR_TRIGGER_EDGE;
+		*pol = INTR_POLARITY_HIGH;
+		break;
+	case 1:
+		/* Active L level */
+		*trig = INTR_TRIGGER_LEVEL;
+		*pol = INTR_POLARITY_LOW;
+		break;
+	case 2:
+		/* Active H level */
+		*trig = INTR_TRIGGER_LEVEL;
+		*pol = INTR_POLARITY_HIGH;
+		break;
+	case 3:
+		/* H to L edge */
+		*trig = INTR_TRIGGER_EDGE;
+		*pol = INTR_POLARITY_LOW;
+		break;
+	default:
+		*trig = INTR_TRIGGER_CONFORM;
+		*pol = INTR_POLARITY_CONFORM;
+	}
+	return (0);
+}
+
+fdt_pic_decode_t fdt_pic_table[] = {
+	&fdt_pic_decode_iic,
+	&fdt_pic_decode_openpic,
+	NULL
+};

Modified: projects/ppc64/sys/dev/fdt/simplebus.c
==============================================================================
--- projects/ppc64/sys/dev/fdt/simplebus.c	Mon Jul 12 00:56:35 2010	(r209922)
+++ projects/ppc64/sys/dev/fdt/simplebus.c	Mon Jul 12 01:08:59 2010	(r209923)
@@ -187,16 +187,16 @@ simplebus_attach(device_t dev)
 		resource_list_init(&di->di_res);
 
 		if (fdt_reg_to_rl(dt_child, &di->di_res, sc->sc_start_va)) {
-			device_printf(dev, "could not process 'reg' "
-			    "property\n");
+			device_printf(dev, "%s: could not process 'reg' "
+			    "property\n", di->di_ofw.obd_name);
 			ofw_bus_gen_destroy_devinfo(&di->di_ofw);
 			free(di, M_SIMPLEBUS);
 			continue;
 		}
 
 		if (fdt_intr_to_rl(dt_child, &di->di_res, di->di_intr_sl)) {
-			device_printf(dev, "could not process 'interrupts' "
-			    "property\n");
+			device_printf(dev, "%s: could not process "
+			    "'interrupts' property\n", di->di_ofw.obd_name);
 			resource_list_free(&di->di_res);
 			ofw_bus_gen_destroy_devinfo(&di->di_ofw);
 			free(di, M_SIMPLEBUS);
@@ -213,6 +213,9 @@ simplebus_attach(device_t dev)
 			free(di, M_SIMPLEBUS);
 			continue;
 		}
+#ifdef DEBUG
+		device_printf(dev, "added child: %s\n\n", di->di_ofw.obd_name);
+#endif
 		device_set_ivars(dev_child, di);
 	}
 

Modified: projects/ppc64/sys/dev/pci/pcireg.h
==============================================================================
--- projects/ppc64/sys/dev/pci/pcireg.h	Mon Jul 12 00:56:35 2010	(r209922)
+++ projects/ppc64/sys/dev/pci/pcireg.h	Mon Jul 12 01:08:59 2010	(r209923)
@@ -605,6 +605,9 @@
 #define	PCIR_EXPRESS_DEVICE_CAP	0x4
 #define	PCIM_EXP_CAP_MAX_PAYLOAD	0x0007
 #define	PCIR_EXPRESS_DEVICE_CTL	0x8
+#define	PCIM_EXP_CTL_NFER_ENABLE	0x0002
+#define	PCIM_EXP_CTL_FER_ENABLE		0x0004
+#define	PCIM_EXP_CTL_URR_ENABLE		0x0008
 #define	PCIM_EXP_CTL_RELAXED_ORD_ENABLE	0x0010
 #define	PCIM_EXP_CTL_MAX_PAYLOAD	0x00e0
 #define	PCIM_EXP_CTL_NOSNOOP_ENABLE	0x0800

Copied: projects/ppc64/sys/dev/quicc/quicc_bfe_fdt.c (from r209922, head/sys/dev/quicc/quicc_bfe_fdt.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/ppc64/sys/dev/quicc/quicc_bfe_fdt.c	Mon Jul 12 01:08:59 2010	(r209923, copy of r209922, head/sys/dev/quicc/quicc_bfe_fdt.c)
@@ -0,0 +1,90 @@
+/*-
+ * Copyright (c) 2006 Juniper Networks.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/conf.h>
+#include <sys/kernel.h>
+#include <sys/lock.h>
+#include <sys/malloc.h>
+#include <sys/module.h>
+#include <sys/rman.h>
+#include <sys/tty.h>
+#include <machine/bus.h>
+
+#include <dev/ofw/ofw_bus.h>
+#include <dev/ofw/ofw_bus_subr.h>
+#include <dev/quicc/quicc_bfe.h>
+
+static int quicc_fdt_probe(device_t dev);
+
+static device_method_t quicc_fdt_methods[] = {
+	/* Device interface */
+	DEVMETHOD(device_probe,		quicc_fdt_probe),
+	DEVMETHOD(device_attach,	quicc_bfe_attach),
+	DEVMETHOD(device_detach,	quicc_bfe_detach),
+
+	DEVMETHOD(bus_alloc_resource,	quicc_bus_alloc_resource),
+	DEVMETHOD(bus_release_resource,	quicc_bus_release_resource),
+	DEVMETHOD(bus_get_resource,	quicc_bus_get_resource),
+	DEVMETHOD(bus_read_ivar,	quicc_bus_read_ivar),
+	DEVMETHOD(bus_setup_intr,	quicc_bus_setup_intr),
+	DEVMETHOD(bus_teardown_intr,	quicc_bus_teardown_intr),
+	DEVMETHOD(bus_print_child,	bus_generic_print_child),
+	DEVMETHOD(bus_driver_added,	bus_generic_driver_added),
+
+	{ 0, 0 }
+};
+
+static driver_t quicc_fdt_driver = {
+	quicc_driver_name,
+	quicc_fdt_methods,
+	sizeof(struct quicc_softc),
+};
+
+static int
+quicc_fdt_probe(device_t dev)
+{
+	phandle_t par;
+	pcell_t clock;
+
+	if (!ofw_bus_is_compatible(dev, "fsl,cpm2"))
+		return (ENXIO);
+
+	par = OF_parent(ofw_bus_get_node(dev));
+	if (OF_getprop(par, "bus-frequency", &clock, sizeof(clock)) <= 0)
+		clock = 0;
+
+	return (quicc_bfe_probe(dev, (uintptr_t)clock));
+}
+
+DRIVER_MODULE(quicc, simplebus, quicc_fdt_driver, quicc_devclass, 0, 0);

Modified: projects/ppc64/sys/dev/sec/sec.c
==============================================================================
--- projects/ppc64/sys/dev/sec/sec.c	Mon Jul 12 00:56:35 2010	(r209922)
+++ projects/ppc64/sys/dev/sec/sec.c	Mon Jul 12 01:08:59 2010	(r209923)
@@ -45,12 +45,12 @@ __FBSDID("$FreeBSD$");
 #include <sys/rman.h>
 
 #include <machine/bus.h>
-#include <machine/ocpbus.h>
 #include <machine/resource.h>
 
 #include <opencrypto/cryptodev.h>
 #include "cryptodev_if.h"
 
+#include <dev/ofw/ofw_bus_subr.h>
 #include <dev/sec/sec.h>
 
 static int	sec_probe(device_t dev);
@@ -153,7 +153,7 @@ static driver_t sec_driver = {
 };
 
 static devclass_t sec_devclass;
-DRIVER_MODULE(sec, ocpbus, sec_driver, sec_devclass, 0, 0);
+DRIVER_MODULE(sec, simplebus, sec_driver, sec_devclass, 0, 0);
 MODULE_DEPEND(sec, crypto, 1, 1, 1);
 
 static struct sec_eu_methods sec_eus[] = {
@@ -201,24 +201,16 @@ static int
 sec_probe(device_t dev)
 {
 	struct sec_softc *sc;
-	device_t parent;
-	uintptr_t devtype;
 	uint64_t id;
-	int error;
 
-	parent = device_get_parent(dev);
-	error = BUS_READ_IVAR(parent, dev, OCPBUS_IVAR_DEVTYPE, &devtype);
-	if (error)
-		return (error);
-
-	if (devtype != OCPBUS_DEVTYPE_SEC)
+	if (!ofw_bus_is_compatible(dev, "fsl,sec2.0"))
 		return (ENXIO);
 
 	sc = device_get_softc(dev);
 
 	sc->sc_rrid = 0;
-	sc->sc_rres = bus_alloc_resource(dev, SYS_RES_MEMORY, &sc->sc_rrid,
-	    0ul, ~0ul, SEC_IO_SIZE, RF_ACTIVE);
+	sc->sc_rres = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->sc_rrid,
+	    RF_ACTIVE);
 
 	if (sc->sc_rres == NULL)
 		return (ENXIO);
@@ -276,8 +268,8 @@ sec_attach(device_t dev)
 
 	/* Allocate I/O memory for SEC registers */
 	sc->sc_rrid = 0;
-	sc->sc_rres = bus_alloc_resource(dev, SYS_RES_MEMORY, &sc->sc_rrid,
-	    0ul, ~0ul, SEC_IO_SIZE, RF_ACTIVE);
+	sc->sc_rres = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->sc_rrid,
+	    RF_ACTIVE);
 
 	if (sc->sc_rres == NULL) {
 		device_printf(dev, "could not allocate I/O memory!\n");
@@ -295,12 +287,15 @@ sec_attach(device_t dev)
 	if (error)
 		goto fail2;
 
-	sc->sc_sec_irid = 1;
-	error = sec_setup_intr(sc, &sc->sc_sec_ires, &sc->sc_sec_ihand,
-	    &sc->sc_sec_irid, sec_secondary_intr, "secondary");
 
-	if (error)
-		goto fail3;
+	if (sc->sc_version == 3) {
+		sc->sc_sec_irid = 1;
+		error = sec_setup_intr(sc, &sc->sc_sec_ires, &sc->sc_sec_ihand,
+		    &sc->sc_sec_irid, sec_secondary_intr, "secondary");
+
+		if (error)
+			goto fail3;
+	}
 
 	/* Alloc DMA memory for descriptors and link tables */
 	error = sec_alloc_dma_mem(sc, &(sc->sc_desc_dmem),

Modified: projects/ppc64/sys/dev/tsec/if_tsec.c
==============================================================================
--- projects/ppc64/sys/dev/tsec/if_tsec.c	Mon Jul 12 00:56:35 2010	(r209922)
+++ projects/ppc64/sys/dev/tsec/if_tsec.c	Mon Jul 12 01:08:59 2010	(r209923)
@@ -1,6 +1,6 @@
 /*-
- * Copyright (C) 2007-2008 Semihalf, Rafal Jaworowski <raj at semihalf.com>
- * Copyright (C) 2006-2007 Semihalf, Piotr Kruszynski <ppk at semihalf.com>
+ * Copyright (C) 2007-2008 Semihalf, Rafal Jaworowski
+ * Copyright (C) 2006-2007 Semihalf, Piotr Kruszynski
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -1563,7 +1563,7 @@ tsec_miibus_readreg(device_t dev, int ph
 
 	sc = device_get_softc(dev);
 
-	if (device_get_unit(dev) != phy)
+	if (sc->phyaddr != phy)
 		return (0);
 
 	sc = tsec0_sc;
@@ -1591,9 +1591,8 @@ tsec_miibus_writereg(device_t dev, int p
 
 	sc = device_get_softc(dev);
 
-	if (device_get_unit(dev) != phy)
-		device_printf(dev, "Trying to write to an alien PHY(%d)\n",
-		    phy);
+	if (sc->phyaddr != phy)
+		return (0);
 
 	sc = tsec0_sc;
 

Modified: projects/ppc64/sys/dev/tsec/if_tsec.h
==============================================================================
--- projects/ppc64/sys/dev/tsec/if_tsec.h	Mon Jul 12 00:56:35 2010	(r209922)
+++ projects/ppc64/sys/dev/tsec/if_tsec.h	Mon Jul 12 01:08:59 2010	(r209923)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (C) 2006-2007 Semihalf, Piotr Kruszynski <ppk at semihalf.com>
+ * Copyright (C) 2006-2007 Semihalf, Piotr Kruszynski
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -28,6 +28,8 @@
 #ifndef _IF_TSEC_H
 #define _IF_TSEC_H
 
+#include <dev/ofw/openfirm.h>
+
 #define TSEC_RX_NUM_DESC	256
 #define TSEC_TX_NUM_DESC	256
 
@@ -49,6 +51,7 @@ struct tsec_softc {
 	struct mtx	transmit_lock;	/* transmitter lock */
 	struct mtx	receive_lock;	/* receiver lock */
 
+	phandle_t	node;
 	device_t	dev;
 	device_t	tsec_miibus;
 	struct mii_data	*tsec_mii;	/* MII media control */
@@ -128,6 +131,8 @@ struct tsec_softc {
 
 	/* currently received frame */
 	struct mbuf	*frame;
+
+	int		phyaddr;
 };
 
 /* interface to get/put generic objects */

Copied: projects/ppc64/sys/dev/tsec/if_tsec_fdt.c (from r209922, head/sys/dev/tsec/if_tsec_fdt.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/ppc64/sys/dev/tsec/if_tsec_fdt.c	Mon Jul 12 01:08:59 2010	(r209923, copy of r209922, head/sys/dev/tsec/if_tsec_fdt.c)
@@ -0,0 +1,352 @@
+/*-
+ * Copyright (C) 2007-2008 Semihalf, Rafal Jaworowski
+ * Copyright (C) 2006-2007 Semihalf, Piotr Kruszynski
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
+ * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * From: FreeBSD: head/sys/dev/tsec/if_tsec_ocp.c 188712 2009-02-17 14:59:47Z raj
+ */
+
+/*
+ * FDT 'simple-bus' attachment for Freescale TSEC controller.
+ */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/endian.h>
+#include <sys/mbuf.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+#include <sys/socket.h>
+#include <sys/sysctl.h>
+
+#include <sys/bus.h>
+#include <machine/bus.h>
+#include <sys/rman.h>
+#include <machine/resource.h>
+
+#include <net/ethernet.h>
+#include <net/if.h>
+#include <net/if_dl.h>
+#include <net/if_media.h>
+#include <net/if_arp.h>
+
+#include <dev/fdt/fdt_common.h>
+#include <dev/mii/mii.h>
+#include <dev/mii/miivar.h>
+#include <dev/ofw/ofw_bus.h>
+#include <dev/ofw/ofw_bus_subr.h>
+#include <dev/ofw/openfirm.h>
+
+#include <dev/tsec/if_tsec.h>
+#include <dev/tsec/if_tsecreg.h>
+
+#include "miibus_if.h"
+
+#define	TSEC_RID_TXIRQ	0
+#define	TSEC_RID_RXIRQ	1
+#define	TSEC_RID_ERRIRQ	2
+
+extern struct tsec_softc *tsec0_sc;
+
+static int tsec_fdt_probe(device_t dev);
+static int tsec_fdt_attach(device_t dev);
+static int tsec_fdt_detach(device_t dev);
+static int tsec_setup_intr(struct tsec_softc *sc, struct resource **ires,
+    void **ihand, int *irid, driver_intr_t handler, const char *iname);
+static void tsec_release_intr(struct tsec_softc *sc, struct resource *ires,
+    void *ihand, int irid, const char *iname);
+
+static device_method_t tsec_methods[] = {
+	/* Device interface */
+	DEVMETHOD(device_probe,		tsec_fdt_probe),
+	DEVMETHOD(device_attach,	tsec_fdt_attach),
+	DEVMETHOD(device_detach,	tsec_fdt_detach),
+
+	DEVMETHOD(device_shutdown,	tsec_shutdown),
+	DEVMETHOD(device_suspend,	tsec_suspend),
+	DEVMETHOD(device_resume,	tsec_resume),
+
+	/* Bus interface */
+	DEVMETHOD(bus_print_child,	bus_generic_print_child),
+	DEVMETHOD(bus_driver_added,	bus_generic_driver_added),
+
+	/* MII interface */
+	DEVMETHOD(miibus_readreg,	tsec_miibus_readreg),
+	DEVMETHOD(miibus_writereg,	tsec_miibus_writereg),
+	DEVMETHOD(miibus_statchg,	tsec_miibus_statchg),
+	{ 0, 0 }
+};
+
+static driver_t tsec_fdt_driver = {
+	"tsec",
+	tsec_methods,
+	sizeof(struct tsec_softc),
+};
+
+DRIVER_MODULE(tsec, simplebus, tsec_fdt_driver, tsec_devclass, 0, 0);
+MODULE_DEPEND(tsec, simplebus, 1, 1, 1);
+MODULE_DEPEND(tsec, ether, 1, 1, 1);
+
+static int
+tsec_fdt_probe(device_t dev)
+{
+	struct tsec_softc *sc;
+	uint32_t id;
+
+	if (!ofw_bus_is_compatible(dev, "gianfar"))
+		return (ENXIO);
+
+	sc = device_get_softc(dev);
+
+	sc->sc_rrid = 0;
+	sc->sc_rres = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->sc_rrid,
+	    RF_ACTIVE);
+	if (sc->sc_rres == NULL)

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-projects mailing list