Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Mark all of the Rx descriptor fields 'volatile' ...



details:   https://anonhg.NetBSD.org/src/rev/def6f4565b45
branches:  trunk
changeset: 772154:def6f4565b45
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Tue Dec 20 21:27:29 2011 +0000

description:
Mark all of the Rx descriptor fields 'volatile' so that the compiler
will not re-order accesses.  Some versions of GCC (such as one in NetBSD
5.x) definitely do re-order reads from these fields if they're not
marked volatile.

diffstat:

 sys/dev/pci/if_wmreg.h |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (30 lines):

diff -r d9a68f249bc3 -r def6f4565b45 sys/dev/pci/if_wmreg.h
--- a/sys/dev/pci/if_wmreg.h    Tue Dec 20 21:26:37 2011 +0000
+++ b/sys/dev/pci/if_wmreg.h    Tue Dec 20 21:27:29 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wmreg.h,v 1.45 2011/05/20 01:51:36 msaitoh Exp $    */
+/*     $NetBSD: if_wmreg.h,v 1.46 2011/12/20 21:27:29 dyoung Exp $     */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -57,14 +57,14 @@
  * and there must be an even multiple of 8 descriptors in the ring.
  */
 typedef struct wiseman_rxdesc {
-       wiseman_addr_t  wrx_addr;       /* buffer address */
+       volatile wiseman_addr_t wrx_addr;       /* buffer address */
 
-       uint16_t        wrx_len;        /* buffer length */
-       uint16_t        wrx_cksum;      /* checksum (starting at PCSS) */
+       volatile uint16_t       wrx_len;        /* buffer length */
+       volatile uint16_t       wrx_cksum;      /* checksum (starting at PCSS)*/
 
-       uint8_t         wrx_status;     /* Rx status */
-       uint8_t         wrx_errors;     /* Rx errors */
-       uint16_t        wrx_special;    /* special field (VLAN, etc.) */
+       volatile uint8_t        wrx_status;     /* Rx status */
+       volatile uint8_t        wrx_errors;     /* Rx errors */
+       volatile uint16_t       wrx_special;    /* special field (VLAN, etc.) */
 } __packed wiseman_rxdesc_t;
 
 /* wrx_status bits */



Home | Main Index | Thread Index | Old Index