[Midnightbsd-cvs] src [10084] trunk/sys/dev: sync with freebsd

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun May 27 19:27:21 EDT 2018


Revision: 10084
          http://svnweb.midnightbsd.org/src/?rev=10084
Author:   laffer1
Date:     2018-05-27 19:27:20 -0400 (Sun, 27 May 2018)
Log Message:
-----------
sync with freebsd

Modified Paths:
--------------
    trunk/sys/dev/patm/genrtab/Makefile
    trunk/sys/dev/patm/genrtab/genrtab.c
    trunk/sys/dev/patm/idt77252reg.h
    trunk/sys/dev/patm/if_patm.c
    trunk/sys/dev/patm/if_patm_attach.c
    trunk/sys/dev/patm/if_patm_intr.c
    trunk/sys/dev/patm/if_patm_ioctl.c
    trunk/sys/dev/patm/if_patm_rtables.c
    trunk/sys/dev/patm/if_patm_rx.c
    trunk/sys/dev/patm/if_patm_tx.c
    trunk/sys/dev/patm/if_patmvar.h
    trunk/sys/dev/pbio/pbio.c
    trunk/sys/dev/pbio/pbioio.h
    trunk/sys/dev/pccard/card_if.m
    trunk/sys/dev/pccard/pccard.c
    trunk/sys/dev/pccard/pccard_cis.c
    trunk/sys/dev/pccard/pccard_cis.h
    trunk/sys/dev/pccard/pccard_cis_quirks.c
    trunk/sys/dev/pccard/pccard_device.c
    trunk/sys/dev/pccard/pccarddevs
    trunk/sys/dev/pccard/pccardreg.h
    trunk/sys/dev/pccard/pccardvar.h
    trunk/sys/dev/pccard/pccardvarp.h
    trunk/sys/dev/pccard/power_if.m
    trunk/sys/dev/pccbb/pccbb.c
    trunk/sys/dev/pccbb/pccbb_isa.c
    trunk/sys/dev/pccbb/pccbb_pci.c
    trunk/sys/dev/pccbb/pccbbdevid.h
    trunk/sys/dev/pccbb/pccbbreg.h
    trunk/sys/dev/pccbb/pccbbvar.h
    trunk/sys/dev/pcn/if_pcn.c
    trunk/sys/dev/pcn/if_pcnreg.h
    trunk/sys/dev/syscons/logo/beastie.c

Property Changed:
----------------
    trunk/sys/dev/pccard/card_if.m
    trunk/sys/dev/pccard/pccarddevs
    trunk/sys/dev/pccard/power_if.m

Modified: trunk/sys/dev/patm/genrtab/Makefile
===================================================================
--- trunk/sys/dev/patm/genrtab/Makefile	2018-05-27 23:25:47 UTC (rev 10083)
+++ trunk/sys/dev/patm/genrtab/Makefile	2018-05-27 23:27:20 UTC (rev 10084)
@@ -1,4 +1,5 @@
 # $MidnightBSD$
+# $FreeBSD: stable/10/sys/dev/patm/genrtab/Makefile 276486 2014-12-31 23:25:37Z ngie $
 #
 # This program is used to generate the if_patm_rtables.c file
 # for the idt77252 driver. It is not installed.
@@ -6,7 +7,7 @@
 PROG=	genrtab
 INTERNALPROG=
 WARNS?=	5
-NO_MAN=
+MAN=
 DPADD=	${LIBM}
 LDADD=	-lm
 

Modified: trunk/sys/dev/patm/genrtab/genrtab.c
===================================================================
--- trunk/sys/dev/patm/genrtab/genrtab.c	2018-05-27 23:25:47 UTC (rev 10083)
+++ trunk/sys/dev/patm/genrtab/genrtab.c	2018-05-27 23:27:20 UTC (rev 10084)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2003
  *	Fraunhofer Institute for Open Communication Systems (FhG Fokus).
@@ -31,7 +32,7 @@
  * IDT manual.
  */
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/patm/genrtab/genrtab.c 139749 2005-01-06 01:43:34Z imp $");
 
 #include <sys/types.h>
 #include <stdio.h>
@@ -445,7 +446,7 @@
 	printf(" */\n");
 	printf("\n");
 	printf("#include <sys/cdefs.h>\n");
-	printf("__MBSDID(\"$MidnightBSD$\");\n");
+	printf("__FBSDID(\"$FreeBSD: stable/10/sys/dev/patm/genrtab/genrtab.c 139749 2005-01-06 01:43:34Z imp $\");\n");
 	printf("\n");
 	printf("#include <sys/types.h>\n");
 	printf("\n");

Modified: trunk/sys/dev/patm/idt77252reg.h
===================================================================
--- trunk/sys/dev/patm/idt77252reg.h	2018-05-27 23:25:47 UTC (rev 10083)
+++ trunk/sys/dev/patm/idt77252reg.h	2018-05-27 23:27:20 UTC (rev 10084)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2003
  *	Fraunhofer Institute for Open Communication Systems (FhG Fokus).
@@ -26,7 +27,7 @@
  *
  * Author: Hartmut Brandt <harti at freebsd.org>
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/patm/idt77252reg.h 139749 2005-01-06 01:43:34Z imp $
  *
  * Register definitions for the IDT77252 chip.
  */

Modified: trunk/sys/dev/patm/if_patm.c
===================================================================
--- trunk/sys/dev/patm/if_patm.c	2018-05-27 23:25:47 UTC (rev 10083)
+++ trunk/sys/dev/patm/if_patm.c	2018-05-27 23:27:20 UTC (rev 10084)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2003
  *	Fraunhofer Institute for Open Communication Systems (FhG Fokus).
@@ -30,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/patm/if_patm.c 254804 2013-08-24 19:51:18Z andre $");
 
 #include "opt_inet.h"
 #include "opt_natm.h"
