30 |
#define C2691_DEFAULT_IOMEM_SIZE 5 /* Percents! */ |
#define C2691_DEFAULT_IOMEM_SIZE 5 /* Percents! */ |
31 |
|
|
32 |
/* 2691 characteritics: 1 NM, 3 WIC, 2 AIM */ |
/* 2691 characteritics: 1 NM, 3 WIC, 2 AIM */ |
33 |
#define C2691_MAX_NM_BAYS 2 |
#define C2691_MAX_NM_BAYS 2 |
34 |
|
#define C2691_MAX_WIC_BAYS 3 |
35 |
|
|
36 |
/* C2691 DUART Interrupt */ |
/* C2691 DUART Interrupt */ |
37 |
#define C2691_DUART_IRQ 5 |
#define C2691_DUART_IRQ 5 |
51 |
#define C2691_NETIO_IRQ_PORT_MASK ((1 << C2691_NETIO_IRQ_PORT_BITS) - 1) |
#define C2691_NETIO_IRQ_PORT_MASK ((1 << C2691_NETIO_IRQ_PORT_BITS) - 1) |
52 |
#define C2691_NETIO_IRQ_PER_SLOT (1 << C2691_NETIO_IRQ_PORT_BITS) |
#define C2691_NETIO_IRQ_PER_SLOT (1 << C2691_NETIO_IRQ_PORT_BITS) |
53 |
#define C2691_NETIO_IRQ_END \ |
#define C2691_NETIO_IRQ_END \ |
54 |
(C2691_NETIO_IRQ_BASE + (C2691_MAX_NM_BAYS * C2691_NETIO_IRQ_PER_SLOT) - 1) |
(C2691_NETIO_IRQ_BASE + (C2691_MAX_NM_BAYS * C2691_NETIO_IRQ_PER_SLOT) - 1) |
55 |
|
|
56 |
/* C2691 common device addresses */ |
/* C2691 common device addresses */ |
57 |
#define C2691_GT96K_ADDR 0x14000000ULL |
#define C2691_GT96K_ADDR 0x14000000ULL |
58 |
#define C2691_IOFPGA_ADDR 0x1e800000ULL |
#define C2691_IOFPGA_ADDR 0x1e800000ULL |
|
#define C2691_DUART_ADDR 0x3c100000ULL |
|
59 |
#define C2691_BITBUCKET_ADDR 0x1ec00000ULL |
#define C2691_BITBUCKET_ADDR 0x1ec00000ULL |
60 |
#define C2691_ROM_ADDR 0x1fc00000ULL |
#define C2691_ROM_ADDR 0x1fc00000ULL |
61 |
#define C2691_SLOT0_ADDR 0x30000000ULL |
#define C2691_SLOT0_ADDR 0x30000000ULL |
62 |
#define C2691_SLOT1_ADDR 0x32000000ULL |
#define C2691_SLOT1_ADDR 0x32000000ULL |
63 |
|
#define C2691_DUART_ADDR 0x3c100000ULL |
64 |
|
#define C2691_WIC_ADDR 0x3c200000ULL |
65 |
|
#define C2691_BSWAP_ADDR 0xc0000000ULL |
66 |
#define C2691_PCI_IO_ADDR 0x100000000ULL |
#define C2691_PCI_IO_ADDR 0x100000000ULL |
67 |
|
|
68 |
|
/* WIC interval in address space */ |
69 |
|
#define C2691_WIC_SIZE 0x2000 |
70 |
|
|
71 |
/* Offset of simulated NVRAM in ROM flash */ |
/* Offset of simulated NVRAM in ROM flash */ |
72 |
#define C2691_NVRAM_OFFSET 0xE0000 |
#define C2691_NVRAM_OFFSET 0xE0000 |
73 |
#define C2691_NVRAM_SIZE 0xE000 |
#define C2691_NVRAM_SIZE 0xE000 |
76 |
#define C2691_NVRAM_ROM_RES_SIZE 2048 |
#define C2691_NVRAM_ROM_RES_SIZE 2048 |
77 |
|
|
78 |
/* C2691 ELF Platform ID */ |
/* C2691 ELF Platform ID */ |
79 |
#define C2691_ELF_MACHINE_ID 0xFF /* ??? */ |
#define C2691_ELF_MACHINE_ID 0x66 |
80 |
|
|
81 |
|
#define VM_C2691(vm) ((c2691_t *)vm->hw_data) |
82 |
|
|
83 |
/* C2691 router */ |
/* C2691 router */ |
84 |
typedef struct c2691_router c2691_t; |
typedef struct c2691_router c2691_t; |
85 |
|
|
|
/* Prototype of NM driver initialization function */ |
|
|
typedef int (*c2691_nm_init_fn)(c2691_t *router,char *name,u_int nm_bay); |
|
|
|
|
|
/* Prototype of NM driver shutdown function */ |
|
|
typedef int (*c2691_nm_shutdown_fn)(c2691_t *router,u_int nm_bay); |
|
|
|
|
|
/* Prototype of NM NIO set function */ |
|
|
typedef int (*c2691_nm_set_nio_fn)(c2691_t *router,u_int nm_bay,u_int port_id, |
|
|
netio_desc_t *nio); |
|
|
|
|
|
/* Prototype of NM NIO unset function */ |
|
|
typedef int (*c2691_nm_unset_nio_fn)(c2691_t *router,u_int nm_bay, |
|
|
u_int port_id); |
|
|
|
|
|
/* Prototype of NM NIO show info function */ |
|
|
typedef int (*c2691_nm_show_info_fn)(c2691_t *router,u_int nm_bay); |
|
|
|
|
|
/* C2691 Network Module Driver */ |
|
|
struct c2691_nm_driver { |
|
|
char *dev_type; |
|
|
int supported; |
|
|
int wic_slots; |
|
|
c2691_nm_init_fn nm_init; |
|
|
c2691_nm_shutdown_fn nm_shutdown; |
|
|
c2691_nm_set_nio_fn nm_set_nio; |
|
|
c2691_nm_unset_nio_fn nm_unset_nio; |
|
|
c2691_nm_show_info_fn nm_show_info; |
|
|
|
|
|
/* TODO: WAN Interface Cards (WIC) */ |
|
|
}; |
|
|
|
|
|
/* C2691 NIO binding to a slot/port */ |
|
|
struct c2691_nio_binding { |
|
|
netio_desc_t *nio; |
|
|
u_int port_id; |
|
|
struct c2691_nio_binding *prev,*next; |
|
|
}; |
|
|
|
|
|
/* C2691 NM bay */ |
|
|
struct c2691_nm_bay { |
|
|
char *dev_name; /* Device name */ |
|
|
char *dev_type; /* Device Type */ |
|
|
struct cisco_eeprom eeprom; /* NM EEPROM */ |
|
|
struct pci_bus *pci_map; /* PCI bus */ |
|
|
struct c2691_nm_driver *nm_driver; /* NM Driver */ |
|
|
void *drv_info; /* Private driver info */ |
|
|
struct c2691_nio_binding *nio_list; /* NIO bindings to ports */ |
|
|
}; |
|
|
|
|
86 |
/* C2691 router */ |
/* C2691 router */ |
87 |
struct c2691_router { |
struct c2691_router { |
88 |
/* Chassis MAC address */ |
/* Chassis MAC address */ |
91 |
/* Associated VM instance */ |
/* Associated VM instance */ |
92 |
vm_instance_t *vm; |
vm_instance_t *vm; |
93 |
|
|
94 |
/* IO memory size to be passed to Smart Init */ |
/* GT96100 data */ |
95 |
u_int nm_iomem_size; |
struct gt_data *gt_data; |
96 |
|
|
97 |
/* I/O FPGA */ |
/* I/O FPGA */ |
98 |
struct c2691_iofpga_data *iofpga_data; |
struct c2691_iofpga_data *iofpga_data; |
99 |
|
|
100 |
/* Chassis information */ |
/* Chassis information */ |
|
struct c2691_nm_bay nm_bay[C2691_MAX_NM_BAYS]; |
|
101 |
m_uint8_t oir_status; |
m_uint8_t oir_status; |
102 |
|
|
103 |
/* |
/* |
111 |
struct nmc93cX6_group nm_eeprom_group; |
struct nmc93cX6_group nm_eeprom_group; |
112 |
}; |
}; |
113 |
|
|
114 |
/* Create a new router instance */ |
/* Get WIC device address for the specified onboard port */ |
115 |
c2691_t *c2691_create_instance(char *name,int instance_id); |
int c2691_get_onboard_wic_addr(u_int slot,m_uint64_t *phys_addr); |
|
|
|
|
/* Delete a router instance */ |
|
|
int c2691_delete_instance(char *name); |
|
|
|
|
|
/* Delete all router instances */ |
|
|
int c2691_delete_all_instances(void); |
|
116 |
|
|
117 |
/* Save configuration of a C2691 instance */ |
/* Set EEPROM for the specified slot */ |
118 |
void c2691_save_config(c2691_t *router,FILE *fd); |
int c2691_set_slot_eeprom(c2691_t *router,u_int slot, |
119 |
|
struct cisco_eeprom *eeprom); |
|
/* Save configurations of all C2691 instances */ |
|
|
void c2691_save_config_all(FILE *fd); |
|
120 |
|
|
121 |
/* Get network IRQ for specified slot/port */ |
/* Get network IRQ for specified slot/port */ |
122 |
u_int c2691_net_irq_for_slot_port(u_int slot,u_int port); |
u_int c2691_net_irq_for_slot_port(u_int slot,u_int port); |
123 |
|
|
|
/* Set NM EEPROM definition */ |
|
|
int c2691_nm_set_eeprom(c2691_t *router,u_int nm_bay, |
|
|
const struct cisco_eeprom *eeprom); |
|
|
|
|
|
/* Unset NM EEPROM definition (empty bay) */ |
|
|
int c2691_nm_unset_eeprom(c2691_t *router,u_int nm_bay); |
|
|
|
|
|
/* Check if a bay has a Network Module */ |
|
|
int c2691_nm_check_eeprom(c2691_t *router,u_int nm_bay); |
|
|
|
|
|
/* Get bay info */ |
|
|
struct c2691_nm_bay *c2691_nm_get_info(c2691_t *router,u_int nm_bay); |
|
|
|
|
|
/* Get NM type */ |
|
|
char *c2691_nm_get_type(c2691_t *router,u_int nm_bay); |
|
|
|
|
|
/* Get driver info about the specified slot */ |
|
|
void *c2691_nm_get_drvinfo(c2691_t *router,u_int nm_bay); |
|
|
|
|
|
/* Set driver info for the specified slot */ |
|
|
int c2691_nm_set_drvinfo(c2691_t *router,u_int nm_bay,void *drv_info); |
|
|
|
|
|
/* Add a NM binding */ |
|
|
int c2691_nm_add_binding(c2691_t *router,char *dev_type,u_int nm_bay); |
|
|
|
|
|
/* Remove a NM binding */ |
|
|
int c2691_nm_remove_binding(c2691_t *router,u_int nm_bay); |
|
|
|
|
|
/* Find a NIO binding */ |
|
|
struct c2691_nio_binding * |
|
|
c2691_nm_find_nio_binding(c2691_t *router,u_int nm_bay,u_int port_id); |
|
|
|
|
|
/* Add a network IO binding */ |
|
|
int c2691_nm_add_nio_binding(c2691_t *router,u_int nm_bay,u_int port_id, |
|
|
char *nio_name); |
|
|
|
|
|
/* Remove a NIO binding */ |
|
|
int c2691_nm_remove_nio_binding(c2691_t *router,u_int nm_bay,u_int port_id); |
|
|
|
|
|
/* Remove all NIO bindings for the specified NM */ |
|
|
int c2691_nm_remove_all_nio_bindings(c2691_t *router,u_int nm_bay); |
|
|
|
|
|
/* Enable a Network IO descriptor for a Network Module */ |
|
|
int c2691_nm_enable_nio(c2691_t *router,u_int nm_bay,u_int port_id); |
|
|
|
|
|
/* Disable Network IO descriptor of a Network Module */ |
|
|
int c2691_nm_disable_nio(c2691_t *router,u_int nm_bay,u_int port_id); |
|
|
|
|
|
/* Enable all NIO of the specified NM */ |
|
|
int c2691_nm_enable_all_nio(c2691_t *router,u_int nm_bay); |
|
|
|
|
|
/* Disable all NIO of the specified NM */ |
|
|
int c2691_nm_disable_all_nio(c2691_t *router,u_int nm_bay); |
|
|
|
|
|
/* Initialize a Network Module */ |
|
|
int c2691_nm_init(c2691_t *router,u_int nm_bay); |
|
|
|
|
|
/* Shutdown a Network Module */ |
|
|
int c2691_nm_shutdown(c2691_t *router,u_int nm_bay); |
|
|
|
|
|
/* Shutdown all NM of a router */ |
|
|
int c2691_nm_shutdown_all(c2691_t *router); |
|
|
|
|
|
/* Show info about all NMs */ |
|
|
int c2691_nm_show_all_info(c2691_t *router); |
|
|
|
|
|
/* Create a Network Module (command line) */ |
|
|
int c2691_cmd_nm_create(c2691_t *router,char *str); |
|
|
|
|
|
/* Add a Network IO descriptor binding (command line) */ |
|
|
int c2691_cmd_add_nio(c2691_t *router,char *str); |
|
|
|
|
|
/* Show the list of available NM drivers */ |
|
|
void c2691_nm_show_drivers(void); |
|
|
|
|
124 |
/* Set chassis MAC address */ |
/* Set chassis MAC address */ |
125 |
int c2691_chassis_set_mac_addr(c2691_t *router,char *mac_addr); |
int c2691_chassis_set_mac_addr(c2691_t *router,char *mac_addr); |
126 |
|
|
127 |
/* Show C2691 hardware info */ |
/* Show C2691 hardware info */ |
128 |
void c2691_show_hardware(c2691_t *router); |
void c2691_show_hardware(c2691_t *router); |
129 |
|
|
|
/* Initialize default parameters for a C2691 */ |
|
|
void c2691_init_defaults(c2691_t *router); |
|
|
|
|
|
/* Initialize the C2691 Platform */ |
|
|
int c2691_init_platform(c2691_t *router); |
|
|
|
|
|
/* Initialize a Cisco 2691 instance */ |
|
|
int c2691_init_instance(c2691_t *router); |
|
|
|
|
|
/* Stop a Cisco 2691 instance */ |
|
|
int c2691_stop_instance(c2691_t *router); |
|
|
|
|
130 |
/* Initialize EEPROM groups */ |
/* Initialize EEPROM groups */ |
131 |
void c2691_init_eeprom_groups(c2691_t *router); |
void c2691_init_eeprom_groups(c2691_t *router); |
132 |
|
|
133 |
/* dev_c2691_iofpga_init() */ |
/* dev_c2691_iofpga_init() */ |
134 |
int dev_c2691_iofpga_init(c2691_t *router,m_uint64_t paddr,m_uint32_t len); |
int dev_c2691_iofpga_init(c2691_t *router,m_uint64_t paddr,m_uint32_t len); |
135 |
|
|
136 |
|
/* Register the c2691 platform */ |
137 |
|
int c2691_platform_register(void); |
138 |
|
|
139 |
|
/* Hypervisor C2691 initialization */ |
140 |
|
extern int hypervisor_c2691_init(vm_platform_t *platform); |
141 |
|
|
142 |
/* NM drivers */ |
/* NM drivers */ |
143 |
extern struct c2691_nm_driver dev_c2691_nm_1fe_tx_driver; |
extern struct cisco_card_driver dev_c2691_nm_1fe_tx_driver; |
144 |
extern struct c2691_nm_driver dev_c2691_gt96100_fe_driver; |
extern struct cisco_card_driver dev_c2691_gt96100_fe_driver; |
145 |
extern struct c2691_nm_driver dev_c2691_nm_4t_driver; |
extern struct cisco_card_driver dev_c2691_nm_4t_driver; |
146 |
extern struct c2691_nm_driver dev_c2691_nm_16esw_driver; |
extern struct cisco_card_driver dev_c2691_nm_16esw_driver; |
147 |
|
extern struct cisco_card_driver dev_c2691_nm_nam_driver; |
148 |
|
extern struct cisco_card_driver dev_c2691_nm_cids_driver; |
149 |
|
|
150 |
|
/* WIC drivers */ |
151 |
|
extern struct cisco_card_driver *dev_c2691_mb_wic_drivers[]; |
152 |
|
|
153 |
#endif |
#endif |