Kumar Gala | 95fd2f6 | 2008-01-16 01:13:58 -0600 | [diff] [blame] | 1 | #ifndef _FSL_LAW_H_ |
| 2 | #define _FSL_LAW_H_ |
| 3 | |
| 4 | #include <asm/io.h> |
| 5 | |
Kumar Gala | 95fd2f6 | 2008-01-16 01:13:58 -0600 | [diff] [blame] | 6 | #define SET_LAW_ENTRY(idx, a, sz, trgt) \ |
| 7 | { .index = idx, .addr = a, .size = sz, .trgt_id = trgt } |
| 8 | |
Kumar Gala | 75639e0 | 2008-06-11 00:44:10 -0500 | [diff] [blame] | 9 | #define SET_LAW(a, sz, trgt) \ |
| 10 | { .index = -1, .addr = a, .size = sz, .trgt_id = trgt } |
| 11 | |
Kumar Gala | 95fd2f6 | 2008-01-16 01:13:58 -0600 | [diff] [blame] | 12 | enum law_size { |
| 13 | LAW_SIZE_4K = 0xb, |
| 14 | LAW_SIZE_8K, |
| 15 | LAW_SIZE_16K, |
| 16 | LAW_SIZE_32K, |
| 17 | LAW_SIZE_64K, |
| 18 | LAW_SIZE_128K, |
| 19 | LAW_SIZE_256K, |
| 20 | LAW_SIZE_512K, |
| 21 | LAW_SIZE_1M, |
| 22 | LAW_SIZE_2M, |
| 23 | LAW_SIZE_4M, |
| 24 | LAW_SIZE_8M, |
| 25 | LAW_SIZE_16M, |
| 26 | LAW_SIZE_32M, |
| 27 | LAW_SIZE_64M, |
| 28 | LAW_SIZE_128M, |
| 29 | LAW_SIZE_256M, |
| 30 | LAW_SIZE_512M, |
| 31 | LAW_SIZE_1G, |
| 32 | LAW_SIZE_2G, |
| 33 | LAW_SIZE_4G, |
| 34 | LAW_SIZE_8G, |
| 35 | LAW_SIZE_16G, |
| 36 | LAW_SIZE_32G, |
| 37 | }; |
| 38 | |
| 39 | enum law_trgt_if { |
| 40 | LAW_TRGT_IF_PCI = 0x00, |
| 41 | LAW_TRGT_IF_PCI_2 = 0x01, |
| 42 | #ifndef CONFIG_MPC8641 |
| 43 | LAW_TRGT_IF_PCIE_1 = 0x02, |
| 44 | #endif |
| 45 | #ifndef CONFIG_MPC8572 |
| 46 | LAW_TRGT_IF_PCIE_3 = 0x03, |
| 47 | #endif |
| 48 | LAW_TRGT_IF_LBC = 0x04, |
| 49 | LAW_TRGT_IF_CCSR = 0x08, |
| 50 | LAW_TRGT_IF_DDR_INTRLV = 0x0b, |
| 51 | LAW_TRGT_IF_RIO = 0x0c, |
| 52 | LAW_TRGT_IF_DDR = 0x0f, |
| 53 | LAW_TRGT_IF_DDR_2 = 0x16, /* 2nd controller */ |
| 54 | }; |
| 55 | #define LAW_TRGT_IF_DDR_1 LAW_TRGT_IF_DDR |
| 56 | #define LAW_TRGT_IF_PCI_1 LAW_TRGT_IF_PCI |
| 57 | #define LAW_TRGT_IF_PCIX LAW_TRGT_IF_PCI |
| 58 | #define LAW_TRGT_IF_PCIE_2 LAW_TRGT_IF_PCI_2 |
| 59 | |
| 60 | #ifdef CONFIG_MPC8641 |
| 61 | #define LAW_TRGT_IF_PCIE_1 LAW_TRGT_IF_PCI |
| 62 | #endif |
| 63 | |
| 64 | #ifdef CONFIG_MPC8572 |
| 65 | #define LAW_TRGT_IF_PCIE_3 LAW_TRGT_IF_PCI |
| 66 | #endif |
| 67 | |
| 68 | struct law_entry { |
| 69 | int index; |
| 70 | phys_addr_t addr; |
| 71 | enum law_size size; |
| 72 | enum law_trgt_if trgt_id; |
| 73 | }; |
| 74 | |
| 75 | extern void set_law(u8 idx, phys_addr_t addr, enum law_size sz, enum law_trgt_if id); |
Kumar Gala | 75639e0 | 2008-06-11 00:44:10 -0500 | [diff] [blame] | 76 | extern int set_next_law(phys_addr_t addr, enum law_size sz, enum law_trgt_if id); |
Kumar Gala | a9abb00 | 2008-06-10 16:16:02 -0500 | [diff] [blame] | 77 | extern int set_last_law(phys_addr_t addr, enum law_size sz, enum law_trgt_if id); |
Kumar Gala | 61ed053 | 2008-08-26 15:01:28 -0500 | [diff] [blame^] | 78 | extern int set_ddr_laws(u64 start, u64 sz, enum law_trgt_if id); |
Kumar Gala | 95fd2f6 | 2008-01-16 01:13:58 -0600 | [diff] [blame] | 79 | extern void disable_law(u8 idx); |
| 80 | extern void init_laws(void); |
Becky Bruce | 2a15f75 | 2008-01-23 16:31:05 -0600 | [diff] [blame] | 81 | extern void print_laws(void); |
Kumar Gala | 95fd2f6 | 2008-01-16 01:13:58 -0600 | [diff] [blame] | 82 | |
| 83 | /* define in board code */ |
| 84 | extern struct law_entry law_table[]; |
| 85 | extern int num_law_entries; |
| 86 | #endif |