本文整理汇总了C++中PCI_PRODUCT函数的典型用法代码示例。如果您正苦于以下问题:C++ PCI_PRODUCT函数的具体用法?C++ PCI_PRODUCT怎么用?C++ PCI_PRODUCT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PCI_PRODUCT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ral_cardbus_match
int
ral_cardbus_match(struct device *parent,
struct cfdata *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;
}
开发者ID:Tommmster,项目名称:netbsd-avr32,代码行数:20,代码来源:if_ral_cardbus.c
示例2: pci_bus_flags
/*
* Determine which flags should be passed to the primary PCI bus's
* autoconfiguration node. We use this to detect broken chipsets
* which cannot safely use memory-mapped device access.
*/
int
pci_bus_flags()
{
int rval = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED |
PCI_FLAGS_MRL_OKAY | PCI_FLAGS_MRM_OKAY | PCI_FLAGS_MWI_OKAY;
int device, maxndevs;
pcitag_t tag;
pcireg_t id;
maxndevs = pci_bus_maxdevs(NULL, 0);
for (device = 0; device < maxndevs; device++) {
tag = pci_make_tag(NULL, 0, device, 0);
id = pci_conf_read(NULL, tag, PCI_ID_REG);
/* Invalid vendor ID value? */
if (PCI_VENDOR(id) == PCI_VENDOR_INVALID)
continue;
/* XXX Not invalid, but we've done this ~forever. */
if (PCI_VENDOR(id) == 0)
continue;
switch (PCI_VENDOR(id)) {
case PCI_VENDOR_SIS:
switch (PCI_PRODUCT(id)) {
case PCI_PRODUCT_SIS_85C496:
goto disable_mem;
}
break;
}
}
return (rval);
disable_mem:
printf("Warning: broken PCI-Host bridge detected; "
"disabling memory-mapped access\n");
rval &= ~(PCI_FLAGS_MEM_ENABLED|PCI_FLAGS_MRL_OKAY|PCI_FLAGS_MRM_OKAY|
PCI_FLAGS_MWI_OKAY);
return (rval);
}
开发者ID:lacombar,项目名称:netbsd-alc,代码行数:46,代码来源:pci_machdep.c
示例3: iop_pci_match
static int
iop_pci_match(struct device *parent, struct cfdata *match,
void *aux)
{
struct pci_attach_args *pa;
u_int product, vendor;
pcireg_t reg;
pa = aux;
/*
* Look for an "intelligent I/O processor" that adheres to the I2O
* specification. Ignore the device if it doesn't support interrupt
* driven operation.
*/
if (PCI_CLASS(pa->pa_class) == PCI_CLASS_I2O &&
PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_I2O_STANDARD &&
PCI_INTERFACE(pa->pa_class) == PCI_INTERFACE_I2O_INTRDRIVEN)
return (1);
/*
* Match boards that don't conform exactly to the spec.
*/
vendor = PCI_VENDOR(pa->pa_id);
product = PCI_PRODUCT(pa->pa_id);
if (vendor == PCI_VENDOR_DPT &&
(product == PCI_PRODUCT_DPT_RAID_I2O ||
product == PCI_PRODUCT_DPT_RAID_2005S))
return (1);
if (vendor == PCI_VENDOR_INTEL &&
(product == PCI_PRODUCT_INTEL_80960RM_2 ||
product == PCI_PRODUCT_INTEL_80960_RP)) {
reg = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_SUBSYS_ID_REG);
if (PCI_VENDOR(reg) == PCI_VENDOR_PROMISE)
return (1);
}
return (0);
}
开发者ID:NetBsdDriverProxy,项目名称:NetBsdDriverProxy,代码行数:41,代码来源:iop_pci.c
示例4: obio_match
int
obio_match(device_t parent, cfdata_t 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:
case PCI_PRODUCT_APPLE_SHASTA:
return 1;
}
return 0;
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:21,代码来源:obio.c
示例5: pchb_match
static int
pchb_match(struct device *parent, struct cfdata *match, void *aux)
{
struct pci_attach_args *pa = aux;
/*
* Match all known PCI host chipsets.
*/
if (PCI_CLASS(pa->pa_class) == PCI_CLASS_BRIDGE &&
PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_BRIDGE_HOST) {
switch (PCI_VENDOR(pa->pa_id)) {
case PCI_VENDOR_GALILEO:
switch (PCI_PRODUCT(pa->pa_id)) {
case PCI_PRODUCT_GALILEO_GT64120:
return (!pcifound);
}
break;
}
}
return (0);
}
开发者ID:MarginC,项目名称:kame,代码行数:21,代码来源:pchb.c
示例6: fwohci_pci_match
static int
fwohci_pci_match(device_t parent, cfdata_t match, void *aux)
{
struct pci_attach_args *pa = (struct pci_attach_args *) aux;
/*
* XXX
* Firewire controllers used in some G3 PowerBooks hang the system
* when trying to discover devices - don't attach to those for now
* until someone with the right hardware can investigate
*/
if ((PCI_VENDOR(pa->pa_id) == PCI_VENDOR_APPLE) &&
(PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_APPLE_PBG3_FW))
return 0;
if (PCI_CLASS(pa->pa_class) == PCI_CLASS_SERIALBUS &&
PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_SERIALBUS_FIREWIRE &&
PCI_INTERFACE(pa->pa_class) == PCI_INTERFACE_OHCI)
return 1;
return 0;
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:21,代码来源:fwohci_pci.c
示例7: pci_conf_hook
int
pci_conf_hook(pci_chipset_tag_t pc, int bus, int dev, int func, pcireg_t id)
{
/* ignore bogus IDs */
if (PCI_VENDOR(id) == 0)
return 0;
/* 2700 hardware wedges on accesses to device 6. */
if (bus == 0 && dev == 6)
return 0;
/* 2800 hardware wedges on accesses to device 31. */
if (bus == 0 && dev == 31)
return 0;
/* Don't configure the bridge and PCI probe. */
if (PCI_VENDOR(id) == PCI_VENDOR_MARVELL &&
PCI_PRODUCT(id) == PCI_PRODUCT_MARVELL_GT64011)
return 0;
/* Don't configure on-board VIA VT82C586 (pcib, uhci) */
if (bus == 0 && dev == 9 && (func == 0 || func == 2))
return 0;
/* Enable viaide secondary port. Some firmware doesn't enable it. */
if (bus == 0 && dev == 9 && func == 1) {
pcitag_t tag;
pcireg_t csr;
#define APO_VIAIDECONF (APO_VIA_REGBASE + 0x00)
tag = pci_make_tag(pc, bus, dev, func);
csr = pci_conf_read(pc, tag, APO_VIAIDECONF);
pci_conf_write(pc, tag, APO_VIAIDECONF,
csr | APO_IDECONF_EN(1));
}
return PCI_CONF_DEFAULT & ~(PCI_COMMAND_SERR_ENABLE |
PCI_COMMAND_PARITY_ENABLE);
}
开发者ID:lacombar,项目名称:netbsd-alc,代码行数:40,代码来源:pci_machdep.c
示例8: yds_match
static int
yds_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_YAMAHA:
switch (PCI_PRODUCT(pa->pa_id)) {
case PCI_PRODUCT_YAMAHA_YMF724:
case PCI_PRODUCT_YAMAHA_YMF740:
case PCI_PRODUCT_YAMAHA_YMF740C:
case PCI_PRODUCT_YAMAHA_YMF724F:
case PCI_PRODUCT_YAMAHA_YMF744B:
case PCI_PRODUCT_YAMAHA_YMF754:
return 1;
}
break;
}
return 0;
}
开发者ID:ryoon,项目名称:netbsd-xhci,代码行数:22,代码来源:yds.c
示例9: ppbmatch
int
ppbmatch(struct device *parent, void *match, void *aux)
{
struct pci_attach_args *pa = aux;
/*
* This device is mislabeled. It is not a PCI bridge.
*/
if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_VIATECH &&
PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_VIATECH_VT82C586_PWR)
return (0);
/*
* Check the ID register to see that it's a PCI bridge.
* If it is, we assume that we can deal with it; it _should_
* work in a standardized way...
*/
if (PCI_CLASS(pa->pa_class) == PCI_CLASS_BRIDGE &&
PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_BRIDGE_PCI)
return (1);
return (0);
}
开发者ID:sofuture,项目名称:bitrig,代码行数:22,代码来源:ppb.c
示例10: scan_pci_bus
static void
scan_pci_bus(void)
{
pcitag_t tag;
int i, x;
for (i=0;i<32;i++){
tag = pci_make_tag(0, 0, i, 0);
x = pci_conf_read(0, tag, 0);
printf("%d tag=%08x : %08x\n", i, tag, x);
#if 0
if (PCI_VENDOR(x) == PCI_VENDOR_INTEL
&& PCI_PRODUCT(x) == PCI_PRODUCT_INTEL_80960_RP) {
/* Do not configure PCI bus analyzer */
continue;
}
x = pci_conf_read(0, tag, PCI_COMMAND_STATUS_REG);
x |= PCI_COMMAND_IO_ENABLE | PCI_COMMAND_MEM_ENABLE | PCI_COMMAND_MASTER_ENABLE;
pci_conf_write(0, tag, PCI_COMMAND_STATUS_REG, x);
#endif
}
}
开发者ID:krytarowski,项目名称:netbsd-current-src-sys,代码行数:22,代码来源:pchb.c
示例11: gdt_pci_probe
int
gdt_pci_probe(struct device *parent, void *match, void *aux)
{
struct pci_attach_args *pa = aux;
if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_VORTEX &&
((PCI_PRODUCT(pa->pa_id) >= GDT_DEVICE_ID_MIN &&
PCI_PRODUCT(pa->pa_id) <= GDT_DEVICE_ID_MAX) ||
PCI_PRODUCT(pa->pa_id) == GDT_DEVICE_ID_NEWRX ||
PCI_PRODUCT(pa->pa_id) == GDT_DEVICE_ID_NEWRX2))
return (1);
if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_INTEL &&
(PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_INTEL_GDT_RAID1 ||
PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_INTEL_GDT_RAID2))
return (1);
return (0);
}
开发者ID:SylvestreG,项目名称:bitrig,代码行数:17,代码来源:gdt_pci.c
示例12: kauaiatamatch
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:
case PCI_PRODUCT_APPLE_INTREPID2_ATA:
case PCI_PRODUCT_APPLE_K2_ATA:
case PCI_PRODUCT_APPLE_SHASTA_ATA:
return (1);
}
break;
}
return 0;
}
开发者ID:repos-holder,项目名称:openbsd-patches,代码行数:23,代码来源:kauaiata.c
示例13: iwic_find_card
static const char *
iwic_find_card(const struct pci_attach_args * pa)
{
pcireg_t type = pa->pa_id;
pcireg_t reg = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_SUBSYS_ID_REG);
int sv = PCI_VENDOR(reg);
int sd = PCI_PRODUCT(reg);
struct winids *wip = win_ids;
while (wip->type) {
if (wip->type == type) {
if (((wip->sv == -1) && (wip->sd == -1)) ||
((wip->sv == sv) && (wip->sd == sd)))
break;
}
++wip;
}
if (wip->desc)
return wip->desc;
return 0;
}
开发者ID:eyberg,项目名称:rumpkernel-netbsd-src,代码行数:23,代码来源:iwic_pci.c
示例14: pci_matchbyid
static int
pci_matchbyid(lua_State *L)
{
struct pci_attach_args *pa;
const struct pci_matchid *ids;
int nent;
const struct pci_matchid *pm;
int i;
pa = lua_touserdata(L, -3);
ids = lua_touserdata(L, -2);
nent = lua_tointeger(L, -1);
lua_pop(L, 3);
for (i = 0, pm = ids; i < nent; i++, pm++)
if (PCI_VENDOR(pa->pa_id) == pm->pm_vid &&
PCI_PRODUCT(pa->pa_id) == pm->pm_pid) {
lua_pushinteger(L, 1);
return 1;
}
lua_pushinteger(L, 0);
return 1;
}
开发者ID:repos-holder,项目名称:attic,代码行数:24,代码来源:luahw.c
示例15: yds_read_codec
static int
yds_read_codec(void *sc_, uint8_t reg, uint16_t *data)
{
struct yds_codec_softc *sc;
sc = sc_;
YWRITE2(sc->sc, AC97_CMD_ADDR, AC97_CMD_READ | AC97_ID(sc->id) | reg);
if (yds_ready_codec(sc)) {
aprint_error_dev(sc->sc->sc_dev, "yds_read_codec timeout\n");
return EIO;
}
if (PCI_PRODUCT(sc->sc->sc_id) == PCI_PRODUCT_YAMAHA_YMF744B &&
sc->sc->sc_revision < 2) {
int i;
for (i=0; i<600; i++)
(void)YREAD2(sc->sc, sc->status_data);
}
*data = YREAD2(sc->sc, sc->status_data);
return 0;
}
开发者ID:ryoon,项目名称:netbsd-xhci,代码行数:24,代码来源:yds.c
示例16: pci_conf_hook
int
pci_conf_hook(void *v, int bus, int dev, int func, pcireg_t id)
{
/*
* We need to disable devices in the Southbridge, and as
* we have all the tags we need at this point, this is
* where we do it.
*/
if (PCI_VENDOR(id) == PCI_VENDOR_ALI &&
PCI_PRODUCT(id) == PCI_PRODUCT_ALI_M1543)
{
pcitag_t tag;
int status;
pci_chipset_tag_t pc = (pci_chipset_tag_t) v;
tag = pci_make_tag(pc, bus, dev, func);
/* Undocumented magic */
/* Disable USB */
pci_conf_write_byte(pc, tag, 0x53, 0x40);
pci_conf_write_byte(pc, tag, 0x52, 0x00);
status = pci_conf_read_byte(pc, tag, 0x7e);
pci_conf_write_byte(pc, tag, 0x7e, status & ~0x80);
/* Disable modem */
pci_conf_write_byte(pc, tag, 0x77, 1 << 6);
/* Disable SCI */
pci_conf_write_byte(pc, tag, 0x78, 1 << 7);
}
return (PCI_CONF_DEFAULT);
}
开发者ID:krytarowski,项目名称:netbsd-current-src-sys,代码行数:36,代码来源:iyonix_pci.c
示例17: ndis_probe_pci
/*static*/ int
ndis_probe_pci(device_t parent, cfdata_t match, void *aux)
{
struct pci_attach_args *pa = aux;
int vendor = PCI_VENDOR(pa->pa_id);
int product = PCI_PRODUCT(pa->pa_id);
struct ndis_pci_type *t = ndis_devs;
driver_object *drv = NULL; /* = windrv_lookup(0, "PCI Bus");**/
#ifdef NDIS_DBG
printf("in ndis_probe_pci\n");
printf("vendor = %x, product = %x\n", vendor, product);
#endif
while(t->ndis_name != NULL) {
#ifdef NDIS_DBG
printf("t->ndis_vid = %x, t->ndis_did = %x\n",
t->ndis_vid, t->ndis_did);
#endif
if((vendor == t->ndis_vid) && (product == t->ndis_did)) {
#ifdef _MODULE
ndisdrv_modevent(NULL, MOD_LOAD);
//kthread_create(load_ndisdrv, NULL);
#endif /* _MODULE */
drv = windrv_lookup(0, "PCI Bus");
printf("Matching vendor: %x, product: %x, name: %s\n", vendor, product, t->ndis_name);
windrv_create_pdo(drv, parent);
return 1;
}
t++;
}
return 0; /* dosen't match */
}
开发者ID:yazshel,项目名称:netbsd-kernel,代码行数:36,代码来源:if_ndis_pci.c
示例18: nfe_attach
void
nfe_attach(struct device *parent, struct device *self, void *aux)
{
struct nfe_softc *sc = (struct nfe_softc *)self;
struct pci_attach_args *pa = aux;
pci_chipset_tag_t pc = pa->pa_pc;
pci_intr_handle_t ih;
const char *intrstr;
struct ifnet *ifp;
bus_size_t memsize;
pcireg_t memtype;
memtype = pci_mapreg_type(pa->pa_pc, pa->pa_tag, NFE_PCI_BA);
if (pci_mapreg_map(pa, NFE_PCI_BA, memtype, 0, &sc->sc_memt,
&sc->sc_memh, NULL, &memsize, 0)) {
printf(": can't map mem space\n");
return;
}
if (pci_intr_map(pa, &ih) != 0) {
printf(": can't map interrupt\n");
return;
}
intrstr = pci_intr_string(pc, ih);
sc->sc_ih = pci_intr_establish(pc, ih, IPL_NET, nfe_intr, sc,
sc->sc_dev.dv_xname);
if (sc->sc_ih == NULL) {
printf(": could not establish interrupt");
if (intrstr != NULL)
printf(" at %s", intrstr);
printf("\n");
return;
}
printf(": %s", intrstr);
sc->sc_dmat = pa->pa_dmat;
sc->sc_flags = 0;
switch (PCI_PRODUCT(pa->pa_id)) {
case PCI_PRODUCT_NVIDIA_NFORCE3_LAN2:
case PCI_PRODUCT_NVIDIA_NFORCE3_LAN3:
case PCI_PRODUCT_NVIDIA_NFORCE3_LAN4:
case PCI_PRODUCT_NVIDIA_NFORCE3_LAN5:
sc->sc_flags |= NFE_JUMBO_SUP | NFE_HW_CSUM;
break;
case PCI_PRODUCT_NVIDIA_MCP51_LAN1:
case PCI_PRODUCT_NVIDIA_MCP51_LAN2:
sc->sc_flags |= NFE_40BIT_ADDR | NFE_PWR_MGMT;
break;
case PCI_PRODUCT_NVIDIA_MCP61_LAN1:
case PCI_PRODUCT_NVIDIA_MCP61_LAN2:
case PCI_PRODUCT_NVIDIA_MCP61_LAN3:
case PCI_PRODUCT_NVIDIA_MCP61_LAN4:
case PCI_PRODUCT_NVIDIA_MCP67_LAN1:
case PCI_PRODUCT_NVIDIA_MCP67_LAN2:
case PCI_PRODUCT_NVIDIA_MCP67_LAN3:
case PCI_PRODUCT_NVIDIA_MCP67_LAN4:
case PCI_PRODUCT_NVIDIA_MCP73_LAN1:
case PCI_PRODUCT_NVIDIA_MCP73_LAN2:
case PCI_PRODUCT_NVIDIA_MCP73_LAN3:
case PCI_PRODUCT_NVIDIA_MCP73_LAN4:
sc->sc_flags |= NFE_40BIT_ADDR | NFE_CORRECT_MACADDR |
NFE_PWR_MGMT;
break;
case PCI_PRODUCT_NVIDIA_MCP77_LAN1:
case PCI_PRODUCT_NVIDIA_MCP77_LAN2:
case PCI_PRODUCT_NVIDIA_MCP77_LAN3:
case PCI_PRODUCT_NVIDIA_MCP77_LAN4:
sc->sc_flags |= NFE_40BIT_ADDR | NFE_HW_CSUM |
NFE_CORRECT_MACADDR | NFE_PWR_MGMT;
break;
case PCI_PRODUCT_NVIDIA_MCP79_LAN1:
case PCI_PRODUCT_NVIDIA_MCP79_LAN2:
case PCI_PRODUCT_NVIDIA_MCP79_LAN3:
case PCI_PRODUCT_NVIDIA_MCP79_LAN4:
case PCI_PRODUCT_NVIDIA_MCP89_LAN:
sc->sc_flags |= NFE_JUMBO_SUP | NFE_40BIT_ADDR | NFE_HW_CSUM |
NFE_CORRECT_MACADDR | NFE_PWR_MGMT;
break;
case PCI_PRODUCT_NVIDIA_CK804_LAN1:
case PCI_PRODUCT_NVIDIA_CK804_LAN2:
case PCI_PRODUCT_NVIDIA_MCP04_LAN1:
case PCI_PRODUCT_NVIDIA_MCP04_LAN2:
sc->sc_flags |= NFE_JUMBO_SUP | NFE_40BIT_ADDR | NFE_HW_CSUM;
break;
case PCI_PRODUCT_NVIDIA_MCP65_LAN1:
case PCI_PRODUCT_NVIDIA_MCP65_LAN2:
case PCI_PRODUCT_NVIDIA_MCP65_LAN3:
case PCI_PRODUCT_NVIDIA_MCP65_LAN4:
sc->sc_flags |= NFE_JUMBO_SUP | NFE_40BIT_ADDR |
NFE_CORRECT_MACADDR | NFE_PWR_MGMT;
break;
case PCI_PRODUCT_NVIDIA_MCP55_LAN1:
case PCI_PRODUCT_NVIDIA_MCP55_LAN2:
sc->sc_flags |= NFE_JUMBO_SUP | NFE_40BIT_ADDR | NFE_HW_CSUM |
NFE_HW_VLAN | NFE_PWR_MGMT;
break;
}
//.........这里部分代码省略.........
开发者ID:orumin,项目名称:openbsd-efivars,代码行数:101,代码来源:if_nfe.c
示例19: main
void
main(int argc, char *argv[], char *bootargs_start, char *bootargs_end)
{
unsigned long marks[MARK_MAX];
struct brdprop *brdprop;
char *new_argv[MAX_ARGS];
char *bname;
ssize_t len;
int err, fd, howto, i, n;
printf("\n>> %s altboot, revision %s\n", bootprog_name, bootprog_rev);
brdprop = brd_lookup(brdtype);
printf(">> %s, cpu %u MHz, bus %u MHz, %dMB SDRAM\n", brdprop->verbose,
cpuclock / 1000000, busclock / 1000000, bi_mem.memsize >> 20);
nata = pcilookup(PCI_CLASS_IDE, lata, 2);
if (nata == 0)
nata = pcilookup(PCI_CLASS_RAID, lata, 2);
if (nata == 0)
nata = pcilookup(PCI_CLASS_MISCSTORAGE, lata, 2);
if (nata == 0)
nata = pcilookup(PCI_CLASS_SCSI, lata, 2);
nnif = pcilookup(PCI_CLASS_ETH, lnif, 2);
nusb = pcilookup(PCI_CLASS_USB, lusb, 3);
#ifdef DEBUG
if (nata == 0)
printf("No IDE/SATA found\n");
else for (n = 0; n < nata; n++) {
int b, d, f, bdf, pvd;
bdf = lata[n].bdf;
pvd = lata[n].pvd;
pcidecomposetag(bdf, &b, &d, &f);
printf("%04x.%04x DSK %02d:%02d:%02d\n",
PCI_VENDOR(pvd), PCI_PRODUCT(pvd), b, d, f);
}
if (nnif == 0)
printf("no NET found\n");
else for (n = 0; n < nnif; n++) {
int b, d, f, bdf, pvd;
bdf = lnif[n].bdf;
pvd = lnif[n].pvd;
pcidecomposetag(bdf, &b, &d, &f);
printf("%04x.%04x NET %02d:%02d:%02d\n",
PCI_VENDOR(pvd), PCI_PRODUCT(pvd), b, d, f);
}
if (nusb == 0)
printf("no USB found\n");
else for (n = 0; n < nusb; n++) {
int b, d, f, bdf, pvd;
bdf = lusb[0].bdf;
pvd = lusb[0].pvd;
pcidecomposetag(bdf, &b, &d, &f);
printf("%04x.%04x USB %02d:%02d:%02d\n",
PCI_VENDOR(pvd), PCI_PRODUCT(pvd), b, d, f);
}
#endif
pcisetup();
pcifixup();
/*
* When argc is too big then it is probably a pointer, which could
* indicate that we were launched as a Linux kernel module using
* "bootm".
*/
if (argc > MAX_ARGS) {
if (argv != NULL) {
/*
* initrd image was loaded:
* check if it contains a valid altboot command line
*/
char *p = (char *)argv;
if (strncmp(p, "altboot:", 8) == 0) {
*p = 0;
for (p = p + 8; *p >= ' '; p++);
argc = parse_cmdline(new_argv, MAX_ARGS,
((char *)argv) + 8, p);
argv = new_argv;
} else
argc = 0; /* boot default */
} else {
/* parse standard Linux bootargs */
argc = parse_cmdline(new_argv, MAX_ARGS,
bootargs_start, bootargs_end);
argv = new_argv;
}
}
/* look for a PATA drive configuration string under the arguments */
for (n = 1; n < argc; n++) {
if (strncmp(argv[n], "ide:", 4) == 0 &&
argv[n][4] >= '0' && argv[n][4] <= '2') {
drive_config = &argv[n][4];
break;
}
}
//.........这里部分代码省略.........
开发者ID:yazshel,项目名称:netbsd-kernel,代码行数:101,代码来源:main.c
示例20: ahci_pci_attach
static void
ahci_pci_attach(device_t parent, device_t self, void *aux)
{
struct pci_attach_args *pa = aux;
struct ahci_pci_softc *psc = device_private(self);
struct ahci_softc *sc = &psc->ah_sc;
const char *intrstr;
bool ahci_cap_64bit;
bool ahci_bad_64bit;
pci_intr_handle_t intrhandle;
sc->sc_atac.atac_dev = self;
if (pci_mapreg_map(pa, AHCI_PCI_ABAR,
PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT, 0,
&sc->sc_ahcit, &sc->sc_ahcih, NULL, &sc->sc_ahcis) != 0) {
aprint_error_dev(self, "can't map ahci registers\n");
return;
}
psc->sc_pc = pa->pa_pc;
psc->sc_pcitag = pa->pa_tag;
pci_aprint_devinfo(pa, "AHCI disk controller");
if (pci_intr_map(pa, &intrhandle) != 0) {
aprint_error_dev(self, "couldn't map interrupt\n");
return;
}
intrstr = pci_intr_string(pa->pa_pc, intrhandle);
psc->sc_ih = pci_intr_establish(pa->pa_pc, intrhandle, IPL_BIO, ahci_intr, sc);
if (psc->sc_ih == NULL) {
aprint_error_dev(self, "couldn't establish interrupt\n");
return;
}
aprint_normal_dev(self, "interrupting at %s\n",
intrstr ? intrstr : "unknown interrupt");
sc->sc_dmat = pa->pa_dmat;
sc->sc_ahci_quirks = ahci_pci_has_quirk(PCI_VENDOR(pa->pa_id),
PCI_PRODUCT(pa->pa_id));
ahci_cap_64bit = (AHCI_READ(sc, AHCI_CAP) & AHCI_CAP_64BIT) != 0;
ahci_bad_64bit = ((sc->sc_ahci_quirks & AHCI_PCI_QUIRK_BAD64) != 0);
if (pci_dma64_available(pa) && ahci_cap_64bit) {
if (!ahci_bad_64bit)
sc->sc_dmat = pa->pa_dmat64;
aprint_verbose_dev(self, "64-bit DMA%s\n",
(sc->sc_dmat == pa->pa_dmat) ? " unavailable" : "");
}
if (PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_MASS_STORAGE_RAID) {
AHCIDEBUG_PRINT(("%s: RAID mode\n", AHCINAME(sc)), DEBUG_PROBE);
sc->sc_atac_capflags = ATAC_CAP_RAID;
} else {
AHCIDEBUG_PRINT(("%s: SATA mode\n", AHCINAME(sc)), DEBUG_PROBE);
}
ahci_attach(sc);
if (!pmf_device_register(self, NULL, ahci_pci_resume))
aprint_error_dev(self, "couldn't establish power handler\n");
}
开发者ID:RyanLucchese,项目名称:rumpkernel-netbsd-src,代码行数:64,代码来源:ahcisata_pci.c
注:本文中的PCI_PRODUCT函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论