1/*
2 * HND SOCRAM TCAM software interface.
3 *
4 * Copyright (C) 2010, Broadcom Corporation. All Rights Reserved.
5 *
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.
9 *
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.
17 *
18 * $Id: hndtcam.h,v 1.3 2008/12/17 13:09:49 Exp $
19 */
20#ifndef _hndtcam_h_
21#define _hndtcam_h_
22
23/*
24 * 0 - 1
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
30 */
31
32#ifdef  PATCHCOUNT
33#define SRPC_PATCHCOUNT PATCHCOUNT
34#else
35#define PATCHCOUNT 0
36#define SRPC_PATCHCOUNT PATCHCOUNT
37#endif
38
39/* N Consecutive location to patch */
40#define SRPC_PATCHNLOC (1 << (SRPC_PATCHCOUNT))
41
42/* patch values and address structure */
43typedef struct patchaddrvalue {
44	uint32	addr;
45	uint32	value;
46} patchaddrvalue_t;
47
48extern void hnd_patch_init(void *srp);
49extern void hnd_tcam_write(void *srp, uint16 index, uint32 data);
50extern void hnd_tcam_read(void *srp, uint16 index, uint32 *content);
51void * hnd_tcam_init(void *srp, uint no_addrs);
52extern void hnd_tcam_disablepatch(void *srp);
53extern void hnd_tcam_enablepatch(void *srp);
54#ifdef CONFIG_XIP
55extern void hnd_tcam_bootloader_load(void *srp, char *pvars);
56#else
57extern void hnd_tcam_load(void *srp, const  patchaddrvalue_t *patchtbl);
58#endif /* CONFIG_XIP */
59
60#endif /* _hndtcam_h_ */
61