@@ -319,7 +320,7 @@
 		for (i = 0; i < IDT_TSQE_TAG_SPACE; i++) {
 			if ((m = scd->on_card[i]) != NULL) {
 				scd->on_card[i] = 0;
-				map = m->m_pkthdr.header;
+				map = m->m_pkthdr.PH_loc.ptr;
 
 				bus_dmamap_unload(sc->tx_tag, map->map);
 				SLIST_INSERT_HEAD(&sc->tx_maps_free, map, link);

Modified: trunk/sys/dev/patm/if_patm_attach.c
===================================================================
--- trunk/sys/dev/patm/if_patm_attach.c	2018-05-27 23:25:47 UTC (rev 10083)
+++ trunk/sys/dev/patm/if_patm_attach.c	2018-05-27 23:27:20 UTC (rev 10084)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2003
  *	Fraunhofer Institute for Open Communication Systems (FhG Fokus).
@@ -30,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/patm/if_patm_attach.c 314667 2017-03-04 13:03:31Z avg $");
 
 #include "opt_inet.h"
 #include "opt_natm.h"
@@ -207,7 +208,7 @@
 	mtx_init(&sc->tst_lock, "tst lock", NULL, MTX_DEF);
 	cv_init(&sc->vcc_cv, "vcc_close");
 
-	callout_init(&sc->tst_callout, CALLOUT_MPSAFE);
+	callout_init(&sc->tst_callout, 1);
 
 	sysctl_ctx_init(&sc->sysctl_ctx);
 

Modified: trunk/sys/dev/patm/if_patm_intr.c
===================================================================
--- trunk/sys/dev/patm/if_patm_intr.c	2018-05-27 23:25:47 UTC (rev 10083)
+++ trunk/sys/dev/patm/if_patm_intr.c	2018-05-27 23:27:20 UTC (rev 10084)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2003
  *	Fraunhofer Institute for Open Communication Systems (FhG Fokus).
@@ -30,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/patm/if_patm_intr.c 243857 2012-12-04 09:32:43Z glebius $");
 
 #include "opt_inet.h"
 #include "opt_natm.h"

Modified: trunk/sys/dev/patm/if_patm_ioctl.c
===================================================================
--- trunk/sys/dev/patm/if_patm_ioctl.c	2018-05-27 23:25:47 UTC (rev 10083)
+++ trunk/sys/dev/patm/if_patm_ioctl.c	2018-05-27 23:27:20 UTC (rev 10084)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2003
  *	Fraunhofer Institute for Open Communication Systems (FhG Fokus).
@@ -30,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/patm/if_patm_ioctl.c 148887 2005-08-09 10:20:02Z rwatson $");
 
 #include "opt_inet.h"
 #include "opt_natm.h"

Modified: trunk/sys/dev/patm/if_patm_rtables.c
===================================================================
--- trunk/sys/dev/patm/if_patm_rtables.c	2018-05-27 23:25:47 UTC (rev 10083)
+++ trunk/sys/dev/patm/if_patm_rtables.c	2018-05-27 23:27:20 UTC (rev 10084)
@@ -1,9 +1,10 @@
+/* $MidnightBSD$ */
 /*
  * This file was generated by `genrtables/genrtab'
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/patm/if_patm_rtables.c 126816 2004-03-10 17:03:27Z bms $");
 
 #include <sys/types.h>
 

Modified: trunk/sys/dev/patm/if_patm_rx.c
===================================================================
--- trunk/sys/dev/patm/if_patm_rx.c	2018-05-27 23:25:47 UTC (rev 10083)
+++ trunk/sys/dev/patm/if_patm_rx.c	2018-05-27 23:27:20 UTC (rev 10084)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2003
  *	Fraunhofer Institute for Open Communication Systems (FhG Fokus).
@@ -30,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/patm/if_patm_rx.c 243857 2012-12-04 09:32:43Z glebius $");
 
 #include "opt_inet.h"
 #include "opt_natm.h"

Modified: trunk/sys/dev/patm/if_patm_tx.c
===================================================================
--- trunk/sys/dev/patm/if_patm_tx.c	2018-05-27 23:25:47 UTC (rev 10083)
+++ trunk/sys/dev/patm/if_patm_tx.c	2018-05-27 23:27:20 UTC (rev 10084)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2003
  *	Fraunhofer Institute for Open Communication Systems (FhG Fokus).
@@ -38,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/patm/if_patm_tx.c 254804 2013-08-24 19:51:18Z andre $");
 
 #include "opt_inet.h"
 #include "opt_natm.h"
@@ -373,7 +374,7 @@
 		}
 
 		/* save data */
-		m->m_pkthdr.header = vcc;
+		m->m_pkthdr.PH_loc.ptr = vcc;
 
 		/* try to put it on the channels queue */
 		if (_IF_QFULL(&vcc->scd->q)) {
@@ -473,7 +474,7 @@
 		if (m == NULL)
 			break;
 
-		a.vcc = m->m_pkthdr.header;
+		a.vcc = m->m_pkthdr.PH_loc.ptr;
 
 		/* we must know the number of segments beforehand - count
 		 * this may actually give a wrong number of segments for
@@ -499,7 +500,7 @@
 		}
 
 		/* load the map */
-		m->m_pkthdr.header = map;
+		m->m_pkthdr.PH_loc.ptr = map;
 		a.mbuf = m;
 
 		/* handle AAL_RAW */
@@ -690,7 +691,7 @@
 		scd->on_card[last] = NULL;
 		patm_debug(sc, TX, "ok tag=%x", last);
 
-		map = m->m_pkthdr.header;
+		map = m->m_pkthdr.PH_loc.ptr;
 		scd->space += m->m_pkthdr.csum_data;
 
 		bus_dmamap_sync(sc->tx_tag, map->map,

Modified: trunk/sys/dev/patm/if_patmvar.h
===================================================================
--- trunk/sys/dev/patm/if_patmvar.h	2018-05-27 23:25:47 UTC (rev 10083)
+++ trunk/sys/dev/patm/if_patmvar.h	2018-05-27 23:27:20 UTC (rev 10084)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2003
  *	Fraunhofer Institute for Open Communication Systems (FhG Fokus).
@@ -26,7 +27,7 @@
  *
  * Author: Hartmut Brandt <harti at freebsd.org>
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/patm/if_patmvar.h 147256 2005-06-10 16:49:24Z brooks $
  *
  * Driver for IDT77252 (ABR) based cards like ProSum's.
  */

Modified: trunk/sys/dev/pbio/pbio.c
===================================================================
--- trunk/sys/dev/pbio/pbio.c	2018-05-27 23:25:47 UTC (rev 10083)
+++ trunk/sys/dev/pbio/pbio.c	2018-05-27 23:27:20 UTC (rev 10084)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  *  Copyright (c) 2000-2004
  *          Diomidis D. Spinellis, Athens, Greece
@@ -25,11 +26,11 @@
  *  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  *  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $Id: pbio.c,v 1.2 2013-01-08 03:53:25 laffer1 Exp $
+ * $Id: pbio.c,v 1.12 2003/10/11 13:05:08 dds Exp dds $
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/pbio/pbio.c 183397 2008-09-27 08:51:18Z ed $");
 
 #include <sys/param.h>
 #include <sys/systm.h>

Modified: trunk/sys/dev/pbio/pbioio.h
===================================================================
--- trunk/sys/dev/pbio/pbioio.h	2018-05-27 23:25:47 UTC (rev 10083)
+++ trunk/sys/dev/pbio/pbioio.h	2018-05-27 23:27:20 UTC (rev 10084)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  *  Copyright (c) 2000-2004
  *          Diomidis D. Spinellis, Athens, Greece
@@ -25,7 +26,7 @@
  *  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  *  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/pbio/pbioio.h 139749 2005-01-06 01:43:34Z imp $
  *
  */
 

Modified: trunk/sys/dev/pccard/card_if.m
===================================================================
--- trunk/sys/dev/pccard/card_if.m	2018-05-27 23:25:47 UTC (rev 10083)
+++ trunk/sys/dev/pccard/card_if.m	2018-05-27 23:27:20 UTC (rev 10084)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 #-
 # Copyright (c) 1999 M. Warner Losh.
 # All rights reserved.
@@ -23,7 +24,7 @@
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 #
-# $MidnightBSD$
+# $FreeBSD: stable/10/sys/dev/pccard/card_if.m 201453 2010-01-03 23:31:58Z imp $
 #
 
 #include <sys/bus.h>


Property changes on: trunk/sys/dev/pccard/card_if.m
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/sys/dev/pccard/pccard.c
===================================================================
--- trunk/sys/dev/pccard/pccard.c	2018-05-27 23:25:47 UTC (rev 10083)
+++ trunk/sys/dev/pccard/pccard.c	2018-05-27 23:27:20 UTC (rev 10084)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*	$NetBSD: pcmcia.c,v 1.23 2000/07/28 19:17:02 drochner Exp $	*/
 
 /*-
@@ -30,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/pccard/pccard.c 237692 2012-06-28 07:26:44Z imp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -473,6 +474,8 @@
 	struct resource_list *rl = &devi->resources;
 	struct resource_list_entry *rle;
 	struct resource *r = 0;
+	struct pccard_ce_iospace *ios;
+	struct pccard_ce_memspace *mems;
 	device_t bus;
 	u_long start, end, len;
 	int i, rid, spaces;
@@ -501,22 +504,24 @@
 			continue;
 		spaces = 0;
 		for (i = 0; i < cfe->num_iospace; i++) {
-			start = cfe->iospace[i].start;
+			ios = cfe->iospace + i;
+			start = ios->start;
 			if (start)
-				end = start + cfe->iospace[i].length - 1;
+				end = start + ios->length - 1;
 			else
 				end = ~0UL;
 			DEVPRINTF((bus, "I/O rid %d start %#lx end %#lx\n",
 			    i, start, end));
 			rid = i;
-			len = cfe->iospace[i].length;
+			len = ios->length;
 			r = bus_alloc_resource(bus, SYS_RES_IOPORT, &rid,
 			    start, end, len, rman_make_alignment_flags(len));
-			if (r == NULL)
+			if (r == NULL) {
+				DEVPRINTF((bus, "I/O rid %d failed\n", i));
 				goto not_this_one;
+			}
 			rle = resource_list_add(rl, SYS_RES_IOPORT,
-			    rid, rman_get_start(r), rman_get_end(r),
-			    cfe->iospace[i].length);
+			    rid, rman_get_start(r), rman_get_end(r), len);
 			if (rle == NULL)
 				panic("Cannot add resource rid %d IOPORT", rid);
 			rle->res = r;
@@ -523,22 +528,26 @@
 			spaces++;
 		}
 		for (i = 0; i < cfe->num_memspace; i++) {
-			start = cfe->memspace[i].hostaddr;
+			mems = cfe->memspace + i;
+			start = mems->cardaddr + mems->hostaddr;
 			if (start)
-				end = start + cfe->memspace[i].length - 1;
+				end = start + mems->length - 1;
 			else
 				end = ~0UL;
-			DEVPRINTF((bus, "Memory rid %d start %#lx end %#lx\n",
-			    i, start, end));
+			DEVPRINTF((bus, "Memory rid %d start %#lx end %#lx\ncardaddr %#lx hostaddr %#lx length %#lx\n",
+			    i, start, end, mems->cardaddr, mems->hostaddr,
+			    mems->length));
 			rid = i;
-			len = cfe->memspace[i].length;
+			len = mems->length;
 			r = bus_alloc_resource(bus, SYS_RES_MEMORY, &rid,
 			    start, end, len, rman_make_alignment_flags(len));
-			if (r == NULL)
-				goto not_this_one;
+			if (r == NULL) {
+				DEVPRINTF((bus, "Memory rid %d failed\n", i));
+//				goto not_this_one;
+				continue;
+			}
 			rle = resource_list_add(rl, SYS_RES_MEMORY,
-			    rid, rman_get_start(r), rman_get_end(r),
-			    cfe->memspace[i].length);
+			    rid, rman_get_start(r), rman_get_end(r), len);
 			if (rle == NULL)
 				panic("Cannot add resource rid %d MEM", rid);
 			rle->res = r;
@@ -552,8 +561,10 @@
 			rid = 0;
 			r = bus_alloc_resource_any(bus, SYS_RES_IRQ, &rid,
 			    RF_SHAREABLE);
-			if (r == NULL)
+			if (r == NULL) {
+				DEVPRINTF((bus, "IRQ rid %d failed\n", rid));
 				goto not_this_one;
+			}
 			rle = resource_list_add(rl, SYS_RES_IRQ, rid,
 			    rman_get_start(r), rman_get_end(r), 1);
 			if (rle == NULL)

Modified: trunk/sys/dev/pccard/pccard_cis.c
===================================================================
--- trunk/sys/dev/pccard/pccard_cis.c	2018-05-27 23:25:47 UTC (rev 10083)
+++ trunk/sys/dev/pccard/pccard_cis.c	2018-05-27 23:27:20 UTC (rev 10084)
@@ -1,5 +1,6 @@
+/* $MidnightBSD$ */
 /* $NetBSD: pcmcia_cis.c,v 1.17 2000/02/10 09:01:52 chopps Exp $ */
-/* $MidnightBSD$ */
+/* $FreeBSD: stable/10/sys/dev/pccard/pccard_cis.c 189682 2009-03-11 08:14:44Z imp $ */
 
 /*-
  * Copyright (c) 1997 Marc Horowitz.  All rights reserved.

Modified: trunk/sys/dev/pccard/pccard_cis.h
===================================================================
--- trunk/sys/dev/pccard/pccard_cis.h	2018-05-27 23:25:47 UTC (rev 10083)
+++ trunk/sys/dev/pccard/pccard_cis.h	2018-05-27 23:27:20 UTC (rev 10084)
@@ -1,4 +1,5 @@
 /* $MidnightBSD$ */
+/* $FreeBSD: stable/10/sys/dev/pccard/pccard_cis.h 147962 2005-07-13 14:59:06Z imp $ */
 
 /*-
  * Copyright (c) 1997 Marc Horowitz.  All rights reserved.

Modified: trunk/sys/dev/pccard/pccard_cis_quirks.c
===================================================================
--- trunk/sys/dev/pccard/pccard_cis_quirks.c	2018-05-27 23:25:47 UTC (rev 10083)
+++ trunk/sys/dev/pccard/pccard_cis_quirks.c	2018-05-27 23:27:20 UTC (rev 10084)
@@ -1,7 +1,8 @@
+/* $MidnightBSD$ */
 /*	$NetBSD: pcmcia_cis_quirks.c,v 1.6 2000/04/12 21:07:55 scw Exp $ */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/pccard/pccard_cis_quirks.c 182142 2008-08-25 04:59:43Z imp $");
 
 #define	PCCARDDEBUG
 

Modified: trunk/sys/dev/pccard/pccard_device.c
===================================================================
--- trunk/sys/dev/pccard/pccard_device.c	2018-05-27 23:25:47 UTC (rev 10083)
+++ trunk/sys/dev/pccard/pccard_device.c	2018-05-27 23:27:20 UTC (rev 10084)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2005, M. Warner Losh
  * All rights reserved.
@@ -26,7 +27,7 @@
  *
  */
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/pccard/pccard_device.c 150432 2005-09-21 20:08:24Z imp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>

Modified: trunk/sys/dev/pccard/pccarddevs
===================================================================
--- trunk/sys/dev/pccard/pccarddevs	2018-05-27 23:25:47 UTC (rev 10083)
+++ trunk/sys/dev/pccard/pccarddevs	2018-05-27 23:27:20 UTC (rev 10084)
@@ -1,4 +1,5 @@
 $MidnightBSD$
+$FreeBSD: stable/10/sys/dev/pccard/pccarddevs 191468 2009-04-24 17:27:45Z imp $
 /* $NetBSD: pcmciadevs,v 1.226 2008/06/19 18:20:33 imp Exp $ */
 /* $OpenBSD: pcmciadevs,v 1.93 2002/06/21 08:31:10 henning Exp $ */
 


Property changes on: trunk/sys/dev/pccard/pccarddevs
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/sys/dev/pccard/pccardreg.h
===================================================================
--- trunk/sys/dev/pccard/pccardreg.h	2018-05-27 23:25:47 UTC (rev 10083)
+++ trunk/sys/dev/pccard/pccardreg.h	2018-05-27 23:27:20 UTC (rev 10084)
@@ -1,5 +1,6 @@
+/* $MidnightBSD$ */
 /*	$NetBSD: pcmciareg.h,v 1.7 1998/10/29 09:45:52 enami Exp $	*/
-/* $MidnightBSD$ */
+/* $FreeBSD: stable/10/sys/dev/pccard/pccardreg.h 139749 2005-01-06 01:43:34Z imp $ */
 
 /*-
  * Copyright (c) 1997 Marc Horowitz.  All rights reserved.

Modified: trunk/sys/dev/pccard/pccardvar.h
===================================================================
--- trunk/sys/dev/pccard/pccardvar.h	2018-05-27 23:25:47 UTC (rev 10083)
+++ trunk/sys/dev/pccard/pccardvar.h	2018-05-27 23:27:20 UTC (rev 10084)
@@ -1,5 +1,6 @@
+/* $MidnightBSD$ */
 /*	$NetBSD: pcmciavar.h,v 1.12 2000/02/08 12:51:31 enami Exp $	*/
-/* $MidnightBSD$ */
+/* $FreeBSD: stable/10/sys/dev/pccard/pccardvar.h 228471 2011-12-13 14:06:01Z ed $ */
 
 /*-
  * Copyright (c) 1997 Marc Horowitz.  All rights reserved.
@@ -106,7 +107,7 @@
  * make this inline so that we don't have to worry about dangling references
  * to it in the modules or the code.
  */
-static __inline const struct pccard_product *
+static inline const struct pccard_product *
 pccard_product_lookup(device_t dev, const struct pccard_product *tab,
     size_t ent_size, pccard_product_match_fn matchfn)
 {
@@ -150,31 +151,31 @@
 
 /* Convenience functions */
 
-static __inline int
+static inline int
 pccard_cis_scan(device_t dev, pccard_scan_t fct, void *arg)
 {
 	return (CARD_CIS_SCAN(device_get_parent(dev), dev, fct, arg));
 }
 
-static __inline int
+static inline int
 pccard_attr_read_1(device_t dev, uint32_t offset, uint8_t *val)
 {
 	return (CARD_ATTR_READ(device_get_parent(dev), dev, offset, val));
 }
 
-static __inline int
+static inline int
 pccard_attr_write_1(device_t dev, uint32_t offset, uint8_t val)
 {
 	return (CARD_ATTR_WRITE(device_get_parent(dev), dev, offset, val));
 }
 
-static __inline int
+static inline int
 pccard_ccr_read_1(device_t dev, uint32_t offset, uint8_t *val)
 {
 	return (CARD_CCR_READ(device_get_parent(dev), dev, offset, val));
 }
 
-static __inline int
+static inline int
 pccard_ccr_write_1(device_t dev, uint32_t offset, uint8_t val)
 {
 	return (CARD_CCR_WRITE(device_get_parent(dev), dev, offset, val));
@@ -199,7 +200,7 @@
 };
 
 #define PCCARD_ACCESSOR(A, B, T)					\
-__inline static int							\
+static inline int							\
 pccard_get_ ## A(device_t dev, T *t)					\
 {									\
 	return BUS_READ_IVAR(device_get_parent(dev), dev,		\

Modified: trunk/sys/dev/pccard/pccardvarp.h
===================================================================
--- trunk/sys/dev/pccard/pccardvarp.h	2018-05-27 23:25:47 UTC (rev 10083)
+++ trunk/sys/dev/pccard/pccardvarp.h	2018-05-27 23:27:20 UTC (rev 10084)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2005, M. Warner Losh
  * All rights reserved.
@@ -24,7 +25,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/pccard/pccardvarp.h 237692 2012-06-28 07:26:44Z imp $
  */
 
 #ifndef _PCCARD_PCCARDVARP_H
@@ -47,12 +48,22 @@
 #define PCCARD_CFE_READONLY		0x0400
 #define PCCARD_CFE_AUDIO		0x0800
 
+struct pccard_ce_iospace {
+	u_long	length;
+	u_long	start;
+};
+
+struct pccard_ce_memspace {
+	u_long	length;
+	u_long	cardaddr;
+	u_long	hostaddr;
+};
+
 struct pccard_config_entry {
 	int		number;
 	uint32_t	flags;
 	int		iftype;
 	int		num_iospace;
-
 	/*
 	 * The card will only decode this mask in any case, so we can
 	 * do dynamic allocation with this in mind, in case the suggestions
@@ -59,17 +70,10 @@
 	 * below are no good.
 	 */
 	u_long		iomask;
-	struct {
-		u_long	length;
-		u_long	start;
-	} iospace[4];		/* XXX this could be as high as 16 */
+	struct pccard_ce_iospace iospace[4]; /* XXX up to 16 */
 	uint16_t	irqmask;
 	int		num_memspace;
-	struct {
-		u_long	length;
-		u_long	cardaddr;
-		u_long	hostaddr;
-	} memspace[2];		/* XXX this could be as high as 8 */
+	struct pccard_ce_memspace memspace[2];	/* XXX up to 8 */
 	int		maxtwins;
 	STAILQ_ENTRY(pccard_config_entry) cfe_list;
 };

Modified: trunk/sys/dev/pccard/power_if.m
===================================================================
--- trunk/sys/dev/pccard/power_if.m	2018-05-27 23:25:47 UTC (rev 10083)
+++ trunk/sys/dev/pccard/power_if.m	2018-05-27 23:27:20 UTC (rev 10084)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 #-
 # Copyright (c) 1999 M. Warner Losh.
 # All rights reserved.
@@ -23,7 +24,7 @@
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 #
-# $MidnightBSD$
+# $FreeBSD: stable/10/sys/dev/pccard/power_if.m 139749 2005-01-06 01:43:34Z imp $
 #
 
 #include <sys/bus.h>


Property changes on: trunk/sys/dev/pccard/power_if.m
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/sys/dev/pccbb/pccbb.c
===================================================================
--- trunk/sys/dev/pccbb/pccbb.c	2018-05-27 23:25:47 UTC (rev 10083)
+++ trunk/sys/dev/pccbb/pccbb.c	2018-05-27 23:27:20 UTC (rev 10084)
@@ -76,7 +76,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/pccbb/pccbb.c 284034 2015-06-05 17:05:09Z jhb $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -98,6 +98,7 @@
 
 #include <dev/pci/pcireg.h>
 #include <dev/pci/pcivar.h>
+#include <dev/pci/pcib_private.h>
 
 #include <dev/pccard/pccardreg.h>
 #include <dev/pccard/pccardvar.h>
@@ -461,6 +462,13 @@
 	int err;
 	int not_a_card = 0;
 
+	/*
+	 * We need to act as a power sequencer on startup.  Delay 2s/channel
+	 * to ensure the other channels have had a chance to come up.  We likely
+	 * should add a lock that's shared on a per-slot basis so that only
+	 * one power event can happen per slot at a time.
+	 */
+	pause("cbbstart", hz * device_get_unit(sc->dev) * 2);
 	mtx_lock(&sc->mtx);
 	sc->flags |= CBB_KTHREAD_RUNNING;
 	while ((sc->flags & CBB_KTHREAD_DONE) == 0) {
@@ -989,8 +997,6 @@
 	 * a cardbus bus, so that's the only register we check here.
 	 */
 	if (on && CBB_CARD_PRESENT(cbb_get(sc, CBB_SOCKET_STATE))) {
-		/*
-		 */
 		PCI_MASK_CONFIG(brdev, CBBR_BRIDGECTRL,
 		    &~CBBM_BRIDGECTRL_RESET, 2);
 		b = pcib_get_bus(child);
@@ -1032,6 +1038,13 @@
 /* CardBus Resource							*/
 /************************************************************************/
 
+static void
+cbb_activate_window(device_t brdev, int type)
+{
+
+	PCI_ENABLE_IO(device_get_parent(brdev), brdev, type);
+}
+
 static int
 cbb_cardbus_io_open(device_t brdev, int win, uint32_t start, uint32_t end)
 {
@@ -1049,6 +1062,7 @@
 
 	pci_write_config(brdev, basereg, start, 4);
 	pci_write_config(brdev, limitreg, end, 4);
+	cbb_activate_window(brdev, SYS_RES_IOPORT);
 	return (0);
 }
 
@@ -1069,6 +1083,7 @@
 
 	pci_write_config(brdev, basereg, start, 4);
 	pci_write_config(brdev, limitreg, end, 4);
+	cbb_activate_window(brdev, SYS_RES_MEMORY);
 	return (0);
 }
 
@@ -1336,7 +1351,12 @@
     struct resource *res)
 {
 	struct cbb_softc *sc = device_get_softc(brdev);
-	return (exca_activate_resource(&sc->exca[0], child, type, rid, res));
+	int error;
+
+	error = exca_activate_resource(&sc->exca[0], child, type, rid, res);
+	if (error == 0)
+		cbb_activate_window(brdev, type);
+	return (error);
 }
 
 static int
@@ -1528,7 +1548,7 @@
 		*result = sc->domain;
 		return (0);
 	case PCIB_IVAR_BUS:
-		*result = sc->secbus;
+		*result = sc->bus.sec;
 		return (0);
 	}
 	return (ENOENT);
@@ -1537,70 +1557,17 @@
 int
 cbb_write_ivar(device_t brdev, device_t child, int which, uintptr_t value)
 {
-	struct cbb_softc *sc = device_get_softc(brdev);
 
 	switch (which) {
 	case PCIB_IVAR_DOMAIN:
 		return (EINVAL);
 	case PCIB_IVAR_BUS:
-		sc->secbus = value;
-		return (0);
+		return (EINVAL);
 	}
 	return (ENOENT);
 }
 
 int
-cbb_suspend(device_t self)
-{
-	int			error = 0;
-	struct cbb_softc	*sc = device_get_softc(self);
-
-	error = bus_generic_suspend(self);
-	if (error != 0)
-		return (error);
-	cbb_set(sc, CBB_SOCKET_MASK, 0);	/* Quiet hardware */
-	sc->cardok = 0;				/* Card is bogus now */
-	return (0);
-}
-
-int
-cbb_resume(device_t self)
-{
-	int	error = 0;
-	struct cbb_softc *sc = (struct cbb_softc *)device_get_softc(self);
-	uint32_t tmp;
-
-	/*
-	 * Some BIOSes will not save the BARs for the pci chips, so we
-	 * must do it ourselves.  If the BAR is reset to 0 for an I/O
-	 * device, it will read back as 0x1, so no explicit test for
-	 * memory devices are needed.
-	 *
-	 * Note: The PCI bus code should do this automatically for us on
-	 * suspend/resume, but until it does, we have to cope.
-	 */
-	pci_write_config(self, CBBR_SOCKBASE, rman_get_start(sc->base_res), 4);
-	DEVPRINTF((self, "PCI Memory allocated: %08lx\n",
-	    rman_get_start(sc->base_res)));
-
-	sc->chipinit(sc);
-
-	/* reset interrupt -- Do we really need to do this? */
-	tmp = cbb_get(sc, CBB_SOCKET_EVENT);
-	cbb_set(sc, CBB_SOCKET_EVENT, tmp);
-
-	/* CSC Interrupt: Card detect interrupt on */
-	cbb_setb(sc, CBB_SOCKET_MASK, CBB_SOCKET_MASK_CD);
-
-	/* Signal the thread to wakeup. */
-	wakeup(&sc->intrhand);
-
-	error = bus_generic_resume(self);
-
-	return (error);
-}
-
-int
 cbb_child_present(device_t parent, device_t child)
 {
 	struct cbb_softc *sc = (struct cbb_softc *)device_get_softc(parent);

Modified: trunk/sys/dev/pccbb/pccbb_isa.c
===================================================================
--- trunk/sys/dev/pccbb/pccbb_isa.c	2018-05-27 23:25:47 UTC (rev 10083)
+++ trunk/sys/dev/pccbb/pccbb_isa.c	2018-05-27 23:27:20 UTC (rev 10084)
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/pccbb/pccbb_isa.c 284034 2015-06-05 17:05:09Z jhb $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -52,6 +52,9 @@
 
 #include <isa/isavar.h>
 
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pcib_private.h>
+
 #include <dev/pccard/pccardreg.h>
 #include <dev/pccard/pccardvar.h>
 
@@ -203,13 +206,25 @@
 	return (ENOMEM);
 }
 
+static int
+cbb_isa_suspend(device_t dev)
+{
+	return (0);
+}
+
+static int
+cbb_isa_resume(device_t dev)
+{
+	return (0);
+}
+
 static device_method_t cbb_methods[] = {
 	/* Device interface */
 	DEVMETHOD(device_probe,			cbb_isa_probe),
 	DEVMETHOD(device_attach,		cbb_isa_attach),
 	DEVMETHOD(device_detach,		cbb_detach),
-	DEVMETHOD(device_suspend,		cbb_suspend),
-	DEVMETHOD(device_resume,		cbb_resume),
+	DEVMETHOD(device_suspend,		cbb_isa_suspend),
+	DEVMETHOD(device_resume,		cbb_isa_resume),
 
 	/* bus methods */
 	DEVMETHOD(bus_read_ivar,		cbb_read_ivar),

Modified: trunk/sys/dev/pccbb/pccbb_pci.c
===================================================================
--- trunk/sys/dev/pccbb/pccbb_pci.c	2018-05-27 23:25:47 UTC (rev 10083)
+++ trunk/sys/dev/pccbb/pccbb_pci.c	2018-05-27 23:27:20 UTC (rev 10084)
@@ -73,7 +73,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/pccbb/pccbb_pci.c 300060 2016-05-17 15:18:01Z pfg $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -94,6 +94,7 @@
 
 #include <dev/pci/pcireg.h>
 #include <dev/pci/pcivar.h>
+#include <dev/pci/pcib_private.h>
 
 #include <dev/pccard/pccardreg.h>
 #include <dev/pccard/pccardvar.h>
@@ -304,13 +305,15 @@
 static int
 cbb_pci_attach(device_t brdev)
 {
+#if !(defined(NEW_PCIB) && defined(PCI_RES_BUS))
 	static int curr_bus_number = 2; /* XXX EVILE BAD (see below) */
+	uint32_t pribus;
+#endif
 	struct cbb_softc *sc = (struct cbb_softc *)device_get_softc(brdev);
 	struct sysctl_ctx_list *sctx;
 	struct sysctl_oid *soid;
 	int rid;
 	device_t parent;
-	uint32_t pribus;
 
 	parent = device_get_parent(brdev);
 	mtx_init(&sc->mtx, device_get_nameunit(brdev), "cbb", MTX_DEF);
@@ -319,9 +322,13 @@
 	sc->cbdev = NULL;
 	sc->exca[0].pccarddev = NULL;
 	sc->domain = pci_get_domain(brdev);
-	sc->secbus = pci_read_config(brdev, PCIR_SECBUS_2, 1);
-	sc->subbus = pci_read_config(brdev, PCIR_SUBBUS_2, 1);
+	sc->bus.sec = pci_read_config(brdev, PCIR_SECBUS_2, 1);
+	sc->bus.sub = pci_read_config(brdev, PCIR_SUBBUS_2, 1);
 	sc->pribus = pcib_get_bus(parent);
+#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
+	pci_write_config(brdev, PCIR_PRIBUS_2, sc->pribus, 1);
+	pcib_setup_secbus(brdev, &sc->bus, 1);
+#endif
 	SLIST_INIT(&sc->rl);
 	cbb_powerstate_d0(brdev);
 
@@ -353,14 +360,14 @@
 	SYSCTL_ADD_UINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "pribus",
 	    CTLFLAG_RD, &sc->pribus, 0, "Primary bus number");
 	SYSCTL_ADD_UINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "secbus",
-	    CTLFLAG_RD, &sc->secbus, 0, "Secondary bus number");
+	    CTLFLAG_RD, &sc->bus.sec, 0, "Secondary bus number");
 	SYSCTL_ADD_UINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "subbus",
-	    CTLFLAG_RD, &sc->subbus, 0, "Subordinate bus number");
+	    CTLFLAG_RD, &sc->bus.sub, 0, "Subordinate bus number");
 #if 0
 	SYSCTL_ADD_UINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "memory",
 	    CTLFLAG_RD, &sc->subbus, 0, "Memory window open");
 	SYSCTL_ADD_UINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "premem",
-	    CTLFLAG_RD, &sc->subbus, 0, "Prefetch memroy window open");
+	    CTLFLAG_RD, &sc->subbus, 0, "Prefetch memory window open");
 	SYSCTL_ADD_UINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "io1",
 	    CTLFLAG_RD, &sc->subbus, 0, "io range 1 open");
 	SYSCTL_ADD_UINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "io2",
