Implement pci_decompose_tag().

This commit is contained in:
thorpej 1996-12-17 01:55:56 +00:00
parent c0fe650b17
commit 01daecba3a
2 changed files with 48 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: pci_machdep.c,v 1.26 1996/10/24 12:32:29 fvdl Exp $ */
/* $NetBSD: pci_machdep.c,v 1.27 1996/12/17 01:55:56 thorpej Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@ -140,6 +140,50 @@ mode2:
#endif
}
void
pci_decompose_tag(pc, tag, bp, dp, fp)
pci_chipset_tag_t pc;
pcitag_t tag;
int *bp, *dp, *fp;
{
#ifndef PCI_CONF_MODE
switch (pci_mode) {
case 1:
goto mode1;
case 2:
goto mode2;
default:
panic("pci_decompose_tag: mode not configured");
}
#endif
#if !defined(PCI_CONF_MODE) || (PCI_CONF_MODE == 1)
#ifndef PCI_CONF_MODE
mode1:
#endif
if (bp != NULL)
*bp = (tag.mode1 >> 16) & 0xff;
if (dp != NULL)
*dp = (tag.mode1 >> 11) & 0x1f;
if (fp != NULL)
*fp = (tag.mode1 >> 8) & 0x7;
return;
#endif
#if !defined(PCI_CONF_MODE) || (PCI_CONF_MODE == 2)
#ifndef PCI_CONF_MODE
mode2:
#endif
if (bp != NULL)
*bp = tag.mode2.forward & 0xff;
if (dp != NULL)
*dp = (tag.mode2.port >> 8) & 0xf;
if (fp != NULL)
*fp = (tag.mode2.enable >> 1) & 0x7;
#endif
}
pcireg_t
pci_conf_read(pc, tag, reg)
pci_chipset_tag_t pc;

View File

@ -1,4 +1,4 @@
/* $NetBSD: pci_machdep.h,v 1.5 1996/03/27 04:01:16 cgd Exp $ */
/* $NetBSD: pci_machdep.h,v 1.6 1996/12/17 01:55:58 thorpej Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@ -75,6 +75,8 @@ void pci_attach_hook __P((struct device *, struct device *,
struct pcibus_attach_args *));
int pci_bus_maxdevs __P((pci_chipset_tag_t, int));
pcitag_t pci_make_tag __P((pci_chipset_tag_t, int, int, int));
void pci_decompose_tag __P((pci_chipset_tag_t, pcitag_t,
int *, int *, int *));
pcireg_t pci_conf_read __P((pci_chipset_tag_t, pcitag_t, int));
void pci_conf_write __P((pci_chipset_tag_t, pcitag_t, int,
pcireg_t));