コード例 #1
0
int
gscpcib_match(struct device *parent, void *match, void *aux)
{
    struct pci_attach_args *pa = aux;

    if (PCI_CLASS(pa->pa_class) != PCI_CLASS_BRIDGE ||
            PCI_SUBCLASS(pa->pa_class) != PCI_SUBCLASS_BRIDGE_ISA)
        return (0);

    if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_NS &&
            PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_NS_SC1100_ISA)
        return (2);	/* supersede pcib(4) */

    return (0);
}
コード例 #2
0
const struct sili_device *
sili_lookup(struct pci_attach_args *pa)
{
	int				i;
	const struct sili_device	*sd;

	for (i = 0; i < nitems(sili_devices); i++) {
		sd = &sili_devices[i];
		if (sd->sd_vendor == PCI_VENDOR(pa->pa_id) &&
		    sd->sd_product == PCI_PRODUCT(pa->pa_id))
			return (sd);
	}

	return (NULL);
}
コード例 #3
0
const struct ahci_device *
ahci_lookup_device(struct pci_attach_args *pa)
{
	int				i;
	const struct ahci_device	*ad;

	for (i = 0; i < (sizeof(ahci_devices) / sizeof(ahci_devices[0])); i++) {
		ad = &ahci_devices[i];
		if (ad->ad_vendor == PCI_VENDOR(pa->pa_id) &&
		    ad->ad_product == PCI_PRODUCT(pa->pa_id))
			return (ad);
	}

	return (NULL);
}
コード例 #4
0
int
mfi_pci_find_device(void *aux) {
	struct pci_attach_args	*pa = aux;
	int			i;

	for (i = 0; mfi_pci_devices[i].mpd_vendor; i++) {
		if (mfi_pci_devices[i].mpd_vendor == PCI_VENDOR(pa->pa_id) &&
		    mfi_pci_devices[i].mpd_product == PCI_PRODUCT(pa->pa_id)) {
		    	DNPRINTF(MFI_D_MISC, "mfi_pci_find_device: %i\n", i);
			return (i);
		}
	}

	return (-1);
}
コード例 #5
0
ファイル: if_ath_pci.c プロジェクト: orumin/openbsd-efivars
int
ath_pci_match(struct device *parent, void *match, void *aux)
{
	const char* devname;
	struct pci_attach_args *pa = aux;
	pci_vendor_id_t vendor;

	vendor = PCI_VENDOR(pa->pa_id);
	if (vendor == 0x128c)
		vendor = PCI_VENDOR_ATHEROS;
	devname = ath_hal_probe(vendor, PCI_PRODUCT(pa->pa_id));
	if (devname)
		return 1;

	return 0;
}
コード例 #6
0
const struct siop_product_desc *
siop_lookup_product(uint32_t id, int rev)
{
	const struct siop_product_desc *pp;
	const struct siop_product_desc *rp = NULL;

	if (PCI_VENDOR(id) != PCI_VENDOR_SYMBIOS)
		return NULL;

	for (pp = siop_products; pp->name != NULL; pp++) {
		if (PCI_PRODUCT(id) == pp->product && pp->revision <= rev)
			if (rp == NULL || pp->revision > rp->revision)
				rp = pp;
	}
	return rp;
}
コード例 #7
0
const struct mfi_pci_device *
mfi_pci_find_device(struct pci_attach_args *pa)
{
	const struct mfi_pci_device *mpd;
	int i;

	for (i = 0; i < sizeofa(mfi_pci_devices); i++) {
		mpd = &mfi_pci_devices[i];

		if (mpd->mpd_vendor == PCI_VENDOR(pa->pa_id) &&
		    mpd->mpd_product == PCI_PRODUCT(pa->pa_id))
			return (mpd);
	}

	return (NULL);
}
コード例 #8
0
static const struct pciide_product_desc *
viaide_lookup(pcireg_t id)
{

	switch (PCI_VENDOR(id)) {
	case PCI_VENDOR_VIATECH:
		return (pciide_lookup_product(id, pciide_via_products));

	case PCI_VENDOR_AMD:
		return (pciide_lookup_product(id, pciide_amd_products));

	case PCI_VENDOR_NVIDIA:
		return (pciide_lookup_product(id, pciide_nvidia_products));
	}
	return (NULL);
}
コード例 #9
0
ファイル: igma.c プロジェクト: ryoon/netbsd-xhci
static int
igma_newpch_match(const struct pci_attach_args *pa)
{
	if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_INTEL)
		return 0;
	switch (0xff00 & PCI_PRODUCT(pa->pa_id)) {
	case 0x3b00: /* ibex peak */
	case 0x1c00: /* cougar point */
	case 0x1e00: /* panther point */
	case 0x8c00: /* lynx point */
	case 0x9c00: /* lynx point lp */
		return 1;
	}

	return 0;
}
コード例 #10
0
static int
igsfb_pci_match_by_id(pcireg_t id)
{

	if (PCI_VENDOR(id) != PCI_VENDOR_INTEGRAPHICS)
		return 0;

	switch (PCI_PRODUCT(id)) {
	case PCI_PRODUCT_INTEGRAPHICS_IGA1682:		/* FALLTHROUGH */
	case PCI_PRODUCT_INTEGRAPHICS_CYBERPRO2000:	/* FALLTHROUGH */
	case PCI_PRODUCT_INTEGRAPHICS_CYBERPRO2010:
		return 1;
	default:
		return 0;
	}
}
コード例 #11
0
static struct cxgb_ident *cxgb_get_ident(struct pci_attach_args *pa)
{
    struct cxgb_ident *id;
    int vendorid, deviceid;

