Home | History | Annotate | Line # | Download | only in pci
ppb.c revision 1.65
      1 /*	$NetBSD: ppb.c,v 1.65 2019/01/27 02:08:42 pgoyette Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 1996, 1998 Christopher G. Demetriou.  All rights reserved.
      5  *
      6  * Redistribution and use in source and binary forms, with or without
      7  * modification, are permitted provided that the following conditions
      8  * are met:
      9  * 1. Redistributions of source code must retain the above copyright
     10  *    notice, this list of conditions and the following disclaimer.
     11  * 2. Redistributions in binary form must reproduce the above copyright
     12  *    notice, this list of conditions and the following disclaimer in the
     13  *    documentation and/or other materials provided with the distribution.
     14  * 3. All advertising materials mentioning features or use of this software
     15  *    must display the following acknowledgement:
     16  *      This product includes software developed by Christopher G. Demetriou
     17  *	for the NetBSD Project.
     18  * 4. The name of the author may not be used to endorse or promote products
     19  *    derived from this software without specific prior written permission
     20  *
     21  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     22  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     23  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     24  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     26  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     30  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     31  */
     32 
     33 #include <sys/cdefs.h>
     34 __KERNEL_RCSID(0, "$NetBSD: ppb.c,v 1.65 2019/01/27 02:08:42 pgoyette Exp $");
     35 
     36 #ifdef _KERNEL_OPT
     37 #include "opt_ppb.h"
     38 #endif
     39 
     40 #ifdef _KERNEL_OPT
     41 #include "opt_ppb.h"
     42 #endif
     43 
     44 #include <sys/param.h>
     45 #include <sys/systm.h>
     46 #include <sys/kernel.h>
     47 #include <sys/device.h>
     48 #include <sys/evcnt.h>
     49 
     50 #include <dev/pci/pcireg.h>
     51 #include <dev/pci/pcivar.h>
     52 #include <dev/pci/ppbreg.h>
     53 #include <dev/pci/ppbvar.h>
     54 #include <dev/pci/pcidevs.h>
     55 
     56 #define	PCIE_SLCSR_ENABLE_MASK					\
     57 	(PCIE_SLCSR_ABE | PCIE_SLCSR_PFE | PCIE_SLCSR_MSE |	\
     58 	 PCIE_SLCSR_PDE | PCIE_SLCSR_CCE | PCIE_SLCSR_HPE |	\
     59 	 PCIE_SLCSR_DLLSCE)
     60 
     61 #define	PCIE_SLCSR_STATCHG_MASK					\
     62 	(PCIE_SLCSR_ABP | PCIE_SLCSR_PFD | PCIE_SLCSR_MSC |	\
     63 	 PCIE_SLCSR_PDC | PCIE_SLCSR_CC | PCIE_SLCSR_LACS)
     64 
     65 static const char pcie_linkspeed_strings[4][5] = {
     66 	"1.25", "2.5", "5.0", "8.0",
     67 };
     68 
     69 int	ppb_printevent = 0; /* Print event type if the value is not 0 */
     70 
     71 static int	ppbmatch(device_t, cfdata_t, void *);
     72 static void	ppbattach(device_t, device_t, void *);
     73 static int	ppbdetach(device_t, int);
     74 static void	ppbchilddet(device_t, device_t);
     75 #ifdef PPB_USEINTR
     76 static int	ppb_intr(void *);
     77 #endif
     78 static bool	ppb_resume(device_t, const pmf_qual_t *);
     79 static bool	ppb_suspend(device_t, const pmf_qual_t *);
     80 
     81 CFATTACH_DECL3_NEW(ppb, sizeof(struct ppb_softc),
     82     ppbmatch, ppbattach, ppbdetach, NULL, NULL, ppbchilddet,
     83     DVF_DETACH_SHUTDOWN);
     84 
     85 static int
     86 ppbmatch(device_t parent, cfdata_t match, void *aux)
     87 {
     88 	struct pci_attach_args *pa = aux;
     89 
     90 	/*
     91 	 * Check the ID register to see that it's a PCI bridge.
     92 	 * If it is, we assume that we can deal with it; it _should_
     93 	 * work in a standardized way...
     94 	 */
     95 	if (PCI_CLASS(pa->pa_class) == PCI_CLASS_BRIDGE &&
     96 	    PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_BRIDGE_PCI)
     97 		return 1;
     98 
     99 #ifdef __powerpc__
    100 	if (PCI_CLASS(pa->pa_class) == PCI_CLASS_PROCESSOR &&
    101 	    PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_PROCESSOR_POWERPC) {
    102 		pcireg_t bhlc = pci_conf_read(pa->pa_pc, pa->pa_tag,
    103 		    PCI_BHLC_REG);
    104 		if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_FREESCALE
    105 		    && PCI_HDRTYPE(bhlc) == PCI_HDRTYPE_RC)
    106 		return 1;
    107 	}
    108 #endif
    109 
    110 #ifdef _MIPS_PADDR_T_64BIT
    111 	/* The LDT HB acts just like a PPB.  */
    112 	if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_SIBYTE
    113 	    && PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_SIBYTE_BCM1250_LDTHB)
    114 		return 1;
    115 #endif
    116 
    117 	return 0;
    118 }
    119 
    120 static void
    121 ppb_print_pcie(device_t self)
    122 {
    123 	struct ppb_softc *sc = device_private(self);
    124 	pcireg_t reg;
    125 	int off, capversion, devtype;
    126 
    127 	if (!pci_get_capability(sc->sc_pc, sc->sc_tag, PCI_CAP_PCIEXPRESS,
    128 				&off, &reg))
    129 		return; /* Not a PCIe device */
    130 
    131 	capversion = PCIE_XCAP_VER(reg);
    132 	devtype = PCIE_XCAP_TYPE(reg);
    133 	aprint_normal_dev(self, "PCI Express capability version ");
    134 	switch (capversion) {
    135 	case PCIE_XCAP_VER_1:
    136 		aprint_normal("1");
    137 		break;
    138 	case PCIE_XCAP_VER_2:
    139 		aprint_normal("2");
    140 		break;
    141 	default:
    142 		aprint_normal_dev(self, "unsupported (%d)\n", capversion);
    143 		return;
    144 	}
    145 	aprint_normal(" <");
    146 	switch (devtype) {
    147 	case PCIE_XCAP_TYPE_PCIE_DEV:
    148 		aprint_normal("PCI-E Endpoint device");
    149 		break;
    150 	case PCIE_XCAP_TYPE_PCI_DEV:
    151 		aprint_normal("Legacy PCI-E Endpoint device");
    152 		break;
    153 	case PCIE_XCAP_TYPE_ROOT:
    154 		aprint_normal("Root Port of PCI-E Root Complex");
    155 		break;
    156 	case PCIE_XCAP_TYPE_UP:
    157 		aprint_normal("Upstream Port of PCI-E Switch");
    158 		break;
    159 	case PCIE_XCAP_TYPE_DOWN:
    160 		aprint_normal("Downstream Port of PCI-E Switch");
    161 		break;
    162 	case PCIE_XCAP_TYPE_PCIE2PCI:
    163 		aprint_normal("PCI-E to PCI/PCI-X Bridge");
    164 		break;
    165 	case PCIE_XCAP_TYPE_PCI2PCIE:
    166 		aprint_normal("PCI/PCI-X to PCI-E Bridge");
    167 		break;
    168 	default:
    169 		aprint_normal("Device/Port Type %x", devtype);
    170 		break;
    171 	}
    172 
    173 	switch (devtype) {
    174 	case PCIE_XCAP_TYPE_ROOT:
    175 	case PCIE_XCAP_TYPE_DOWN:
    176 	case PCIE_XCAP_TYPE_PCI2PCIE:
    177 		reg = pci_conf_read(sc->sc_pc, sc->sc_tag, off + PCIE_LCAP);
    178 		u_int mlw = __SHIFTOUT(reg, PCIE_LCAP_MAX_WIDTH);
    179 		u_int mls = __SHIFTOUT(reg, PCIE_LCAP_MAX_SPEED);
    180 
    181 		if (mls < __arraycount(pcie_linkspeed_strings)) {
    182 			aprint_normal("> x%d @ %sGT/s\n",
    183 			    mlw, pcie_linkspeed_strings[mls]);
    184 		} else {
    185 			aprint_normal("> x%d @ %d.%dGT/s\n",
    186 			    mlw, (mls * 25) / 10, (mls * 25) % 10);
    187 		}
    188 
    189 		reg = pci_conf_read(sc->sc_pc, sc->sc_tag, off + PCIE_LCSR);
    190 		if (reg & PCIE_LCSR_DLACTIVE) {	/* DLLA */
    191 			u_int lw = __SHIFTOUT(reg, PCIE_LCSR_NLW);
    192 			u_int ls = __SHIFTOUT(reg, PCIE_LCSR_LINKSPEED);
    193 
    194 			if (lw != mlw || ls != mls) {
    195 				if (ls < __arraycount(pcie_linkspeed_strings)) {
    196 					aprint_normal_dev(self,
    197 					    "link is x%d @ %sGT/s\n",
    198 					    lw, pcie_linkspeed_strings[ls]);
    199 				} else {
    200 					aprint_normal_dev(self,
    201 					    "link is x%d @ %d.%dGT/s\n",
    202 					    lw, (ls * 25) / 10, (ls * 25) % 10);
    203 				}
    204 			}
    205 		}
    206 		break;
    207 	default:
    208 		aprint_normal(">\n");
    209 		break;
    210 	}
    211 }
    212 
    213 static void
    214 ppbattach(device_t parent, device_t self, void *aux)
    215 {
    216 	struct ppb_softc *sc = device_private(self);
    217 	struct pci_attach_args *pa = aux;
    218 	pci_chipset_tag_t pc = pa->pa_pc;
    219 	struct pcibus_attach_args pba;
    220 #ifdef PPB_USEINTR
    221 	char const *intrstr;
    222 	char intrbuf[PCI_INTRSTR_LEN];
    223 #endif
    224 	pcireg_t busdata, reg;
    225 
    226 	pci_aprint_devinfo(pa, NULL);
    227 
    228 	sc->sc_pc = pc;
    229 	sc->sc_tag = pa->pa_tag;
    230 	sc->sc_dev = self;
    231 
    232 	busdata = pci_conf_read(pc, pa->pa_tag, PPB_REG_BUSINFO);
    233 
    234 	if (PPB_BUSINFO_SECONDARY(busdata) == 0) {
    235 		aprint_normal_dev(self, "not configured by system firmware\n");
    236 		return;
    237 	}
    238 
    239 	ppb_print_pcie(self);
    240 
    241 #if 0
    242 	/*
    243 	 * XXX can't do this, because we're not given our bus number
    244 	 * (we shouldn't need it), and because we've no way to
    245 	 * decompose our tag.
    246 	 */
    247 	/* sanity check. */
    248 	if (pa->pa_bus != PPB_BUSINFO_PRIMARY(busdata))
    249 		panic("ppbattach: bus in tag (%d) != bus in reg (%d)",
    250 		    pa->pa_bus, PPB_BUSINFO_PRIMARY(busdata));
    251 #endif
    252 
    253 	/* Check for PCI Express capabilities and setup hotplug support. */
    254 	if (pci_get_capability(pc, pa->pa_tag, PCI_CAP_PCIEXPRESS,
    255 	    &sc->sc_pciecapoff, &reg) && (reg & PCIE_XCAP_SI)) {
    256 		/*
    257 		 * First, disable all interrupts because BIOS might
    258 		 * enable them.
    259 		 */
    260 		reg = pci_conf_read(sc->sc_pc, sc->sc_tag,
    261 		    sc->sc_pciecapoff + PCIE_SLCSR);
    262 		if (reg & PCIE_SLCSR_ENABLE_MASK) {
    263 			reg &= ~PCIE_SLCSR_ENABLE_MASK;
    264 			pci_conf_write(sc->sc_pc, sc->sc_tag,
    265 			    sc->sc_pciecapoff + PCIE_SLCSR, reg);
    266 		}
    267 #ifdef PPB_USEINTR
    268 #if 0 /* notyet */
    269 		/*
    270 		 * XXX Initialize workqueue or something else for
    271 		 * HotPlug support.
    272 		 */
    273 #endif
    274 		if (pci_intr_alloc(pa, &sc->sc_pihp, NULL, 0) == 0)
    275 			sc->sc_intrhand = pci_intr_establish_xname(pc,
    276 			    sc->sc_pihp[0], IPL_BIO, ppb_intr, sc,
    277 			    device_xname(sc->sc_dev));
    278 #endif
    279 	}
    280 
    281 #ifdef PPB_USEINTR
    282 	if (sc->sc_intrhand != NULL) {
    283 		pcireg_t slcap, slcsr, val;
    284 
    285 		intrstr = pci_intr_string(pc, sc->sc_pihp[0], intrbuf,
    286 		    sizeof(intrbuf));
    287 		aprint_normal_dev(self, "interrupting at %s\n", intrstr);
    288 
    289 		/* Clear any pending events */
    290 		slcsr = pci_conf_read(pc, pa->pa_tag,
    291 		    sc->sc_pciecapoff + PCIE_SLCSR);
    292 		pci_conf_write(pc, pa->pa_tag,
    293 		    sc->sc_pciecapoff + PCIE_SLCSR, slcsr);
    294 
    295 		/* Enable interrupt. */
    296 		val = 0;
    297 		slcap = pci_conf_read(pc, pa->pa_tag,
    298 		    sc->sc_pciecapoff + PCIE_SLCAP);
    299 		if (slcap & PCIE_SLCAP_ABP)
    300 			val |= PCIE_SLCSR_ABE;
    301 		if (slcap & PCIE_SLCAP_PCP)
    302 			val |= PCIE_SLCSR_PFE;
    303 		if (slcap & PCIE_SLCAP_MSP)
    304 			val |= PCIE_SLCSR_MSE;
    305 #if 0
    306 		/*
    307 		 * XXX Disable for a while because setting
    308 		 * PCIE_SLCSR_CCE makes break device access on
    309 		 * some environment.
    310 		 */
    311 		if ((slcap & PCIE_SLCAP_NCCS) == 0)
    312 			val |= PCIE_SLCSR_CCE;
    313 #endif
    314 		/* Attention indicator off by default */
    315 		if (slcap & PCIE_SLCAP_AIP) {
    316 			val |= __SHIFTIN(PCIE_SLCSR_IND_OFF,
    317 			    PCIE_SLCSR_AIC);
    318 		}
    319 		/* Power indicator */
    320 		if (slcap & PCIE_SLCAP_PIP) {
    321 			/*
    322 			 * Indicator off:
    323 			 *  a) card not present
    324 			 *  b) power fault
    325 			 *  c) MRL sensor off
    326 			 */
    327 			if (((slcsr & PCIE_SLCSR_PDS) == 0)
    328 			    || ((slcsr & PCIE_SLCSR_PFD) != 0)
    329 			    || (((slcap & PCIE_SLCAP_MSP) != 0)
    330 				&& ((slcsr & PCIE_SLCSR_MS) != 0)))
    331 				val |= __SHIFTIN(PCIE_SLCSR_IND_OFF,
    332 				    PCIE_SLCSR_PIC);
    333 			else
    334 				val |= __SHIFTIN(PCIE_SLCSR_IND_ON,
    335 				    PCIE_SLCSR_PIC);
    336 		}
    337 
    338 		val |= PCIE_SLCSR_DLLSCE | PCIE_SLCSR_HPE | PCIE_SLCSR_PDE;
    339 		slcsr = val;
    340 		pci_conf_write(pc, pa->pa_tag,
    341 		    sc->sc_pciecapoff + PCIE_SLCSR, slcsr);
    342 
    343 		/* Attach event counters */
    344 		evcnt_attach_dynamic(&sc->sc_ev_intr, EVCNT_TYPE_INTR, NULL,
    345 		    device_xname(sc->sc_dev), "Interrupt");
    346 		evcnt_attach_dynamic(&sc->sc_ev_abp, EVCNT_TYPE_MISC, NULL,
    347 		    device_xname(sc->sc_dev), "Attention Button Pressed");
    348 		evcnt_attach_dynamic(&sc->sc_ev_pfd, EVCNT_TYPE_MISC, NULL,
    349 		    device_xname(sc->sc_dev), "Power Fault Detected");
    350 		evcnt_attach_dynamic(&sc->sc_ev_msc, EVCNT_TYPE_MISC, NULL,
    351 		    device_xname(sc->sc_dev), "MRL Sensor Changed");
    352 		evcnt_attach_dynamic(&sc->sc_ev_pdc, EVCNT_TYPE_MISC, NULL,
    353 		    device_xname(sc->sc_dev), "Presence Detect Changed");
    354 		evcnt_attach_dynamic(&sc->sc_ev_cc, EVCNT_TYPE_MISC, NULL,
    355 		    device_xname(sc->sc_dev), "Command Completed");
    356 		evcnt_attach_dynamic(&sc->sc_ev_lacs, EVCNT_TYPE_MISC, NULL,
    357 		    device_xname(sc->sc_dev), "Data Link Layer State Changed");
    358 	}
    359 #endif /* PPB_USEINTR */
    360 
    361 	if (!pmf_device_register(self, ppb_suspend, ppb_resume))
    362 		aprint_error_dev(self, "couldn't establish power handler\n");
    363 
    364 	/*
    365 	 * Attach the PCI bus that hangs off of it.
    366 	 *
    367 	 * XXX Don't pass-through Memory Read Multiple.  Should we?
    368 	 * XXX Consult the spec...
    369 	 */
    370 	pba.pba_iot = pa->pa_iot;
    371 	pba.pba_memt = pa->pa_memt;
    372 	pba.pba_dmat = pa->pa_dmat;
    373 	pba.pba_dmat64 = pa->pa_dmat64;
    374 	pba.pba_pc = pc;
    375 	pba.pba_flags = pa->pa_flags & ~PCI_FLAGS_MRM_OKAY;
    376 	pba.pba_bus = PPB_BUSINFO_SECONDARY(busdata);
    377 	pba.pba_sub = PPB_BUSINFO_SUBORDINATE(busdata);
    378 	pba.pba_bridgetag = &sc->sc_tag;
    379 	pba.pba_intrswiz = pa->pa_intrswiz;
    380 	pba.pba_intrtag = pa->pa_intrtag;
    381 
    382 	config_found_ia(self, "pcibus", &pba, pcibusprint);
    383 }
    384 
    385 static int
    386 ppbdetach(device_t self, int flags)
    387 {
    388 #ifdef PPB_USEINTR
    389 	struct ppb_softc *sc = device_private(self);
    390 	pcireg_t slcsr;
    391 #endif
    392 	int rc;
    393 
    394 	if ((rc = config_detach_children(self, flags)) != 0)
    395 		return rc;
    396 
    397 #ifdef PPB_USEINTR
    398 	if (sc->sc_intrhand != NULL) {
    399 		/* Detach event counters */
    400 		evcnt_detach(&sc->sc_ev_intr);
    401 		evcnt_detach(&sc->sc_ev_abp);
    402 		evcnt_detach(&sc->sc_ev_pfd);
    403 		evcnt_detach(&sc->sc_ev_msc);
    404 		evcnt_detach(&sc->sc_ev_pdc);
    405 		evcnt_detach(&sc->sc_ev_cc);
    406 		evcnt_detach(&sc->sc_ev_lacs);
    407 
    408 		/* Clear any pending events and disable interrupt */
    409 		slcsr = pci_conf_read(sc->sc_pc, sc->sc_tag,
    410 		    sc->sc_pciecapoff + PCIE_SLCSR);
    411 		slcsr &= ~PCIE_SLCSR_ENABLE_MASK;
    412 		pci_conf_write(sc->sc_pc, sc->sc_tag,
    413 		    sc->sc_pciecapoff + PCIE_SLCSR, slcsr);
    414 
    415 		/* Disestablish the interrupt handler */
    416 		pci_intr_disestablish(sc->sc_pc, sc->sc_intrhand);
    417 		pci_intr_release(sc->sc_pc, sc->sc_pihp, 1);
    418 	}
    419 #endif
    420 
    421 	pmf_device_deregister(self);
    422 	return 0;
    423 }
    424 
    425 static bool
    426 ppb_resume(device_t dv, const pmf_qual_t *qual)
    427 {
    428 	struct ppb_softc *sc = device_private(dv);
    429 	int off;
    430 	pcireg_t val;
    431 
    432         for (off = 0x40; off <= 0xff; off += 4) {
    433 		val = pci_conf_read(sc->sc_pc, sc->sc_tag, off);
    434 		if (val != sc->sc_pciconfext[(off - 0x40) / 4])
    435 			pci_conf_write(sc->sc_pc, sc->sc_tag, off,
    436 			    sc->sc_pciconfext[(off - 0x40)/4]);
    437 	}
    438 
    439 	return true;
    440 }
    441 
    442 static bool
    443 ppb_suspend(device_t dv, const pmf_qual_t *qual)
    444 {
    445 	struct ppb_softc *sc = device_private(dv);
    446 	int off;
    447 
    448 	for (off = 0x40; off <= 0xff; off += 4)
    449 		sc->sc_pciconfext[(off - 0x40) / 4] =
    450 		    pci_conf_read(sc->sc_pc, sc->sc_tag, off);
    451 
    452 	return true;
    453 }
    454 
    455 static void
    456 ppbchilddet(device_t self, device_t child)
    457 {
    458 	/* we keep no references to child devices, so do nothing */
    459 }
    460 
    461 #ifdef PPB_USEINTR
    462 static int
    463 ppb_intr(void *arg)
    464 {
    465 	struct ppb_softc *sc = arg;
    466 	device_t dev = sc->sc_dev;
    467 	pcireg_t reg;
    468 
    469 	reg = pci_conf_read(sc->sc_pc, sc->sc_tag,
    470 	    sc->sc_pciecapoff + PCIE_SLCSR);
    471 
    472 	/*
    473 	 * Not me. This check is only required for INTx.
    474 	 * ppb_intr() would be spilted int ppb_intr_legacy() and ppb_intr_msi()
    475 	 */
    476 	if ((reg & PCIE_SLCSR_STATCHG_MASK) == 0)
    477 		return 0;
    478 
    479 	/* Clear interrupts. */
    480 	pci_conf_write(sc->sc_pc, sc->sc_tag,
    481 	    sc->sc_pciecapoff + PCIE_SLCSR, reg);
    482 
    483 	sc->sc_ev_intr.ev_count++;
    484 
    485 	/* Attention Button Pressed */
    486 	if (reg & PCIE_SLCSR_ABP) {
    487 		sc->sc_ev_abp.ev_count++;
    488 		if (ppb_printevent)
    489 			device_printf(dev, "Attention Button Pressed\n");
    490 	}
    491 
    492 	/* Power Fault Detected */
    493 	if (reg & PCIE_SLCSR_PFD) {
    494 		sc->sc_ev_pfd.ev_count++;
    495 		if (ppb_printevent)
    496 			device_printf(dev, "Power Fault Detected\n");
    497 	}
    498 
    499 	/* MRL Sensor Changed */
    500 	if (reg & PCIE_SLCSR_MSC) {
    501 		sc->sc_ev_msc.ev_count++;
    502 		if (ppb_printevent)
    503 			device_printf(dev, "MRL Sensor Changed\n");
    504 	}
    505 
    506 	/* Presence Detect Changed */
    507 	if (reg & PCIE_SLCSR_PDC) {
    508 		sc->sc_ev_pdc.ev_count++;
    509 		if (ppb_printevent)
    510 			device_printf(dev, "Presence Detect Changed\n");
    511 		if (reg & PCIE_SLCSR_PDS) {
    512 			/* XXX Insert */
    513 		} else {
    514 			/* XXX Remove */
    515 		}
    516 	}
    517 
    518 	/* Command Completed */
    519 	if (reg & PCIE_SLCSR_CC) {
    520 		sc->sc_ev_cc.ev_count++;
    521 		if (ppb_printevent)
    522 			device_printf(dev, "Command Completed\n");
    523 	}
    524 
    525 	/* Data Link Layer State Changed */
    526 	if (reg & PCIE_SLCSR_LACS) {
    527 		sc->sc_ev_lacs.ev_count++;
    528 		if (ppb_printevent)
    529 			device_printf(dev, "Data Link Layer State Changed\n");
    530 	}
    531 
    532 	return 1;
    533 }
    534 #endif /* PPB_USEINTR */
    535