2 * HND SOCRAM TCAM software interface.
4 * Copyright (C) 2013, Broadcom Corporation. All Rights Reserved.
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
13 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
15 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
16 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 * $Id: hndtcam.h 419467 2013-08-21 09:19:48Z $
25 * 1 - 2 Consecutive locations are patched
26 * 2 - 4 Consecutive locations are patched
27 * 3 - 8 Consecutive locations are patched
28 * 4 - 16 Consecutive locations are patched
29 * Define default to patch 2 locations
33 #define SRPC_PATCHCOUNT PATCHCOUNT
36 #define SRPC_PATCHCOUNT PATCHCOUNT
39 #if defined(__ARM_ARCH_7R__)
40 #if !defined(PATCHCOUNT) || (PATCHCOUNT == 0)
44 #define ARMCR4_TCAMPATCHCOUNT PATCHCOUNT
45 #define ARMCR4_TCAMADDR_MASK (~((1 << (ARMCR4_TCAMPATCHCOUNT + 2))-1))
46 #define ARMCR4_PATCHNLOC (1 << ARMCR4_TCAMPATCHCOUNT)
47 #endif /* defined(__ARM_ARCH_7R__) */
49 /* N Consecutive location to patch */
50 #define SRPC_PATCHNLOC (1 << (SRPC_PATCHCOUNT))
52 #define PATCHHDR(_p) __attribute__ ((__section__ (".patchhdr."#_p))) _p
53 #define PATCHENTRY(_p) __attribute__ ((__section__ (".patchentry."#_p))) _p
55 #if defined(__ARM_ARCH_7R__)
57 uint32 data
[ARMCR4_PATCHNLOC
];
61 uint32 data
[SRPC_PATCHNLOC
];
66 void *addr
; /* patch address */
67 uint32 len
; /* bytes to patch in entry */
68 patch_entry_t
*entry
; /* patch entry data */
71 /* patch values and address structure */
72 typedef struct patchaddrvalue
{
77 extern void *socram_regs
;
78 extern uint32 socram_rev
;
80 extern void *arm_regs
;
82 extern void hnd_patch_init(void *srp
);
83 extern void hnd_tcam_write(void *srp
, uint16 idx
, uint32 data
);
84 extern void hnd_tcam_read(void *srp
, uint16 idx
, uint32
*content
);
85 void * hnd_tcam_init(void *srp
, int no_addrs
);
86 extern void hnd_tcam_disablepatch(void *srp
);
87 extern void hnd_tcam_patchdisable(void);
88 extern void hnd_tcam_enablepatch(void *srp
);
90 extern void hnd_tcam_bootloader_load(void *srp
, char *pvars
);
92 extern void hnd_tcam_load(void *srp
, const patchaddrvalue_t
*patchtbl
);
93 #endif /* CONFIG_XIP */
94 extern void BCMATTACHFN(hnd_tcam_load_default
)(void);
95 extern void hnd_tcam_reclaim(void);
97 #endif /* _hndtcam_h_ */