diff options
author | se <se@FreeBSD.org> | 1997-04-23 19:43:20 +0000 |
---|---|---|
committer | se <se@FreeBSD.org> | 1997-04-23 19:43:20 +0000 |
commit | 0ea0f813c540c68cd72a826de89f766e8faed5a5 (patch) | |
tree | c14172eb56c05614f45a965e2c8c686b8e784fe4 | |
parent | 2fefab8f6a0b63fb7f226ac725a7a751e74f69f0 (diff) | |
download | FreeBSD-src-0ea0f813c540c68cd72a826de89f766e8faed5a5.zip FreeBSD-src-0ea0f813c540c68cd72a826de89f766e8faed5a5.tar.gz |
Add preliminary support for PCI config header type 2:
Fetch subvendor/device ID from config space register 0x40.
-rw-r--r-- | sys/dev/pci/pci.c | 29 | ||||
-rw-r--r-- | sys/pci/pci.c | 29 |
2 files changed, 38 insertions, 20 deletions
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index 531f4aa..8c1bc7d 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -1,6 +1,6 @@ /************************************************************************** ** -** $Id: pci.c,v 1.67 1997/03/25 19:01:46 se Exp $ +** $Id: pci.c,v 1.68 1997/03/25 19:12:08 se Exp $ ** ** General subroutines for the PCI bus. ** pci_configure () @@ -1821,20 +1821,29 @@ pci_remember(int bus, int dev, int func, struct pci_device *dvp) } p = &pci_dev_list[pci_dev_list_count - 1]; - p->pc_sel.pc_bus = bus; - p->pc_sel.pc_dev = dev; + p->pc_sel.pc_bus = bus; + p->pc_sel.pc_dev = dev; p->pc_sel.pc_func = func; - p->pc_hdr = (pci_conf_read (tag, PCI_HEADER_MISC) >> 16) & 0xff; + p->pc_dvp = dvp; + p->pc_cb = pcicb; + tag = pcibus->pb_tag (bus, dev, func); + p->pc_hdr = (pci_conf_read (tag, PCI_HEADER_MISC) >> 16) & 0xff; p->pc_devid = pci_conf_read(tag, PCI_ID_REG); - p->pc_dvp = dvp; - p->pc_cb = pcicb; - if ((p->pc_hdr & 0x7f) == 1) { - p->pc_subid = pci_conf_read(tag, PCI_SUBID_REG1); - } else { + p->pc_class = pci_conf_read(tag, PCI_CLASS_REG); + switch (p->pc_hdr & 0x7f) { + case 0: p->pc_subid = pci_conf_read(tag, PCI_SUBID_REG0); + break; + case 1: + p->pc_subid = pci_conf_read(tag, PCI_SUBID_REG1); + break; + case 2: + p->pc_subid = pci_conf_read(tag, PCI_SUBID_REG2); + break; + default: + p->pc_subid = 0; } - p->pc_class = pci_conf_read(tag, PCI_CLASS_REG); } static int diff --git a/sys/pci/pci.c b/sys/pci/pci.c index 531f4aa..8c1bc7d 100644 --- a/sys/pci/pci.c +++ b/sys/pci/pci.c @@ -1,6 +1,6 @@ /************************************************************************** ** -** $Id: pci.c,v 1.67 1997/03/25 19:01:46 se Exp $ +** $Id: pci.c,v 1.68 1997/03/25 19:12:08 se Exp $ ** ** General subroutines for the PCI bus. ** pci_configure () @@ -1821,20 +1821,29 @@ pci_remember(int bus, int dev, int func, struct pci_device *dvp) } p = &pci_dev_list[pci_dev_list_count - 1]; - p->pc_sel.pc_bus = bus; - p->pc_sel.pc_dev = dev; + p->pc_sel.pc_bus = bus; + p->pc_sel.pc_dev = dev; p->pc_sel.pc_func = func; - p->pc_hdr = (pci_conf_read (tag, PCI_HEADER_MISC) >> 16) & 0xff; + p->pc_dvp = dvp; + p->pc_cb = pcicb; + tag = pcibus->pb_tag (bus, dev, func); + p->pc_hdr = (pci_conf_read (tag, PCI_HEADER_MISC) >> 16) & 0xff; p->pc_devid = pci_conf_read(tag, PCI_ID_REG); - p->pc_dvp = dvp; - p->pc_cb = pcicb; - if ((p->pc_hdr & 0x7f) == 1) { - p->pc_subid = pci_conf_read(tag, PCI_SUBID_REG1); - } else { + p->pc_class = pci_conf_read(tag, PCI_CLASS_REG); + switch (p->pc_hdr & 0x7f) { + case 0: p->pc_subid = pci_conf_read(tag, PCI_SUBID_REG0); + break; + case 1: + p->pc_subid = pci_conf_read(tag, PCI_SUBID_REG1); + break; + case 2: + p->pc_subid = pci_conf_read(tag, PCI_SUBID_REG2); + break; + default: + p->pc_subid = 0; } - p->pc_class = pci_conf_read(tag, PCI_CLASS_REG); } static int |