FreeBSD/sys/dev/pci/pci.c
/*
 * New style pci driver.  Parent device is either a pci-host-bridge or a
 * pci-pci-bridge.  Both kinds are represented by instances of pcib.
 */
New style pci driver.  Parent device is either a pci-host-bridge or a
pci-pci-bridge.  Both kinds are represented by instances of pcib.
New style pci driver . Parent device is either a pci - host - bridge or a pci - pci - bridge . Both kinds are represented by instances of pcib .
void
pci_print_verbose(struct pci_devinfo *dinfo)
{
	if (bootverbose) {
		pcicfgregs *cfg = &dinfo->cfg;
		printf("found->\tvendor=0x%04x, dev=0x%04x, revid=0x%02x\n",
		    cfg->vendor, cfg->device, cfg->revid);
		printf("\tdomain=%d, bus=%d, slot=%d, func=%d\n",
		    cfg->domain, cfg->bus, cfg->slot, cfg->func);
		printf("\tclass=%02x-%02x-%02x, hdrtype=0x%02x, mfdev=%d\n",
		    cfg->baseclass, cfg->subclass, cfg->progif, cfg->hdrtype,
		    cfg->mfdev);
		printf("\tcmdreg=0x%04x, statreg=0x%04x, cachelnsz=%d (dwords)\n",
		    cfg->cmdreg, cfg->statreg, cfg->cachelnsz);
		printf("\tlattimer=0x%02x (%d ns), mingnt=0x%02x (%d ns), maxlat=0x%02x (%d ns)\n",
		    cfg->lattimer, cfg->lattimer * 30, cfg->mingnt,
		    cfg->mingnt * 250, cfg->maxlat, cfg->maxlat * 250);
		if (cfg->intpin > 0)
			printf("\tintpin=%c, irq=%d\n",
			    cfg->intpin +'a' -1, cfg->intline);
		if (cfg->pp.pp_cap) {
			uint16_t status;
			status = pci_read_config(cfg->dev, cfg->pp.pp_status, 2);
			printf("\tpowerspec %d  supports D0%s%s D3  current D%d\n",
			    cfg->pp.pp_cap & PCIM_PCAP_SPEC,
			    cfg->pp.pp_cap & PCIM_PCAP_D1SUPP ? " D1" : "",
			    cfg->pp.pp_cap & PCIM_PCAP_D2SUPP ? " D2" : "",
			    status & PCIM_PSTAT_DMASK);
		}
		if (cfg->msi.msi_location) {
			int ctrl;
			ctrl = cfg->msi.msi_ctrl;
			printf("\tMSI supports %d message%s%s%s\n",
			    cfg->msi.msi_msgnum,
			    (cfg->msi.msi_msgnum == 1) ? "" : "s",
			    (ctrl & PCIM_MSICTRL_64BIT) ? ", 64 bit" : "",
			    (ctrl & PCIM_MSICTRL_VECTOR) ? ", vector masks":"");
		}
		if (cfg->msix.msix_location) {
			printf("\tMSI-X supports %d message%s ",
			    cfg->msix.msix_msgnum,
			    (cfg->msix.msix_msgnum == 1) ? "" : "s");
			if (cfg->msix.msix_table_bar == cfg->msix.msix_pba_bar)
				printf("in map 0x%x\n",
				    cfg->msix.msix_table_bar);
			else
				printf("in maps 0x%x and 0x%x\n",
				    cfg->msix.msix_table_bar,
				    cfg->msix.msix_pba_bar);
		}
	}
}
void pci_print_verbose ( struct pci_devinfo * dinfo ) { if ( bootverbose ) { pcicfgregs * cfg = & dinfo -> cfg ; printf ( " \t \n " , cfg -> vendor , cfg -> device , cfg -> revid ) ; printf ( " \t \n " , cfg -> domain , cfg -> bus , cfg -> slot , cfg -> func ) ; printf ( " \t \n " , cfg -> baseclass , cfg -> subclass , cfg -> progif , cfg -> hdrtype , cfg -> mfdev ) ; printf ( " \t \n " , cfg -> cmdreg , cfg -> statreg , cfg -> cachelnsz ) ; printf ( " \t \n " , cfg -> lattimer , cfg -> lattimer * 30 , cfg -> mingnt , cfg -> mingnt * 250 , cfg -> maxlat , cfg -> maxlat * 250 ) ; if ( cfg -> intpin > 0 ) printf ( " \t \n " , cfg -> intpin + ' ' - 1 , cfg -> intline ) ; if ( cfg -> pp . pp_cap ) { uint16_t status ; status = pci_read_config ( cfg -> dev , cfg -> pp . pp_status , 2 ) ; printf ( " \t \n " , cfg -> pp . pp_cap & PCIM_PCAP_SPEC , cfg -> pp . pp_cap & PCIM_PCAP_D1SUPP ? " " : " " , cfg -> pp . pp_cap & PCIM_PCAP_D2SUPP ? " " : " " , status & PCIM_PSTAT_DMASK ) ; } if ( cfg -> msi . msi_location ) { int ctrl ; ctrl = cfg -> msi . msi_ctrl ; printf ( " \t \n " , cfg -> msi . msi_msgnum , ( cfg -> msi . msi_msgnum == 1 ) ? " " : " " , ( ctrl & PCIM_MSICTRL_64BIT ) ? " " : " " , ( ctrl & PCIM_MSICTRL_VECTOR ) ? " " : " " ) ; } if ( cfg -> msix . msix_location ) { printf ( " \t " , cfg -> msix . msix_msgnum , ( cfg -> msix . msix_msgnum == 1 ) ? " " : " " ) ; if ( cfg -> msix . msix_table_bar == cfg -> msix . msix_pba_bar ) printf ( " \n " , cfg -> msix . msix_table_bar ) ; else printf ( " \n " , cfg -> msix . msix_table_bar , cfg -> msix . msix_pba_bar ) ; } } }
New style pci driver.
New style pci driver .