@@ -367,6 +374,7 @@
 	    CTLFLAG_RD, &sc->subbus, 0, "io range 2 open");
 #endif
 
+#if !(defined(NEW_PCIB) && defined(PCI_RES_BUS))
 	/*
 	 * This is a gross hack.  We should be scanning the entire pci
 	 * tree, assigning bus numbers in a way such that we (1) can
@@ -373,9 +381,9 @@
 	 * reserve 1 extra bus just in case and (2) all sub busses
 	 * are in an appropriate range.
 	 */
-	DEVPRINTF((brdev, "Secondary bus is %d\n", sc->secbus));
+	DEVPRINTF((brdev, "Secondary bus is %d\n", sc->bus.sec));
 	pribus = pci_read_config(brdev, PCIR_PRIBUS_2, 1);
-	if (sc->secbus == 0 || sc->pribus != pribus) {
+	if (sc->bus.sec == 0 || sc->pribus != pribus) {
 		if (curr_bus_number <= sc->pribus)
 			curr_bus_number = sc->pribus + 1;
 		if (pribus != sc->pribus) {
@@ -383,13 +391,14 @@
 			    sc->pribus));
 			pci_write_config(brdev, PCIR_PRIBUS_2, sc->pribus, 1);
 		}
-		sc->secbus = curr_bus_number++;
-		sc->subbus = curr_bus_number++;
+		sc->bus.sec = curr_bus_number++;
+		sc->bus.sub = curr_bus_number++;
 		DEVPRINTF((brdev, "Secondary bus set to %d subbus %d\n",
-		    sc->secbus, sc->subbus));
-		pci_write_config(brdev, PCIR_SECBUS_2, sc->secbus, 1);
-		pci_write_config(brdev, PCIR_SUBBUS_2, sc->subbus, 1);
+		    sc->bus.sec, sc->bus.sub));
+		pci_write_config(brdev, PCIR_SECBUS_2, sc->bus.sec, 1);
+		pci_write_config(brdev, PCIR_SUBBUS_2, sc->bus.sub, 1);
 	}
