Add two new capabilities(PCI_CAP_SATA and PCI_CAP_PCIAF).diff -r1.86 -r1.87 src/sys/dev/pci/pci_subr.c
(msaitoh)
--- src/sys/dev/pci/pci_subr.c 2010/12/11 18:22:24 1.86
+++ src/sys/dev/pci/pci_subr.c 2011/06/06 18:27:12 1.87
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: pci_subr.c,v 1.86 2010/12/11 18:22:24 matt Exp $ */ | 1 | /* $NetBSD: pci_subr.c,v 1.87 2011/06/06 18:27:12 msaitoh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1997 Zubin D. Dittia. All rights reserved. | 4 | * Copyright (c) 1997 Zubin D. Dittia. All rights reserved. | |
5 | * Copyright (c) 1995, 1996, 1998, 2000 | 5 | * Copyright (c) 1995, 1996, 1998, 2000 | |
6 | * Christopher G. Demetriou. All rights reserved. | 6 | * Christopher G. Demetriou. All rights reserved. | |
7 | * Copyright (c) 1994 Charles M. Hannum. All rights reserved. | 7 | * Copyright (c) 1994 Charles M. Hannum. All rights reserved. | |
8 | * | 8 | * | |
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
@@ -30,27 +30,27 @@ | @@ -30,27 +30,27 @@ | |||
30 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 30 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
32 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 32 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
33 | */ | 33 | */ | |
34 | 34 | |||
35 | /* | 35 | /* | |
36 | * PCI autoconfiguration support functions. | 36 | * PCI autoconfiguration support functions. | |
37 | * | 37 | * | |
38 | * Note: This file is also built into a userland library (libpci). | 38 | * Note: This file is also built into a userland library (libpci). | |
39 | * Pay attention to this when you make modifications. | 39 | * Pay attention to this when you make modifications. | |
40 | */ | 40 | */ | |
41 | 41 | |||
42 | #include <sys/cdefs.h> | 42 | #include <sys/cdefs.h> | |
43 | __KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.86 2010/12/11 18:22:24 matt Exp $"); | 43 | __KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.87 2011/06/06 18:27:12 msaitoh Exp $"); | |
44 | 44 | |||
45 | #ifdef _KERNEL_OPT | 45 | #ifdef _KERNEL_OPT | |
46 | #include "opt_pci.h" | 46 | #include "opt_pci.h" | |
47 | #endif | 47 | #endif | |
48 | 48 | |||
49 | #include <sys/param.h> | 49 | #include <sys/param.h> | |
50 | 50 | |||
51 | #ifdef _KERNEL | 51 | #ifdef _KERNEL | |
52 | #include <sys/systm.h> | 52 | #include <sys/systm.h> | |
53 | #include <sys/intr.h> | 53 | #include <sys/intr.h> | |
54 | #include <sys/module.h> | 54 | #include <sys/module.h> | |
55 | #else | 55 | #else | |
56 | #include <pci.h> | 56 | #include <pci.h> | |
@@ -1059,26 +1059,32 @@ pci_conf_print_caplist( | @@ -1059,26 +1059,32 @@ pci_conf_print_caplist( | |||
1059 | case PCI_CAP_AGP8: | 1059 | case PCI_CAP_AGP8: | |
1060 | printf("AGP 8x"); | 1060 | printf("AGP 8x"); | |
1061 | break; | 1061 | break; | |
1062 | case PCI_CAP_SECURE: | 1062 | case PCI_CAP_SECURE: | |
1063 | printf("Secure Device"); | 1063 | printf("Secure Device"); | |
1064 | break; | 1064 | break; | |
1065 | case PCI_CAP_PCIEXPRESS: | 1065 | case PCI_CAP_PCIEXPRESS: | |
1066 | printf("PCI Express"); | 1066 | printf("PCI Express"); | |
1067 | pcie_off = off; | 1067 | pcie_off = off; | |
1068 | break; | 1068 | break; | |
1069 | case PCI_CAP_MSIX: | 1069 | case PCI_CAP_MSIX: | |
1070 | printf("MSI-X"); | 1070 | printf("MSI-X"); | |
1071 | break; | 1071 | break; | |
1072 | case PCI_CAP_SATA: | |||
1073 | printf("SATA"); | |||
1074 | break; | |||
1075 | case PCI_CAP_PCIAF: | |||
1076 | printf("Advanced Features"); | |||
1077 | break; | |||
1072 | default: | 1078 | default: | |
1073 | printf("unknown"); | 1079 | printf("unknown"); | |
1074 | } | 1080 | } | |
1075 | printf(")\n"); | 1081 | printf(")\n"); | |
1076 | } | 1082 | } | |
1077 | if (msi_off != -1) | 1083 | if (msi_off != -1) | |
1078 | pci_conf_print_msi_cap(regs, msi_off); | 1084 | pci_conf_print_msi_cap(regs, msi_off); | |
1079 | if (pcipm_off != -1) | 1085 | if (pcipm_off != -1) | |
1080 | pci_conf_print_pcipm_cap(regs, pcipm_off); | 1086 | pci_conf_print_pcipm_cap(regs, pcipm_off); | |
1081 | if (pcie_off != -1) | 1087 | if (pcie_off != -1) | |
1082 | pci_conf_print_pcie_cap(regs, pcie_off); | 1088 | pci_conf_print_pcie_cap(regs, pcie_off); | |
1083 | } | 1089 | } | |
1084 | 1090 |
--- src/sys/dev/pci/pcireg.h 2011/04/05 23:37:46 1.71
+++ src/sys/dev/pci/pcireg.h 2011/06/06 18:27:12 1.72
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: pcireg.h,v 1.71 2011/04/05 23:37:46 dyoung Exp $ */ | 1 | /* $NetBSD: pcireg.h,v 1.72 2011/06/06 18:27:12 msaitoh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1995, 1996, 1999, 2000 | 4 | * Copyright (c) 1995, 1996, 1999, 2000 | |
5 | * Christopher G. Demetriou. All rights reserved. | 5 | * Christopher G. Demetriou. All rights reserved. | |
6 | * Copyright (c) 1994, 1996 Charles M. Hannum. All rights reserved. | 6 | * Copyright (c) 1994, 1996 Charles M. Hannum. All rights reserved. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
@@ -456,26 +456,28 @@ typedef u_int8_t pci_revision_t; | @@ -456,26 +456,28 @@ typedef u_int8_t pci_revision_t; | |||
456 | #define PCI_CAP_SLOTID 0x04 | 456 | #define PCI_CAP_SLOTID 0x04 | |
457 | #define PCI_CAP_MSI 0x05 | 457 | #define PCI_CAP_MSI 0x05 | |
458 | #define PCI_CAP_CPCI_HOTSWAP 0x06 | 458 | #define PCI_CAP_CPCI_HOTSWAP 0x06 | |
459 | #define PCI_CAP_PCIX 0x07 | 459 | #define PCI_CAP_PCIX 0x07 | |
460 | #define PCI_CAP_LDT 0x08 | 460 | #define PCI_CAP_LDT 0x08 | |
461 | #define PCI_CAP_VENDSPEC 0x09 | 461 | #define PCI_CAP_VENDSPEC 0x09 | |
462 | #define PCI_CAP_DEBUGPORT 0x0a | 462 | #define PCI_CAP_DEBUGPORT 0x0a | |
463 | #define PCI_CAP_CPCI_RSRCCTL 0x0b | 463 | #define PCI_CAP_CPCI_RSRCCTL 0x0b | |
464 | #define PCI_CAP_HOTPLUG 0x0c | 464 | #define PCI_CAP_HOTPLUG 0x0c | |
465 | #define PCI_CAP_AGP8 0x0e | 465 | #define PCI_CAP_AGP8 0x0e | |
466 | #define PCI_CAP_SECURE 0x0f | 466 | #define PCI_CAP_SECURE 0x0f | |
467 | #define PCI_CAP_PCIEXPRESS 0x10 | 467 | #define PCI_CAP_PCIEXPRESS 0x10 | |
468 | #define PCI_CAP_MSIX 0x11 | 468 | #define PCI_CAP_MSIX 0x11 | |
469 | #define PCI_CAP_SATA 0x12 | |||
470 | #define PCI_CAP_PCIAF 0x13 | |||
469 | 471 | |||
470 | /* | 472 | /* | |
471 | * Vital Product Data; access via capability pointer (PCI rev 2.2). | 473 | * Vital Product Data; access via capability pointer (PCI rev 2.2). | |
472 | */ | 474 | */ | |
473 | #define PCI_VPD_ADDRESS_MASK 0x7fff | 475 | #define PCI_VPD_ADDRESS_MASK 0x7fff | |
474 | #define PCI_VPD_ADDRESS_SHIFT 16 | 476 | #define PCI_VPD_ADDRESS_SHIFT 16 | |
475 | #define PCI_VPD_ADDRESS(ofs) \ | 477 | #define PCI_VPD_ADDRESS(ofs) \ | |
476 | (((ofs) & PCI_VPD_ADDRESS_MASK) << PCI_VPD_ADDRESS_SHIFT) | 478 | (((ofs) & PCI_VPD_ADDRESS_MASK) << PCI_VPD_ADDRESS_SHIFT) | |
477 | #define PCI_VPD_DATAREG(ofs) ((ofs) + 4) | 479 | #define PCI_VPD_DATAREG(ofs) ((ofs) + 4) | |
478 | #define PCI_VPD_OPFLAG 0x80000000 | 480 | #define PCI_VPD_OPFLAG 0x80000000 | |
479 | 481 | |||
480 | #define PCI_MSI_CTL_PERVEC_MASK 0x01000000 | 482 | #define PCI_MSI_CTL_PERVEC_MASK 0x01000000 | |
481 | #define PCI_MSI_CTL_64BIT_ADDR 0x00800000 | 483 | #define PCI_MSI_CTL_64BIT_ADDR 0x00800000 |