2 * Copyright 2008-2009 Freescale Semiconductor, Inc.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * Version 2 as published by the Free Software Foundation.
14 #define LAW_EN 0x80000000
16 #define SET_LAW_ENTRY(idx, a, sz, trgt) \
17 { .index = idx, .addr = a, .size = sz, .trgt_id = trgt }
19 #define SET_LAW(a, sz, trgt) \
20 { .index = -1, .addr = a, .size = sz, .trgt_id = trgt }
49 #define law_size_bits(sz) (__ilog2_u64(sz) - 1)
51 #ifdef CONFIG_FSL_CORENET
53 LAW_TRGT_IF_PCIE_1 = 0x00,
54 LAW_TRGT_IF_PCIE_2 = 0x01,
55 LAW_TRGT_IF_PCIE_3 = 0x02,
56 LAW_TRGT_IF_RIO_1 = 0x08,
57 LAW_TRGT_IF_RIO_2 = 0x09,
59 LAW_TRGT_IF_DDR_1 = 0x10,
60 LAW_TRGT_IF_DDR_2 = 0x11, /* 2nd controller */
61 LAW_TRGT_IF_DDR_INTRLV = 0x14,
63 LAW_TRGT_IF_BMAN = 0x18,
64 LAW_TRGT_IF_DCSR = 0x1d,
65 LAW_TRGT_IF_LBC = 0x1f,
66 LAW_TRGT_IF_QMAN = 0x3c,
68 #define LAW_TRGT_IF_DDR LAW_TRGT_IF_DDR_1
71 LAW_TRGT_IF_PCI = 0x00,
72 LAW_TRGT_IF_PCI_2 = 0x01,
73 #ifndef CONFIG_MPC8641
74 LAW_TRGT_IF_PCIE_1 = 0x02,
76 #if !defined(CONFIG_MPC8572) && !defined(CONFIG_P2020)
77 LAW_TRGT_IF_PCIE_3 = 0x03,
79 LAW_TRGT_IF_LBC = 0x04,
80 LAW_TRGT_IF_CCSR = 0x08,
81 LAW_TRGT_IF_DDR_INTRLV = 0x0b,
82 LAW_TRGT_IF_RIO = 0x0c,
83 LAW_TRGT_IF_RIO_2 = 0x0d,
84 LAW_TRGT_IF_DDR = 0x0f,
85 LAW_TRGT_IF_DDR_2 = 0x16, /* 2nd controller */
87 #define LAW_TRGT_IF_DDR_1 LAW_TRGT_IF_DDR
88 #define LAW_TRGT_IF_PCI_1 LAW_TRGT_IF_PCI
89 #define LAW_TRGT_IF_PCIX LAW_TRGT_IF_PCI
90 #define LAW_TRGT_IF_PCIE_2 LAW_TRGT_IF_PCI_2
93 #define LAW_TRGT_IF_PCIE_1 LAW_TRGT_IF_PCI
96 #if defined(CONFIG_MPC8572) || defined(CONFIG_P2020)
97 #define LAW_TRGT_IF_PCIE_3 LAW_TRGT_IF_PCI
99 #endif /* CONFIG_FSL_CORENET */
105 enum law_trgt_if trgt_id;
108 extern void set_law(u8 idx, phys_addr_t addr, enum law_size sz, enum law_trgt_if id);
109 extern int set_next_law(phys_addr_t addr, enum law_size sz, enum law_trgt_if id);
110 extern int set_last_law(phys_addr_t addr, enum law_size sz, enum law_trgt_if id);
111 extern int set_ddr_laws(u64 start, u64 sz, enum law_trgt_if id);
112 extern struct law_entry find_law(phys_addr_t addr);
113 extern void disable_law(u8 idx);
114 extern void init_laws(void);
115 extern void print_laws(void);
117 /* define in board code */
118 extern struct law_entry law_table[];
119 extern int num_law_entries;