+#endif
 
 	/* attach children */
 	sc->cbdev = device_add_child(brdev, "cardbus", -1);
@@ -459,8 +468,8 @@
 	uint32_t mux, sysctrl, reg;
 
 	/* Set CardBus latency timer */
-	if (pci_read_config(sc->dev, PCIR_SECLAT_1, 1) < 0x20)
-		pci_write_config(sc->dev, PCIR_SECLAT_1, 0x20, 1);
+	if (pci_read_config(sc->dev, PCIR_SECLAT_2, 1) < 0x20)
+		pci_write_config(sc->dev, PCIR_SECLAT_2, 0x20, 1);
 
 	/* Set PCI latency timer */
 	if (pci_read_config(sc->dev, PCIR_LATTIMER, 1) < 0x20)
@@ -468,14 +477,13 @@
 
 	/* Restore bus configuration */
 	pci_write_config(sc->dev, PCIR_PRIBUS_2, sc->pribus, 1);
-	pci_write_config(sc->dev, PCIR_SECBUS_2, sc->secbus, 1);
-	pci_write_config(sc->dev, PCIR_SUBBUS_2, sc->subbus, 1);
+	pci_write_config(sc->dev, PCIR_SECBUS_2, sc->bus.sec, 1);
+	pci_write_config(sc->dev, PCIR_SUBBUS_2, sc->bus.sub, 1);
 
