1 /* 2 * Generic library functions for the microengines found on the Intel 3 * IXP2000 series of network processors. 4 * 5 * Copyright (C) 2004, 2005 Lennert Buytenhek <buytenh@wantstofly.org> 6 * Dedicated to Marija Kulikova. 7 * 8 * This program is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU Lesser General Public License as 10 * published by the Free Software Foundation; either version 2.1 of the 11 * License, or (at your option) any later version. 12 */ 13 14 #ifndef __IXP2000_UENGINE_H 15 #define __IXP2000_UENGINE_H 16 17 extern u32 ixp2000_uengine_mask; 18 19 struct ixp2000_uengine_code 20 { 21 u32 cpu_model_bitmask; 22 u8 cpu_min_revision; 23 u8 cpu_max_revision; 24 25 u32 uengine_parameters; 26 27 struct ixp2000_reg_value { 28 int reg; 29 u32 value; 30 } *initial_reg_values; 31 32 int num_insns; 33 u8 *insns; 34 }; 35 36 u32 ixp2000_uengine_csr_read(int uengine, int offset); 37 void ixp2000_uengine_csr_write(int uengine, int offset, u32 value); 38 void ixp2000_uengine_reset(u32 uengine_mask); 39 void ixp2000_uengine_set_mode(int uengine, u32 mode); 40 void ixp2000_uengine_load_microcode(int uengine, u8 *ucode, int insns); 41 void ixp2000_uengine_init_context(int uengine, int context, int pc); 42 void ixp2000_uengine_start_contexts(int uengine, u8 ctx_mask); 43 void ixp2000_uengine_stop_contexts(int uengine, u8 ctx_mask); 44 int ixp2000_uengine_load(int uengine, struct ixp2000_uengine_code *c); 45 46 #define IXP2000_UENGINE_8_CONTEXTS 0x00000000 47 #define IXP2000_UENGINE_4_CONTEXTS 0x80000000 48 #define IXP2000_UENGINE_PRN_UPDATE_EVERY 0x40000000 49 #define IXP2000_UENGINE_PRN_UPDATE_ON_ACCESS 0x00000000 50 #define IXP2000_UENGINE_NN_FROM_SELF 0x00100000 51 #define IXP2000_UENGINE_NN_FROM_PREVIOUS 0x00000000 52 #define IXP2000_UENGINE_ASSERT_EMPTY_AT_3 0x000c0000 53 #define IXP2000_UENGINE_ASSERT_EMPTY_AT_2 0x00080000 54 #define IXP2000_UENGINE_ASSERT_EMPTY_AT_1 0x00040000 55 #define IXP2000_UENGINE_ASSERT_EMPTY_AT_0 0x00000000 56 #define IXP2000_UENGINE_LM_ADDR1_GLOBAL 0x00020000 57 #define IXP2000_UENGINE_LM_ADDR1_PER_CONTEXT 0x00000000 58 #define IXP2000_UENGINE_LM_ADDR0_GLOBAL 0x00010000 59 #define IXP2000_UENGINE_LM_ADDR0_PER_CONTEXT 0x00000000 60 61 62 #endif 63