| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: imx6_pcie.c,v 1.1 2016/11/24 12:06:43 hkenken Exp $ */ | | 1 | /* $NetBSD: imx6_pcie.c,v 1.2 2016/11/25 05:03:36 hkenken Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2016 Genetec Corporation. All rights reserved. | | 4 | * Copyright (c) 2016 Genetec Corporation. All rights reserved. |
5 | * Written by Hashimoto Kenichi for Genetec Corporation. | | 5 | * Written by Hashimoto Kenichi for Genetec Corporation. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -21,30 +21,29 @@ | | | @@ -21,30 +21,29 @@ |
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
26 | * POSSIBILITY OF SUCH DAMAGE. | | 26 | * POSSIBILITY OF SUCH DAMAGE. |
27 | */ | | 27 | */ |
28 | | | 28 | |
29 | /* | | 29 | /* |
30 | * i.MX6 On-Chip PCI Express Controller | | 30 | * i.MX6 On-Chip PCI Express Controller |
31 | */ | | 31 | */ |
32 | | | 32 | |
33 | #include <sys/cdefs.h> | | 33 | #include <sys/cdefs.h> |
34 | __KERNEL_RCSID(0, "$NetBSD: imx6_pcie.c,v 1.1 2016/11/24 12:06:43 hkenken Exp $"); | | 34 | __KERNEL_RCSID(0, "$NetBSD: imx6_pcie.c,v 1.2 2016/11/25 05:03:36 hkenken Exp $"); |
35 | | | 35 | |
36 | #include "opt_pci.h" | | 36 | #include "opt_pci.h" |
37 | #include "opt_imx6pcie.h" | | | |
38 | | | 37 | |
39 | #include "pci.h" | | 38 | #include "pci.h" |
40 | #include "imxgpio.h" | | 39 | #include "imxgpio.h" |
41 | #include "locators.h" | | 40 | #include "locators.h" |
42 | | | 41 | |
43 | #include <sys/bus.h> | | 42 | #include <sys/bus.h> |
44 | #include <sys/device.h> | | 43 | #include <sys/device.h> |
45 | #include <sys/intr.h> | | 44 | #include <sys/intr.h> |
46 | #include <sys/systm.h> | | 45 | #include <sys/systm.h> |
47 | #include <sys/param.h> | | 46 | #include <sys/param.h> |
48 | #include <sys/kernel.h> | | 47 | #include <sys/kernel.h> |
49 | #include <sys/extent.h> | | 48 | #include <sys/extent.h> |
50 | #include <sys/queue.h> | | 49 | #include <sys/queue.h> |
| @@ -750,27 +749,27 @@ static void | | | @@ -750,27 +749,27 @@ static void |
750 | imx6pcie_decompose_tag(void *v, pcitag_t tag, int *bp, int *dp, int *fp) | | 749 | imx6pcie_decompose_tag(void *v, pcitag_t tag, int *bp, int *dp, int *fp) |
751 | { | | 750 | { |
752 | if (bp) | | 751 | if (bp) |
753 | *bp = (tag >> 16) & 0xff; | | 752 | *bp = (tag >> 16) & 0xff; |
754 | if (dp) | | 753 | if (dp) |
755 | *dp = (tag >> 11) & 0x1f; | | 754 | *dp = (tag >> 11) & 0x1f; |
756 | if (fp) | | 755 | if (fp) |
757 | *fp = (tag >> 8) & 0x7; | | 756 | *fp = (tag >> 8) & 0x7; |
758 | } | | 757 | } |
759 | | | 758 | |
760 | /* | | 759 | /* |
761 | * work around. | | 760 | * work around. |
762 | * If there is no PCIe devices, DABT will be generated by read/write access to | | 761 | * If there is no PCIe devices, DABT will be generated by read/write access to |
763 | * config area, so replace original DABT handler with sinple jump-back one. | | 762 | * config area, so replace original DABT handler with simple jump-back one. |
764 | */ | | 763 | */ |
765 | extern u_int data_abort_handler_address; | | 764 | extern u_int data_abort_handler_address; |
766 | static bool data_abort_flag; | | 765 | static bool data_abort_flag; |
767 | static void | | 766 | static void |
768 | imx6pcie_data_abort_handler(trapframe_t *tf) | | 767 | imx6pcie_data_abort_handler(trapframe_t *tf) |
769 | { | | 768 | { |
770 | data_abort_flag = true; | | 769 | data_abort_flag = true; |
771 | tf->tf_pc += 0x4; | | 770 | tf->tf_pc += 0x4; |
772 | return; | | 771 | return; |
773 | } | | 772 | } |
774 | | | 773 | |
775 | static pcireg_t | | 774 | static pcireg_t |
776 | imx6pcie_conf_read(void *v, pcitag_t tag, int offset) | | 775 | imx6pcie_conf_read(void *v, pcitag_t tag, int offset) |