-	/* Enable memory access */
-	PCI_MASK_CONFIG(sc->dev, PCIR_COMMAND,
-	    | PCIM_CMD_MEMEN
-	    | PCIM_CMD_PORTEN
-	    | PCIM_CMD_BUSMASTEREN, 2);
+	/* Enable DMA, memory access for this card and I/O acces for children */
+	pci_enable_busmaster(sc->dev);
+	pci_enable_io(sc->dev, SYS_RES_IOPORT);
+	pci_enable_io(sc->dev, SYS_RES_MEMORY);
 
 	/* disable Legacy IO */
 	switch (sc->chipset) {
@@ -787,6 +795,58 @@
 	return retval;
 }
 
+#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
+static struct resource *
+cbb_pci_alloc_resource(device_t bus, device_t child, int type, int *rid,
+    u_long start, u_long end, u_long count, u_int flags)
+{
+	struct cbb_softc *sc;
+
+	sc = device_get_softc(bus);
+	if (type == PCI_RES_BUS)
+		return (pcib_alloc_subbus(&sc->bus, child, rid, start, end,
+		    count, flags));
+	return (cbb_alloc_resource(bus, child, type, rid, start, end, count,
+	    flags));
+}
+
+static int
+cbb_pci_adjust_resource(device_t bus, device_t child, int type,
+    struct resource *r, u_long start, u_long end)
+{
+	struct cbb_softc *sc;
+
+	sc = device_get_softc(bus);
+	if (type == PCI_RES_BUS) {
+		if (!rman_is_region_manager(r, &sc->bus.rman))
+			return (EINVAL);
+		return (rman_adjust_resource(r, start, end));
+	}
+	return (bus_generic_adjust_resource(bus, child, type, r, start, end));
+}
+
+static int
+cbb_pci_release_resource(device_t bus, device_t child, int type, int rid,
+    struct resource *r)
+{
+	struct cbb_softc *sc;
+	int error;
+
+	sc = device_get_softc(bus);
+	if (type == PCI_RES_BUS) {
+		if (!rman_is_region_manager(r, &sc->bus.rman))
+			return (EINVAL);
+		if (rman_get_flags(r) & RF_ACTIVE) {
+			error = bus_deactivate_resource(child, type, rid, r);
+			if (error)
+				return (error);
+		}
+		return (rman_release_resource(r));
+	}
+	return (cbb_release_resource(bus, child, type, rid, r));
+}
+#endif
+
 /************************************************************************/
 /* PCI compat methods							*/
 /************************************************************************/
