/[dynamips]/trunk/dev_c2691.h
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/dev_c2691.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 12 - (show annotations)
Sat Oct 6 16:45:40 2007 UTC (11 years, 11 months ago) by dpavlin
File MIME type: text/plain
File size: 4308 byte(s)
make working copy

1 /*
2 * Cisco 2691 simulation platform.
3 * Copyright (c) 2006 Christophe Fillot (cf@utc.fr)
4 *
5 * Generic Cisco 2691 routines and definitions (EEPROM,...).
6 */
7
8 #ifndef __DEV_C2691_H__
9 #define __DEV_C2691_H__
10
11 #include <pthread.h>
12
13 #include "utils.h"
14 #include "net.h"
15 #include "device.h"
16 #include "pci_dev.h"
17 #include "nmc93cX6.h"
18 #include "net_io.h"
19 #include "vm.h"
20
21 /* Default C2691 parameters */
22 #define C2691_DEFAULT_RAM_SIZE 128
23 #define C2691_DEFAULT_ROM_SIZE 2
24 #define C2691_DEFAULT_NVRAM_SIZE 128
25 #define C2691_DEFAULT_CONF_REG 0x2102
26 #define C2691_DEFAULT_CLOCK_DIV 8
27 #define C2691_DEFAULT_RAM_MMAP 1
28 #define C2691_DEFAULT_DISK0_SIZE 16
29 #define C2691_DEFAULT_DISK1_SIZE 0
30 #define C2691_DEFAULT_IOMEM_SIZE 5 /* Percents! */
31
32 /* 2691 characteritics: 1 NM, 3 WIC, 2 AIM */
33 #define C2691_MAX_NM_BAYS 2
34 #define C2691_MAX_WIC_BAYS 3
35
36 /* C2691 DUART Interrupt */
37 #define C2691_DUART_IRQ 5
38
39 /* C2691 Network I/O Interrupt */
40 #define C2691_NETIO_IRQ 2
41
42 /* C2691 GT64k DMA/Timer Interrupt */
43 #define C2691_GT96K_IRQ 3
44
45 /* C2691 External Interrupt */
46 #define C2691_EXT_IRQ 6
47
48 /* Network IRQ */
49 #define C2691_NETIO_IRQ_BASE 32
50 #define C2691_NETIO_IRQ_PORT_BITS 3
51 #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)
53 #define C2691_NETIO_IRQ_END \
54 (C2691_NETIO_IRQ_BASE + (C2691_MAX_NM_BAYS * C2691_NETIO_IRQ_PER_SLOT) - 1)
55
56 /* C2691 common device addresses */
57 #define C2691_GT96K_ADDR 0x14000000ULL
58 #define C2691_IOFPGA_ADDR 0x1e800000ULL
59 #define C2691_BITBUCKET_ADDR 0x1ec00000ULL
60 #define C2691_ROM_ADDR 0x1fc00000ULL
61 #define C2691_SLOT0_ADDR 0x30000000ULL
62 #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
67
68 /* WIC interval in address space */
69 #define C2691_WIC_SIZE 0x2000
70
71 /* Offset of simulated NVRAM in ROM flash */
72 #define C2691_NVRAM_OFFSET 0xE0000
73 #define C2691_NVRAM_SIZE 0xE000
74
75 /* Reserved space for ROM in NVRAM */
76 #define C2691_NVRAM_ROM_RES_SIZE 2048
77
78 /* C2691 ELF Platform ID */
79 #define C2691_ELF_MACHINE_ID 0x66
80
81 #define VM_C2691(vm) ((c2691_t *)vm->hw_data)
82
83 /* C2691 router */
84 typedef struct c2691_router c2691_t;
85
86 /* C2691 router */
87 struct c2691_router {
88 /* Chassis MAC address */
89 n_eth_addr_t mac_addr;
90
91 /* Associated VM instance */
92 vm_instance_t *vm;
93
94 /* GT96100 data */
95 struct gt_data *gt_data;
96
97 /* I/O FPGA */
98 struct c2691_iofpga_data *iofpga_data;
99
100 /* Chassis information */
101 m_uint8_t oir_status;
102
103 /*
104 * Mainboard EEPROM.
105 * It can be modified to change the chassis MAC address.
106 */
107 struct cisco_eeprom mb_eeprom;
108 struct nmc93cX6_group mb_eeprom_group;
109
110 /* Network Module EEPROM */
111 struct nmc93cX6_group nm_eeprom_group;
112 };
113
114 /* Get WIC device address for the specified onboard port */
115 int c2691_get_onboard_wic_addr(u_int slot,m_uint64_t *phys_addr);
116
117 /* Set EEPROM for the specified slot */
118 int c2691_set_slot_eeprom(c2691_t *router,u_int slot,
119 struct cisco_eeprom *eeprom);
120
121 /* Get network IRQ for specified slot/port */
122 u_int c2691_net_irq_for_slot_port(u_int slot,u_int port);
123
124 /* Set chassis MAC address */
125 int c2691_chassis_set_mac_addr(c2691_t *router,char *mac_addr);
126
127 /* Show C2691 hardware info */
128 void c2691_show_hardware(c2691_t *router);
129
130 /* Initialize EEPROM groups */
131 void c2691_init_eeprom_groups(c2691_t *router);
132
133 /* dev_c2691_iofpga_init() */
134 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 */
143 extern struct cisco_card_driver dev_c2691_nm_1fe_tx_driver;
144 extern struct cisco_card_driver dev_c2691_gt96100_fe_driver;
145 extern struct cisco_card_driver dev_c2691_nm_4t_driver;
146 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

  ViewVC Help
Powered by ViewVC 1.1.26