Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic AHCI 1.3.1 specification says that it is good pra...



details:   https://anonhg.NetBSD.org/src/rev/097f85fddee2
branches:  trunk
changeset: 948317:097f85fddee2
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sat Dec 26 10:56:25 2020 +0000

description:
AHCI 1.3.1 specification says that it is good practice for system software
to 'zero-out' the memory allocated and referenced by PxCLB and PxFB.

diffstat:

 sys/dev/ic/ahcisata_core.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (38 lines):

diff -r 6a71de8e7207 -r 097f85fddee2 sys/dev/ic/ahcisata_core.c
--- a/sys/dev/ic/ahcisata_core.c        Sat Dec 26 10:43:39 2020 +0000
+++ b/sys/dev/ic/ahcisata_core.c        Sat Dec 26 10:56:25 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ahcisata_core.c,v 1.87 2020/12/25 08:57:38 skrll Exp $ */
+/*     $NetBSD: ahcisata_core.c,v 1.88 2020/12/26 10:56:25 jmcneill Exp $      */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.87 2020/12/25 08:57:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.88 2020/12/26 10:56:25 jmcneill Exp $");
 
 #include <sys/types.h>
 #include <sys/malloc.h>
@@ -363,6 +363,9 @@
                return;
        }
        sc->sc_cmd_hdr = cmdhp;
+       memset(cmdhp, 0, dmasize);
+       bus_dmamap_sync(sc->sc_dmat, sc->sc_cmd_hdrd, 0, dmasize,
+           BUS_DMASYNC_PREWRITE);
 
        ahci_enable_intrs(sc);
 
@@ -429,6 +432,9 @@
                            ", error=%d\n", AHCINAME(sc), error);
                        break;
                }
+               memset(cmdtblp, 0, dmasize);
+               bus_dmamap_sync(sc->sc_dmat, achp->ahcic_cmd_tbld, 0,
+                   dmasize, BUS_DMASYNC_PREWRITE);
                achp->ahcic_cmdh  = (struct ahci_cmd_header *)
                    ((char *)cmdhp + AHCI_CMDH_SIZE * port);
                achp->ahcic_bus_cmdh = sc->sc_cmd_hdrd->dm_segs[0].ds_addr +



Home | Main Index | Thread Index | Old Index