@@ -818,6 +878,61 @@
 	    b, s, f, reg, val, width);
 }
 
+static int
+cbb_pci_suspend(device_t brdev)
+{
+	int			error = 0;
+	struct cbb_softc	*sc = device_get_softc(brdev);
+
+	error = bus_generic_suspend(brdev);
+	if (error != 0)
+		return (error);
+	cbb_set(sc, CBB_SOCKET_MASK, 0);	/* Quiet hardware */
+	sc->cardok = 0;				/* Card is bogus now */
+	return (0);
+}
+
+static int
+cbb_pci_resume(device_t brdev)
+{
+	int	error = 0;
+	struct cbb_softc *sc = (struct cbb_softc *)device_get_softc(brdev);
+	uint32_t tmp;
+
+	/*
+	 * In the APM and early ACPI era, BIOSes saved the PCI config
+	 * registers. As chips became more complicated, that functionality moved
+	 * into the ACPI code / tables. We must therefore, restore the settings
+	 * we made here to make sure the device come back. Transitions to Dx
+	 * from D0 and back to D0 cause the bridge to lose its config space, so
+	 * all the bus mappings and such are preserved.
+	 *
+	 * For most drivers, the PCI layer handles this saving. However, since
+	 * there's much black magic and arcane art hidden in these few lines of
+	 * code that would be difficult to transition into the PCI
+	 * layer. chipinit was several years of trial and error to write.
+	 */
+	pci_write_config(brdev, CBBR_SOCKBASE, rman_get_start(sc->base_res), 4);
+	DEVPRINTF((brdev, "PCI Memory allocated: %08lx\n",
+	    rman_get_start(sc->base_res)));
+
+	sc->chipinit(sc);
+
+	/* reset interrupt -- Do we really need to do this? */
+	tmp = cbb_get(sc, CBB_SOCKET_EVENT);
+	cbb_set(sc, CBB_SOCKET_EVENT, tmp);
+
+	/* CSC Interrupt: Card detect interrupt on */
+	cbb_setb(sc, CBB_SOCKET_MASK, CBB_SOCKET_MASK_CD);
+
+	/* Signal the thread to wakeup. */
+	wakeup(&sc->intrhand);
+
+	error = bus_generic_resume(brdev);
+
+	return (error);
+}
+
 static device_method_t cbb_methods[] = {
 	/* Device interface */
 	DEVMETHOD(device_probe,			cbb_pci_probe),
@@ -824,14 +939,20 @@
 	DEVMETHOD(device_attach,		cbb_pci_attach),
 	DEVMETHOD(device_detach,		cbb_detach),
 	DEVMETHOD(device_shutdown,		cbb_pci_shutdown),
-	DEVMETHOD(device_suspend,		cbb_suspend),
-	DEVMETHOD(device_resume,		cbb_resume),
+	DEVMETHOD(device_suspend,		cbb_pci_suspend),
+	DEVMETHOD(device_resume,		cbb_pci_resume),
 
 	/* bus methods */
 	DEVMETHOD(bus_read_ivar,		cbb_read_ivar),
 	DEVMETHOD(bus_write_ivar,		cbb_write_ivar),
+#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
+	DEVMETHOD(bus_alloc_resource,		cbb_pci_alloc_resource),
+	DEVMETHOD(bus_adjust_resource,		cbb_pci_adjust_resource),
+	DEVMETHOD(bus_release_resource,		cbb_pci_release_resource),
+#else
 	DEVMETHOD(bus_alloc_resource,		cbb_alloc_resource),
 	DEVMETHOD(bus_release_resource,		cbb_release_resource),
+#endif
 	DEVMETHOD(bus_activate_resource,	cbb_activate_resource),
 	DEVMETHOD(bus_deactivate_resource,	cbb_deactivate_resource),
 	DEVMETHOD(bus_driver_added,		cbb_driver_added),

Modified: trunk/sys/dev/pccbb/pccbbdevid.h
===================================================================
--- trunk/sys/dev/pccbb/pccbbdevid.h	2018-05-27 23:25:47 UTC (rev 10083)
+++ trunk/sys/dev/pccbb/pccbbdevid.h	2018-05-27 23:27:20 UTC (rev 10084)
@@ -1,4 +1,4 @@
-/* $MidnightBSD: src/sys/dev/pccbb/pccbbdevid.h,v 1.2 2008/12/02 02:47:53 laffer1 Exp $ */
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2001-2004 M. Warner Losh. All rights reserved.
  *
@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD$
+ * $FreeBSD: stable/10/sys/dev/pccbb/pccbbdevid.h 152193 2005-11-08 15:42:12Z imp $
  */
 
 /* Vendor/Device IDs */

Modified: trunk/sys/dev/pccbb/pccbbreg.h
===================================================================
--- trunk/sys/dev/pccbb/pccbbreg.h	2018-05-27 23:25:47 UTC (rev 10083)
+++ trunk/sys/dev/pccbb/pccbbreg.h	2018-05-27 23:27:20 UTC (rev 10084)
@@ -1,4 +1,4 @@
-/* $MidnightBSD: src/sys/dev/pccbb/pccbbreg.h,v 1.2 2008/12/02 02:47:53 laffer1 Exp $ */
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2000,2001 Jonathan Chen.
  * All rights reserved.
@@ -24,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD$
+ * $FreeBSD: stable/10/sys/dev/pccbb/pccbbreg.h 161241 2006-08-12 09:06:55Z imp $
  */
 
 /*

Modified: trunk/sys/dev/pccbb/pccbbvar.h
===================================================================
--- trunk/sys/dev/pccbb/pccbbvar.h	2018-05-27 23:25:47 UTC (rev 10083)
+++ trunk/sys/dev/pccbb/pccbbvar.h	2018-05-27 23:27:20 UTC (rev 10084)
@@ -1,4 +1,4 @@
-/* $MidnightBSD: src/sys/dev/pccbb/pccbbvar.h,v 1.2 2008/12/02 02:47:53 laffer1 Exp $ */
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2003-2004 Warner Losh.
  * Copyright (c) 2000,2001 Jonathan Chen.
@@ -25,7 +25,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD$
+ * $FreeBSD: stable/10/sys/dev/pccbb/pccbbvar.h 284034 2015-06-05 17:05:09Z jhb $
  */
 
 /*
@@ -65,8 +65,7 @@
 	bus_space_handle_t bsh;
 	uint32_t	domain;
 	unsigned int	pribus;
-	unsigned int	secbus;
-	unsigned int	subbus;
+	struct pcib_secbus bus;
 	struct mtx	mtx;
 	int		cardok;
 	u_int32_t	flags;
@@ -136,11 +135,9 @@
 	    uintptr_t *result);
 int	cbb_release_resource(device_t brdev, device_t child,
 	    int type, int rid, struct resource *r);
-int	cbb_resume(device_t self);
 int	cbb_setup_intr(device_t dev, device_t child, struct resource *irq,
 	    int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg,
 	    void **cookiep);
-int	cbb_suspend(device_t self);
 int	cbb_teardown_intr(device_t dev, device_t child, struct resource *irq,
 	    void *cookie);
 int	cbb_write_ivar(device_t brdev, device_t child, int which,

Modified: trunk/sys/dev/pcn/if_pcn.c
===================================================================
--- trunk/sys/dev/pcn/if_pcn.c	2018-05-27 23:25:47 UTC (rev 10083)
+++ trunk/sys/dev/pcn/if_pcn.c	2018-05-27 23:27:20 UTC (rev 10084)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2000 Berkeley Software Design, Inc.
  * Copyright (c) 1997, 1998, 1999, 2000
@@ -32,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/pcn/if_pcn.c 243857 2012-12-04 09:32:43Z glebius $");
 
 /*
  * AMD Am79c972 fast ethernet PCI NIC driver. Datasheets are available
@@ -966,7 +967,7 @@
 	mii_tick(mii);
 
 	/* link just died */
-	if (sc->pcn_link & !(mii->mii_media_status & IFM_ACTIVE))
+	if (sc->pcn_link && !(mii->mii_media_status & IFM_ACTIVE))
 		sc->pcn_link = 0;
 
 	/* link just came up, restart */

Modified: trunk/sys/dev/pcn/if_pcnreg.h
===================================================================
--- trunk/sys/dev/pcn/if_pcnreg.h	2018-05-27 23:25:47 UTC (rev 10083)
+++ trunk/sys/dev/pcn/if_pcnreg.h	2018-05-27 23:27:20 UTC (rev 10084)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2000 Berkeley Software Design, Inc.
  * Copyright (c) 1997, 1998, 1999, 2000
@@ -30,7 +31,7 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  * THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/pcn/if_pcnreg.h 199560 2009-11-19 22:14:23Z jhb $
  */
 
 /*

Modified: trunk/sys/dev/syscons/logo/beastie.c
===================================================================
--- trunk/sys/dev/syscons/logo/beastie.c	2018-05-27 23:25:47 UTC (rev 10083)
+++ trunk/sys/dev/syscons/logo/beastie.c	2018-05-27 23:27:20 UTC (rev 10084)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /* $FreeBSD$ */
 
 #define logo_width 88



More information about the Midnightbsd-cvs mailing list