Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-9]: src/sys/arch/arm/cortex Pull up following revision(s) (reques...



details:   https://anonhg.NetBSD.org/src/rev/04d23a1ee4ad
branches:  netbsd-9
changeset: 963870:04d23a1ee4ad
user:      martin <martin%NetBSD.org@localhost>
date:      Thu May 07 18:25:14 2020 +0000

description:
Pull up following revision(s) (requested by jmcneill in ticket #895):

        sys/arch/arm/cortex/gic_v2m.h: revision 1.3
        sys/arch/arm/cortex/gic_v2m.c: revision 1.9

Do not store a pointer to the passed in struct pci_attach_args

diffstat:

 sys/arch/arm/cortex/gic_v2m.c |  18 ++++++++++++++----
 sys/arch/arm/cortex/gic_v2m.h |   4 ++--
 2 files changed, 16 insertions(+), 6 deletions(-)

diffs (72 lines):

diff -r 5519eb241e82 -r 04d23a1ee4ad sys/arch/arm/cortex/gic_v2m.c
--- a/sys/arch/arm/cortex/gic_v2m.c     Thu May 07 18:22:58 2020 +0000
+++ b/sys/arch/arm/cortex/gic_v2m.c     Thu May 07 18:25:14 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gic_v2m.c,v 1.6.2.1 2019/10/15 19:40:34 martin Exp $ */
+/* $NetBSD: gic_v2m.c,v 1.6.2.2 2020/05/07 18:25:14 martin Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #define _INTR_PRIVATE
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gic_v2m.c,v 1.6.2.1 2019/10/15 19:40:34 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gic_v2m.c,v 1.6.2.2 2020/05/07 18:25:14 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/kmem.h>
@@ -66,6 +66,7 @@
 gic_v2m_msi_alloc_spi(struct gic_v2m_frame *frame, int count,
     const struct pci_attach_args *pa)
 {
+       struct pci_attach_args *new_pa;
        int spi, n;
 
        for (spi = frame->frame_base;
@@ -75,8 +76,11 @@
                                if (frame->frame_pa[spi + n] != NULL)
                                        goto next_spi;
 
-                       for (n = 0; n < count; n++)
-                               frame->frame_pa[spi + n] = pa;
+                       for (n = 0; n < count; n++) {
+                               new_pa = kmem_alloc(sizeof(*new_pa), KM_SLEEP);
+                               memcpy(new_pa, pa, sizeof(*new_pa));
+                               frame->frame_pa[spi + n] = new_pa;
+                       }
 
                        return spi;
                }
@@ -90,7 +94,13 @@
 static void
 gic_v2m_msi_free_spi(struct gic_v2m_frame *frame, int spi)
 {
+       struct pci_attach_args *pa;
+
+       pa = frame->frame_pa[spi];
        frame->frame_pa[spi] = NULL;
+
+       if (pa != NULL)
+               kmem_free(pa, sizeof(*pa));
 }
 
 static int
diff -r 5519eb241e82 -r 04d23a1ee4ad sys/arch/arm/cortex/gic_v2m.h
--- a/sys/arch/arm/cortex/gic_v2m.h     Thu May 07 18:22:58 2020 +0000
+++ b/sys/arch/arm/cortex/gic_v2m.h     Thu May 07 18:25:14 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gic_v2m.h,v 1.1.8.1 2019/10/15 19:40:34 martin Exp $ */
+/* $NetBSD: gic_v2m.h,v 1.1.8.2 2020/05/07 18:25:14 martin Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -43,7 +43,7 @@
        uint32_t                frame_flags;
 #define        GIC_V2M_FLAG_GRAVITON           0x01    /* Amazon Graviton quirk */
 
-       const struct pci_attach_args *frame_pa[GICC_IAR_IRQ];
+       struct pci_attach_args *frame_pa[GICC_IAR_IRQ];
 
        struct arm_pci_msi      frame_msi;
 };



Home | Main Index | Thread Index | Old Index