1 /* PR target/35664 */
2 /* Tetstcase by Mike Stein <mstein.lists@googlemail.com> */
3 
4 /* { dg-do compile } */
5 /* { dg-options "-O2 -mno-fpu" } */
6 
7 typedef unsigned char u8;
8 typedef unsigned short u16;
9 typedef unsigned int u32;
10 typedef unsigned long long u64;
11 struct pt_regs {
12 };
__get_current(void)13 static inline __attribute__((always_inline)) struct task_struct *__get_current(void)
14 {
15 }
flip_dword(u32 l)16 static inline __attribute__((always_inline)) u32 flip_dword (u32 l)
17 {
18  return ((l&0xff)<<24) | (((l>>8)&0xff)<<16) | (((l>>16)&0xff)<<8)| ((l>>24)&0xff);
19 }
__readl(const volatile void * addr)20 static inline __attribute__((always_inline)) u32 __readl(const volatile void *addr)
21 {
22  return flip_dword(*( volatile u32 *)addr);
23 }
24 enum e1e_registers {
25  E1000_PRC64 = 0x0405C,
26  E1000_PRC127 = 0x04060,
27  E1000_PRC255 = 0x04064,
28  E1000_PTC511 = 0x040E4,
29  E1000_PTC1023 = 0x040E8,
30  E1000_PTC1522 = 0x040EC,
31  E1000_MPTC = 0x040F0,
32 };
33 enum e1000_media_type {
34  e1000_media_type_copper = 1,
35 };
36 struct e1000_rx_desc {
37  struct {
38  } wb;
39 };
40 struct e1000_hw_stats {
41  u64 prc64;
42  u64 prc127;
43  u64 prc255;
44  u64 ptc511;
45  u64 ptc1023;
46  u64 ptc1522;
47  u64 mptc;
48 };
49 struct e1000_shadow_ram {
50  u16 value;
51 };
52 struct e1000_dev_spec_ich8lan {
53  struct e1000_shadow_ram shadow_ram[2048];
54 };
55 struct e1000_hw {
56  u8 *hw_addr;
57  union {
58   struct e1000_dev_spec_ich8lan ich8lan;
59  } dev_spec;
60  enum e1000_media_type media_type;
61 };
62 struct e1000_adapter {
63  u16 link_speed;
64  struct e1000_hw hw;
65  struct e1000_hw_stats stats;
66  unsigned int flags;
67 };
__er32(struct e1000_hw * hw,unsigned long reg)68 static inline __attribute__((always_inline)) u32 __er32(struct e1000_hw *hw, unsigned long reg)
69 {
70  return __readl(hw->hw_addr + reg);
71 }
72 int e1e_rphy(struct e1000_hw *, int, u16 *);
e1000e_update_stats(struct e1000_adapter * adapter)73 void e1000e_update_stats(struct e1000_adapter *adapter)
74 {
75  struct e1000_hw *hw = &adapter->hw;
76  u16 phy_tmp;
77  if (adapter->flags & (1 << 10)) {
78   adapter->stats.prc64 += __er32(hw, E1000_PRC64);
79   adapter->stats.prc127 += __er32(hw, E1000_PRC127);
80   adapter->stats.prc255 += __er32(hw, E1000_PRC255);
81   adapter->stats.ptc511 += __er32(hw, E1000_PTC511);
82   adapter->stats.ptc1023 += __er32(hw, E1000_PTC1023);
83   adapter->stats.ptc1522 += __er32(hw, E1000_PTC1522);
84  }
85  adapter->stats.mptc += __er32(hw, E1000_MPTC);
86  if (hw->media_type == e1000_media_type_copper) {
87   if ((adapter->link_speed == 1000) &&
88      (!e1e_rphy(hw, 0x0A, &phy_tmp))) {
89   }
90  }
91 }
92