/[dynamips]/trunk/dev_c3600.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_c3600.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 11 - (show annotations)
Sat Oct 6 16:33:40 2007 UTC (16 years, 5 months ago) by dpavlin
Original Path: upstream/dynamips-0.2.8-RC1/dev_c3600.h
File MIME type: text/plain
File size: 4651 byte(s)
dynamips-0.2.8-RC1

1 /*
2 * Cisco 3600 simulation platform.
3 * Copyright (c) 2006 Christophe Fillot (cf@utc.fr)
4 *
5 * Generic Cisco 3600 routines and definitions (EEPROM,...).
6 */
7
8 #ifndef __DEV_C3600_H__
9 #define __DEV_C3600_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 C3600 parameters */
22 #define C3600_DEFAULT_CHASSIS "3640"
23 #define C3600_DEFAULT_RAM_SIZE 128
24 #define C3600_DEFAULT_ROM_SIZE 2
25 #define C3600_DEFAULT_NVRAM_SIZE 128
26 #define C3600_DEFAULT_CONF_REG 0x2102
27 #define C3600_DEFAULT_CLOCK_DIV 4
28 #define C3600_DEFAULT_RAM_MMAP 1
29 #define C3600_DEFAULT_DISK0_SIZE 0
30 #define C3600_DEFAULT_DISK1_SIZE 0
31 #define C3600_DEFAULT_IOMEM_SIZE 5 /* Percents! */
32
33 /* 6 NM slots for the 3660 + integrated FastEthernet ports */
34 #define C3600_MAX_NM_BAYS 7
35
36 /* C3600 DUART Interrupt */
37 #define C3600_DUART_IRQ 5
38
39 /* C3600 Network I/O Interrupt */
40 #define C3600_NETIO_IRQ 2
41
42 /* C3600 GT64k DMA/Timer Interrupt */
43 #define C3600_GT64K_IRQ 4
44
45 /* C3600 External Interrupt */
46 #define C3600_EXT_IRQ 6
47
48 /* C3600 NM Management Interrupt handler */
49 #define C3600_NM_MGMT_IRQ 3
50
51 /* Network IRQ */
52 #define C3600_NETIO_IRQ_BASE 32
53 #define C3600_NETIO_IRQ_PORT_BITS 2
54 #define C3600_NETIO_IRQ_PORT_MASK ((1 << C3600_NETIO_IRQ_PORT_BITS) - 1)
55 #define C3600_NETIO_IRQ_PER_SLOT (1 << C3600_NETIO_IRQ_PORT_BITS)
56 #define C3600_NETIO_IRQ_END \
57 (C3600_NETIO_IRQ_BASE + (C3600_MAX_NM_BAYS * C3600_NETIO_IRQ_PER_SLOT) - 1)
58
59 /* C3600 common device addresses */
60 #define C3600_GT64K_ADDR 0x14000000ULL
61 #define C3600_IOFPGA_ADDR 0x1e800000ULL
62 #define C3600_DUART_ADDR 0x1e840000ULL
63 #define C3600_BITBUCKET_ADDR 0x1ec00000ULL
64 #define C3600_NVRAM_ADDR 0x1fe00000ULL
65 #define C3600_ROM_ADDR 0x1fc00000ULL
66 #define C3600_BOOTFLASH_ADDR 0x30000000ULL
67 #define C3600_PCI_IO_ADDR 0x100000000ULL
68
69 /* Reserved space for ROM in NVRAM */
70 #define C3600_NVRAM_ROM_RES_SIZE 2048
71
72 /* C3600 ELF Platform ID */
73 #define C3620_ELF_MACHINE_ID 0x1e
74 #define C3640_ELF_MACHINE_ID 0x1e
75 #define C3660_ELF_MACHINE_ID 0x34
76
77 #define VM_C3600(vm) ((c3600_t *)vm->hw_data)
78
79 /* C3600 router */
80 typedef struct c3600_router c3600_t;
81
82 /* Prototype of chassis driver initialization function */
83 typedef int (*c3600_chassis_init_fn)(c3600_t *router);
84
85 /* C3600 Chassis Driver */
86 struct c3600_chassis_driver {
87 char *chassis_type;
88 int chassis_id;
89 int supported;
90 c3600_chassis_init_fn chassis_init;
91 struct cisco_eeprom *eeprom;
92 };
93
94 /* C3600 router */
95 struct c3600_router {
96 /* Chassis MAC address */
97 n_eth_addr_t mac_addr;
98
99 /* Associated VM instance */
100 vm_instance_t *vm;
101
102 /* I/O FPGA */
103 struct c3600_iofpga_data *iofpga_data;
104
105 /* Chassis information */
106 struct c3600_chassis_driver *chassis_driver;
107 m_uint8_t oir_status;
108
109 /*
110 * Mainboard EEPROM.
111 * It can be modified to change the chassis MAC address.
112 */
113 struct cisco_eeprom mb_eeprom;
114 struct nmc93cX6_group mb_eeprom_group;
115
116 /* Network Module EEPROMs (3620/3640) */
117 struct nmc93cX6_group nm_eeprom_group;
118
119 /* Cisco 3660 NM EEPROMs */
120 struct nmc93cX6_group c3660_nm_eeprom_group[C3600_MAX_NM_BAYS];
121 };
122
123 /* Set EEPROM for the specified slot */
124 int c3600_set_slot_eeprom(c3600_t *router,u_int slot,
125 struct cisco_eeprom *eeprom);
126
127 /* Get network IRQ for specified slot/port */
128 u_int c3600_net_irq_for_slot_port(u_int slot,u_int port);
129
130 /* Show the list of available NM drivers */
131 void c3600_nm_show_drivers(void);
132
133 /* Set chassis MAC address */
134 int c3600_chassis_set_mac_addr(c3600_t *router,char *mac_addr);
135
136 /* Set the chassis type */
137 int c3600_chassis_set_type(c3600_t *router,char *chassis_type);
138
139 /* Get the chassis ID */
140 int c3600_chassis_get_id(c3600_t *router);
141
142 /* Show C3600 hardware info */
143 void c3600_show_hardware(c3600_t *router);
144
145 /* Initialize EEPROM groups */
146 void c3600_init_eeprom_groups(c3600_t *router);
147
148 /* dev_c3600_iofpga_init() */
149 int dev_c3600_iofpga_init(c3600_t *router,m_uint64_t paddr,m_uint32_t len);
150
151 /* Register the c3600 platform */
152 int c3600_platform_register(void);
153
154 /* Hypervisor C3600 initialization */
155 extern int hypervisor_c3600_init(vm_platform_t *platform);
156
157 /* NM drivers */
158 extern struct cisco_card_driver dev_c3600_nm_1e_driver;
159 extern struct cisco_card_driver dev_c3600_nm_4e_driver;
160 extern struct cisco_card_driver dev_c3600_nm_1fe_tx_driver;
161 extern struct cisco_card_driver dev_c3600_nm_4t_driver;
162 extern struct cisco_card_driver dev_c3600_leopard_2fe_driver;
163 extern struct cisco_card_driver dev_c3600_nm_16esw_driver;
164
165 #endif

  ViewVC Help
Powered by ViewVC 1.1.26