From owner-svn-src-head@FreeBSD.ORG Thu Mar 29 11:46:30 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8CB27106564A; Thu, 29 Mar 2012 11:46:30 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 771998FC16; Thu, 29 Mar 2012 11:46:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2TBkU70091244; Thu, 29 Mar 2012 11:46:30 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2TBkU95091241; Thu, 29 Mar 2012 11:46:30 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201203291146.q2TBkU95091241@svn.freebsd.org> From: "Jayachandran C." Date: Thu, 29 Mar 2012 11:46:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233657 - head/sys/mips/nlm/dev/net/ucore X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Mar 2012 11:46:30 -0000 Author: jchandra Date: Thu Mar 29 11:46:29 2012 New Revision: 233657 URL: http://svn.freebsd.org/changeset/base/233657 Log: Remove unnecessary assembly code. The compiler should generate lw/sw corresponding to register operations. Modified: head/sys/mips/nlm/dev/net/ucore/ucore.h head/sys/mips/nlm/dev/net/ucore/ucore_app.c Modified: head/sys/mips/nlm/dev/net/ucore/ucore.h ============================================================================== --- head/sys/mips/nlm/dev/net/ucore/ucore.h Thu Mar 29 11:20:19 2012 (r233656) +++ head/sys/mips/nlm/dev/net/ucore/ucore.h Thu Mar 29 11:46:29 2012 (r233657) @@ -45,8 +45,8 @@ #define UCORE_FR_FIFOEMPTY 0x802c #define UCORE_PKT_DISTR 0x8030 -#define PACKET_MEMORY (0xFFE00) -#define PACKET_DATA_OFFSET (64) +#define PACKET_MEMORY 0xFFE00 +#define PACKET_DATA_OFFSET 64 #define SHARED_SCRATCH_MEM 0x18000 /* Distribution mode */ @@ -57,8 +57,8 @@ #define VAL_PDL(x) (((x) & 0xf) << 4) /*output buffer done*/ -#define VAL_FSV(x) (x<<19) -#define VAL_FFS(x) (x<<14) +#define VAL_FSV(x) (x << 19) +#define VAL_FFS(x) (x << 14) #define FWD_DEST_ONLY 1 #define FWD_ENQ_DIST_VEC 2 @@ -69,37 +69,33 @@ #define USE_HASH_DST (1 << 20) +static __inline unsigned int +nlm_read_ucore_reg(int reg) +{ + volatile unsigned int *addr = (volatile void *)reg; + + return (*addr); +} + +static __inline void +nlm_write_ucore_reg(int reg, unsigned int val) +{ + volatile unsigned int *addr = (volatile void *)reg; + + *addr = val; +} #define NLM_DEFINE_UCORE(name, reg) \ -static __inline__ unsigned int nlm_read_ucore_##name(void) \ +static __inline unsigned int \ +nlm_read_ucore_##name(void) \ { \ - unsigned int __rv; \ - __asm__ __volatile__ ( \ - ".set push\n" \ - ".set noreorder\n" \ - ".set mips32\n" \ - "li $8, %1\n" \ - "lw %0, ($8)\n" \ - ".set pop\n" \ - : "=r" (__rv) \ - : "i" (reg) \ - : "$8" \ - ); \ - return __rv; \ + return nlm_read_ucore_reg(reg); \ } \ \ -static __inline__ void nlm_write_ucore_##name(unsigned int val) \ +static __inline void \ +nlm_write_ucore_##name(unsigned int v) \ { \ - __asm__ __volatile__( \ - ".set push\n" \ - ".set noreorder\n" \ - ".set mips32\n" \ - "li $8, %1\n" \ - "sw %0, ($8)\n" \ - ".set pop\n" \ - :: "r" (val), "i" (reg) \ - : "$8" \ - ); \ + nlm_write_ucore_reg(reg, v); \ } struct __hack Modified: head/sys/mips/nlm/dev/net/ucore/ucore_app.c ============================================================================== --- head/sys/mips/nlm/dev/net/ucore/ucore_app.c Thu Mar 29 11:20:19 2012 (r233656) +++ head/sys/mips/nlm/dev/net/ucore/ucore_app.c Thu Mar 29 11:46:29 2012 (r233657) @@ -38,7 +38,7 @@ int main(void) int intf, hw_parser_error, context; #endif unsigned int pktrdy; - int num_cachelines = 1518 >> 6; /* pktsize / L3 cacheline size */ + int num_cachelines = 1518 / 64 ; /* pktsize / L3 cacheline size */ /* Spray packets to using distribution vector */