    vendorid = PCI_VENDOR(pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_ID_REG));
    deviceid = PCI_PRODUCT(pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_ID_REG));

    for (id = cxgb_identifiers; id->desc != NULL; id++) {
        if ((id->vendor == vendorid) &&
            (id->device == deviceid)) {
            return (id);
        }
    }
    return (NULL);
}
コード例 #12
0
ファイル: virtio.c プロジェクト: arroway/virtio_DragonFlyBSD
static int
virtio_match(device_t parent, cfdata_t match, void *aux)
{
	struct pci_attach_args *pa;

	pa = (struct pci_attach_args *)aux;
	switch (PCI_VENDOR(pa->pa_id)) {
	case PCI_VENDOR_QUMRANET:
		if ((0x1000 <= PCI_PRODUCT(pa->pa_id)) &&
		    (PCI_PRODUCT(pa->pa_id) <= 0x103f))
			return 1;
		break;
	}

	return 0;
}
コード例 #13
0
ファイル: cy_pci.c プロジェクト: eyberg/rumpkernel-netbsd-src
static const struct cy_pci_product *
cy_pci_lookup(const struct pci_attach_args *pa)
{
	const struct cy_pci_product *cp;
	int i;

	if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_CYCLADES)
		return (NULL);

	for (i = 0; i < cy_pci_nproducts; i++) {
		cp = &cy_pci_products[i];
		if (PCI_PRODUCT(pa->pa_id) == cp->cp_product)
			return (cp);
	}
	return (NULL);
}
コード例 #14
0
ファイル: cs4280.c プロジェクト: eyberg/rumpkernel-netbsd-src
static int
cs4280_match(device_t parent, cfdata_t match, void *aux)
{
	struct pci_attach_args *pa;

	pa = (struct pci_attach_args *)aux;
	if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_CIRRUS)
		return 0;
	if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_CIRRUS_CS4280
#if 0  /* I can't confirm */
	    || PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_CIRRUS_CS4610
