/[dynamips]/trunk/dev_c1700.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_c1700.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 13 - (show annotations)
Fri Oct 12 09:40:41 2007 UTC (11 years, 10 months ago) by dpavlin
File MIME type: text/plain
File size: 3895 byte(s)
boot linux kernel from DSM G600
1 /*
2 * Cisco router simulation platform.
3 * Copyright (c) 2006 Christophe Fillot (cf@utc.fr)
4 *
5 * Generic Cisco 1700 routines and definitions (EEPROM,...).
6 */
7
8 #ifndef __DEV_C1700_H__
9 #define __DEV_C1700_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 "dev_mpc860.h"
20 #include "vm.h"
21
22 /* Default C1700 parameters */
23 #define C1700_DEFAULT_MAINBOARD "1720"
24 #define C1700_DEFAULT_RAM_SIZE 32
25 #define C1700_DEFAULT_ROM_SIZE 2
26 #define C1700_DEFAULT_NVRAM_SIZE 32
27 #define C1700_DEFAULT_CONF_REG 0x2102
28 #define C1700_DEFAULT_CLOCK_DIV 8
29 #define C1700_DEFAULT_RAM_MMAP 1
30 #define C1700_DEFAULT_DISK0_SIZE 0
31 #define C1700_DEFAULT_DISK1_SIZE 0
32 #define C1700_DEFAULT_IOMEM_SIZE 15 /* Percents! */
33
34 /* 1700 characteristics: only mainboard (considered as fake NM) */
35 #define C1700_MAX_NM_BAYS 1
36
37 /* C1700 Virtual Timer Interrupt */
38 #define C1700_VTIMER_IRQ 0
39
40 /* C1700 DUART Interrupt */
41 #define C1700_DUART_IRQ 1
42
43 /* C1700 Network I/O Interrupt */
44 #define C1700_NETIO_IRQ 2
45
46 /* C1700 PA Management Interrupt */
47 #define C1700_PA_MGMT_IRQ 3
48
49 /* Network IRQ */
50 #define C1700_NETIO_IRQ_BASE 32
51 #define C1700_NETIO_IRQ_PORT_BITS 2
52 #define C1700_NETIO_IRQ_PORT_MASK ((1 << C1700_NETIO_IRQ_PORT_BITS) - 1)
53 #define C1700_NETIO_IRQ_PER_SLOT (1 << C1700_NETIO_IRQ_PORT_BITS)
54 #define C1700_NETIO_IRQ_END \
55 (C1700_NETIO_IRQ_BASE + (C1700_MAX_NM_BAYS * C1700_NETIO_IRQ_PER_SLOT) - 1)
56
57 /* C1700 common device addresses */
58 #define C1700_FLASH_ADDR 0xffc00000ULL
59 #define C1700_NVRAM_ADDR 0xff000000ULL
60 #define C1700_IOFPGA_ADDR 0xf0000000ULL
61 #define C1700_WIC_ADDR 0xfc040000ULL
62 #define C1700_DUART_ADDR 0xfc004500ULL
63 #define C1700_MPC860_ADDR 0xff000000ULL
64 #define C1700_ROM_ADDR 0xfff00000ULL
65
66 /* WIC interval in address space */
67 #define C1700_WIC_SIZE 0x1000
68
69 /* Reserved space for ROM in NVRAM */
70 #define C1700_NVRAM_ROM_RES_SIZE 2048
71
72 /* C1700 ELF Platform ID */
73 #define C1700_ELF_MACHINE_ID 0x33
74
75 #define VM_C1700(vm) ((c1700_t *)vm->hw_data)
76
77 /* C1700 router */
78 typedef struct c1700_router c1700_t;
79
80 /* C1700 router */
81 struct c1700_router {
82 /* Mainboard type (2610, 2611, etc) */
83 char *mainboard_type;
84
85 /* Chassis MAC address */
86 n_eth_addr_t mac_addr;
87
88 /* Associated VM instance */
89 vm_instance_t *vm;
90
91 /* I/O FPGA */
92 struct c1700_iofpga_data *iofpga_data;
93
94 /*
95 * Mainboard EEPROM.
96 * It can be modified to change the chassis MAC address.
97 */
98 struct cisco_eeprom mb_eeprom;
99 struct nmc93cX6_group mb_eeprom_group;
100
101 /* Network Module EEPROM */
102 struct nmc93cX6_group nm_eeprom_group;
103
104 /* MPC860 device private data */
105 struct mpc860_data *mpc_data;
106 };
107
108 /* Set EEPROM for the specified slot */
109 int c1700_set_slot_eeprom(c1700_t *router,u_int slot,
110 struct cisco_eeprom *eeprom);
111
112 /* Get network IRQ for specified slot/port */
113 u_int c1700_net_irq_for_slot_port(u_int slot,u_int port);
114
115 /* Set mainboard type */
116 int c1700_mainboard_set_type(c1700_t *router,char *mainboard_type);
117
118 /* Set chassis MAC address */
119 int c1700_chassis_set_mac_addr(c1700_t *router,char *mac_addr);
120
121 /* Show C1700 hardware info */
122 void c1700_show_hardware(c1700_t *router);
123
124 /* Initialize EEPROM groups */
125 void c1700_init_eeprom_groups(c1700_t *router);
126
127 /* dev_c1700_iofpga_init() */
128 int dev_c1700_iofpga_init(c1700_t *router,m_uint64_t paddr,m_uint32_t len);
129
130 /* Register the c1700 platform */
131 int c1700_platform_register(void);
132
133 /* Hypervisor C1700 initialization */
134 extern int hypervisor_c1700_init(vm_platform_t *platform);
135
136 /* c1700 Motherboard drivers */
137 extern struct cisco_card_driver dev_c1700_mb_eth_driver;
138 extern struct cisco_card_driver dev_c1710_mb_eth_driver;
139
140 /* WIC drivers */
141 extern struct cisco_card_driver *dev_c1700_mb_wic_drivers[];
142
143 #endif

  ViewVC Help
Powered by ViewVC 1.1.26