#endif
	    )
		return 1;
	return 0;
}
コード例 #15
0
static int
malo_pci_match(device_t parent, cfdata_t match, void *aux)
{
	struct pci_attach_args *pa = aux;

	if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_MARVELL)
		return (0);

	switch (PCI_PRODUCT(pa->pa_id)) {
	case PCI_PRODUCT_MARVELL_88W8310:
	case PCI_PRODUCT_MARVELL_88W8335_1:
	case PCI_PRODUCT_MARVELL_88W8335_2:
		return (1);
	}

	return (0);
}
コード例 #16
0
static void
piccolo_attach(device_t parent, device_t self, void *aux)
{
	struct pci_attach_args *pa = aux;
	struct pciide_softc *sc = device_private(self);
	const struct pciide_product_desc *pp;

	sc->sc_wdcdev.sc_atac.atac_dev = self;

	if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_TOSHIBA2)
		pp = pciide_lookup_product(pa->pa_id, pciide_toshiba2_products);
	else
		pp = NULL;
	if (pp == NULL)
		panic("toshide_attach");
	pciide_common_attach(sc, pa, pp);
}
コード例 #17
0
ファイル: pci.c プロジェクト: m943040028/prex
static int
pci_scan_bus(struct pci_bus *bus)
{
	int totaldev = 0;
	struct pci_func df;
	memset(&df, 0, sizeof(df));
	df.bus = bus;

	for (df.dev = 0; df.dev < 32; df.dev++) {
		uint32_t bhlc = pci_conf_read(&df, PCI_BHLC_REG);
		struct pci_func f;
		if (PCI_HDRTYPE_TYPE(bhlc) > 1)	/* Unsupported or no device */
			continue;

		/* found a device */
		totaldev++;
		f = df;

		for (f.func = 0; f.func < (PCI_HDRTYPE_MULTIFN(bhlc) ? 8 : 1);
				f.func++) {
			struct pci_func *af;
			uint32_t dev_id;
			uint32_t intr;

			dev_id = pci_conf_read(&f, PCI_ID_REG);
			if (PCI_VENDOR(dev_id) == 0xffff)
				continue;	

			/* found a function */
			af = kmem_alloc(sizeof(*af));
			*af = f;
			list_init(&af->link);
			list_insert(&pci_func_list, &af->link);
			af->dev_id = dev_id;

			intr = pci_conf_read(af, PCI_INTERRUPT_REG);
			af->irq_line = PCI_INTERRUPT_LINE(intr);
			af->dev_class = pci_conf_read(af, PCI_CLASS_REG);
#ifdef SHOW_PCI_VERBOSE_INFO
			pci_print_func(af);
#endif
		}
	}

	return totaldev;
}
コード例 #18
0
ファイル: pci.c プロジェクト: m943040028/prex
void
pci_func_enable(struct pci_func *f, uint8_t flags)
{

	uint32_t v = 0;
	if (flags & PCI_MEM_ENABLE)
		v |= PCI_COMMAND_MEM_ENABLE;
	if (flags & PCI_IO_ENABLE)
		v |= PCI_COMMAND_IO_ENABLE;

	pci_conf_write(f, PCI_COMMAND_STATUS_REG,
			  v | PCI_COMMAND_MASTER_ENABLE);

	printf("pci: function %02x:%02x.%d (%04x:%04x) enabled\n",
		f->bus->busno, f->dev, f->func,
		PCI_VENDOR(f->dev_id), PCI_PRODUCT(f->dev_id));
}
コード例 #19
0
ファイル: pci.c プロジェクト: yazshel/netbsd-kernel
int
pciprint(void *aux, const char *pnp)
{
	struct pci_attach_args *pa = aux;
	char devinfo[256];
	const struct pci_quirkdata *qd;

	if (pnp) {
		pci_devinfo(pa->pa_id, pa->pa_class, 1, devinfo, sizeof(devinfo));
		aprint_normal("%s at %s", devinfo, pnp);
	}
	aprint_normal(" dev %d function %d", pa->pa_device, pa->pa_function);
	if (pci_config_dump) {
		printf(": ");
		pci_conf_print(pa->pa_pc, pa->pa_tag, NULL);
		if (!pnp)
			pci_devinfo(pa->pa_id, pa->pa_class, 1, devinfo, sizeof(devinfo));
		printf("%s at %s", devinfo, pnp ? pnp : "?");
		printf(" dev %d function %d (", pa->pa_device, pa->pa_function);
#ifdef __i386__
		printf("tag %#lx, intrtag %#lx, intrswiz %#lx, intrpin %#lx",
		    *(long *)&pa->pa_tag, *(long *)&pa->pa_intrtag,
		    (long)pa->pa_intrswiz, (long)pa->pa_intrpin);
#else
		printf("intrswiz %#lx, intrpin %#lx",
		    (long)pa->pa_intrswiz, (long)pa->pa_intrpin);
#endif
		printf(", i/o %s, mem %s,",
		    pa->pa_flags & PCI_FLAGS_IO_OKAY ? "on" : "off",
		    pa->pa_flags & PCI_FLAGS_MEM_OKAY ? "on" : "off");
		qd = pci_lookup_quirkdata(PCI_VENDOR(pa->pa_id),
		    PCI_PRODUCT(pa->pa_id));
		if (qd == NULL) {
			printf(" no quirks");
		} else {
			snprintb(devinfo, sizeof (devinfo),
			    "\002\001multifn\002singlefn\003skipfunc0"
			    "\004skipfunc1\005skipfunc2\006skipfunc3"
			    "\007skipfunc4\010skipfunc5\011skipfunc6"
			    "\012skipfunc7", qd->quirks);
			printf(" quirks %s", devinfo);
		}
		printf(")");
	}
	return UNCONF;
}
コード例 #20
0
int
iyonix_pci_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
{
	struct i80321_softc *sc = pa->pa_pc->pc_intr_v;
	int b, d, f;
	uint32_t busno;

	busno = bus_space_read_4(sc->sc_st, sc->sc_atu_sh, ATU_PCIXSR);
	busno = PCIXSR_BUSNO(busno);
	if (busno == 0xff)
		busno = 0;

	pci_decompose_tag(pa->pa_pc, pa->pa_intrtag, &b, &d, &f);

	/* No mappings for devices not on our bus. */
	if (b != busno)
		goto no_mapping;

	/*
	 *  XXX We currently deal only with the southbridge and with
	 *      regular PCI. IOC devices may need further attention.
	 */

	/* Devices on the southbridge are all routed through xint 1 */
	if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_ALI) {
		switch (PCI_PRODUCT(pa->pa_id)) {
			case PCI_PRODUCT_ALI_M1543: /* Southbridge */
			case PCI_PRODUCT_ALI_M5229: /* ATA */
			case PCI_PRODUCT_ALI_M5237: /* ohci */
			case PCI_PRODUCT_ALI_M5257: /* Modem */
			case PCI_PRODUCT_ALI_M5451: /* AC97 */
			case PCI_PRODUCT_ALI_M7101: /* PMC */
				*ihp = ICU_INT_XINT(1);
				return (0);
		}
	}

	/* Route other interrupts with default swizzling rule */
	*ihp = ICU_INT_XINT((d + pa->pa_intrpin - 1) % 4);
	return 0;

 no_mapping:
	printf("iyonix_pci_intr_map: no mapping for %d/%d/%d\n",
	    pa->pa_bus, pa->pa_device, pa->pa_function);
	return (1);
}
コード例 #21
0
static int
joy_pci_match(device_t parent, cfdata_t match, void *aux)
{
	struct pci_attach_args *pa = aux;

	if (PCI_CLASS(pa->pa_class) == PCI_CLASS_INPUT &&
	    PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_INPUT_GAMEPORT &&
	    PCI_INTERFACE(pa->pa_class) == 0x10)
		return 1;

	if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_CREATIVELABS &&
	    (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_CREATIVELABS_SBJOY ||
	     PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_CREATIVELABS_SBJOY2))
		return 1;

	return 0;
}
コード例 #22
0
static int
acpicpu_md_quirk_piix4(const struct pci_attach_args *pa)
{

	/*
	 * XXX: The pci_find_device(9) function only
	 *	deals with attached devices. Change this
	 *	to use something like pci_device_foreach().
	 */
	if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_INTEL)
		return 0;

	if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_INTEL_82371AB_ISA ||
	    PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_INTEL_82440MX_PMC)
		return 1;

	return 0;
}
コード例 #23
0
ファイル: if_bwi_pci.c プロジェクト: SylvestreG/bitrig
int
bwi_pci_match(struct device *parent, void *match, void *aux)
{
	struct pci_attach_args *pa = aux;

	/*
	 * The second revision of the BCM4311/BCM4312
	 * chips require v4 firmware.
	 */
	if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_BROADCOM &&
            (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM4311 ||
	     PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM4312) &&
	     PCI_REVISION(pa->pa_class) == 0x02)
		return (0);

	return (pci_matchbyid((struct pci_attach_args *)aux, bwi_pci_devices,
	    sizeof(bwi_pci_devices) / sizeof(bwi_pci_devices[0])));
}
コード例 #24
0
ファイル: auvia.c プロジェクト: eyberg/rumpkernel-netbsd-src
static int
auvia_match(device_t parent, cfdata_t match, void *aux)
{
	struct pci_attach_args *pa;

	pa = (struct pci_attach_args *) aux;
	if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_VIATECH)
		return 0;
	switch (PCI_PRODUCT(pa->pa_id)) {
	case PCI_PRODUCT_VIATECH_VT82C686A_AC97:
	case PCI_PRODUCT_VIATECH_VT8233_AC97:
		break;
	default:
		return 0;
	}

	return 1;
}
コード例 #25
0
ファイル: pchb.c プロジェクト: alenichev/openbsd-kernel
int
pchbmatch(struct device *parent, void *cf, void *aux)
{
	struct pci_attach_args *pa = aux;

	/*
	 * Match all known PCI host chipsets.
	 */
	switch (PCI_VENDOR(pa->pa_id)) {
	case PCI_VENDOR_APPLE:
		switch (PCI_PRODUCT(pa->pa_id)) {
		case PCI_PRODUCT_APPLE_BANDIT:
		case PCI_PRODUCT_APPLE_UNINORTH:
		case PCI_PRODUCT_APPLE_UNINORTHETH:
		case PCI_PRODUCT_APPLE_UNINORTH_AGP:
		case PCI_PRODUCT_APPLE_PANGEA:
		case PCI_PRODUCT_APPLE_PANGEA_PCI:
		case PCI_PRODUCT_APPLE_PANGEA_AGP:
		case PCI_PRODUCT_APPLE_UNINORTH2:
		case PCI_PRODUCT_APPLE_UNINORTH2ETH:
		case PCI_PRODUCT_APPLE_UNINORTH2_AGP:
		case PCI_PRODUCT_APPLE_UNINORTH_AGP3:
		case PCI_PRODUCT_APPLE_UNINORTH5:
		case PCI_PRODUCT_APPLE_UNINORTH6:
		case PCI_PRODUCT_APPLE_SHASTA_HT:
		case PCI_PRODUCT_APPLE_K2:
		case PCI_PRODUCT_APPLE_K2_AGP:
		case PCI_PRODUCT_APPLE_INTREPID2_AGP:
		case PCI_PRODUCT_APPLE_INTREPID2_PCI1:
		case PCI_PRODUCT_APPLE_INTREPID2_PCI2:
			return (1);
		}
		break;

	case PCI_VENDOR_MOT:
		switch (PCI_PRODUCT(pa->pa_id)) {
		case PCI_PRODUCT_MOT_MPC106:
			return (1);
		}
		break;
	}

	return (0);
}
コード例 #26
0
int
pcic_pci_match(device_t parent, cfdata_t match, void *aux)
{
	struct pci_attach_args *pa = aux;

	switch (PCI_VENDOR(pa->pa_id)) {
	case PCI_VENDOR_CIRRUS:
		switch (PCI_PRODUCT(pa->pa_id)) {
		case PCI_PRODUCT_CIRRUS_CL_PD6729:
			break;
		default:
			return 0;
		}
		break;
	default:
		return 0;
	}
	return 1;
}
コード例 #27
0
ファイル: if_ral_cardbus.c プロジェクト: ryo/netbsd-src
int
ral_cardbus_match(device_t parent, cfdata_t cfdata, void *aux)
{
        struct cardbus_attach_args *ca = aux;

        if (PCI_VENDOR(ca->ca_id) == PCI_VENDOR_RALINK) {
                switch (PCI_PRODUCT(ca->ca_id)) {
		case PCI_PRODUCT_RALINK_RT2560:
		case PCI_PRODUCT_RALINK_RT2561:
		case PCI_PRODUCT_RALINK_RT2561S:
		case PCI_PRODUCT_RALINK_RT2661:
			return 1;
		default:
			return 0;
                }
        }

        return 0;
}
コード例 #28
0
ファイル: shpcic.c プロジェクト: lacombar/netbsd-alc
static int
shpcic_match(device_t parent, cfdata_t cf, void *aux)
{
	pcireg_t id;

	if (shpcic_found)
		return (0);

	switch (cpu_product) {
	case CPU_PRODUCT_7751:
	case CPU_PRODUCT_7751R:
		break;

	default:
		return (0);
	}


	id = _reg_read_4(SH4_PCICONF0);

	switch (PCI_VENDOR(id)) {
	case PCI_VENDOR_HITACHI:
		break;

	default:
		return (0);
	}


	switch (PCI_PRODUCT(id)) {
	case PCI_PRODUCT_HITACHI_SH7751: /* FALLTHROUGH */
	case PCI_PRODUCT_HITACHI_SH7751R:
		break;

	default:
		return (0);
	}

	if (_reg_read_2(SH4_BCR2) & BCR2_PORTEN)
		return (0);

	return (1);
}
コード例 #29
0
ファイル: kauaiata.c プロジェクト: MarginC/kame
int
kauaiatamatch(struct device *parent, void *match, void *aux)
{
	struct pci_attach_args *pa = aux;

	/*
	 * Match the adapter
	 * XXX match routine??
	 */
	switch(PCI_VENDOR(pa->pa_id)) {
	case PCI_VENDOR_APPLE:
		switch (PCI_PRODUCT(pa->pa_id)) {
		case PCI_PRODUCT_APPLE_UNINORTH_ATA:
		case PCI_PRODUCT_APPLE_INTREPID_ATA:
			return (1);
		}
		break;
	}
	return 0;
}
コード例 #30
0
ファイル: obio.c プロジェクト: lacombar/netbsd-alc
int
obio_match(struct device *parent, struct cfdata *cf, void *aux)
{
	struct pci_attach_args *pa = aux;

	if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_APPLE)
		switch (PCI_PRODUCT(pa->pa_id)) {
		case PCI_PRODUCT_APPLE_GC:
		case PCI_PRODUCT_APPLE_OHARE:
		case PCI_PRODUCT_APPLE_HEATHROW:
		case PCI_PRODUCT_APPLE_PADDINGTON:
		case PCI_PRODUCT_APPLE_KEYLARGO:
		case PCI_PRODUCT_APPLE_PANGEA_MACIO:
		case PCI_PRODUCT_APPLE_INTREPID:
		case PCI_PRODUCT_APPLE_K2:
			return 1;
		}

	return 0;
}