File: dev_c6msfc1.h

package info (click to toggle)
dynamips 0.2.7-0.2.8RC2-4
  • links: PTS, VCS
  • area: non-free
  • in suites: squeeze
  • size: 3,856 kB
  • ctags: 9,893
  • sloc: ansic: 69,846; makefile: 238; sh: 169; perl: 20
file content (134 lines) | stat: -rw-r--r-- 3,612 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/*
 * Cisco router simulation platform.
 * Copyright (c) 2005,2006 Christophe Fillot (cf@utc.fr)
 *
 * Generic Cisco MSFC1 routines and definitions (EEPROM,...).
 */

#ifndef __DEV_C6MSFC1_H__
#define __DEV_C6MSFC1_H__

#include <pthread.h>

#include "utils.h"
#include "net.h"
#include "device.h"
#include "pci_dev.h"
#include "nmc93cX6.h"
#include "net_io.h"
#include "vm.h"

/* Default MSFC1 parameters */
#define C6MSFC1_DEFAULT_RAM_SIZE     256
#define C6MSFC1_DEFAULT_ROM_SIZE     4
#define C6MSFC1_DEFAULT_NVRAM_SIZE   128
#define C6MSFC1_DEFAULT_CONF_REG     0x2102
#define C6MSFC1_DEFAULT_CLOCK_DIV    4
#define C6MSFC1_DEFAULT_RAM_MMAP     1

/* EOBC + IBC */
#define C6MSFC1_MAX_PA_BAYS  2

/* MSFC1 Timer IRQ (virtual) */
#define C6MSFC1_VTIMER_IRQ 0

/* MSFC1 DUART Interrupt */
#define C6MSFC1_DUART_IRQ  5

/* MSFC1 Network I/O Interrupt */
#define C6MSFC1_NETIO_IRQ  2

/* MSFC1 PA Management Interrupt handler */
#define C6MSFC1_PA_MGMT_IRQ  3

/* MSFC1 GT64k DMA/Timer Interrupt */
#define C6MSFC1_GT64K_IRQ  4

/* MSFC1 Error/OIR Interrupt */
#define C6MSFC1_OIR_IRQ    6

/* Network IRQ */
#define C6MSFC1_NETIO_IRQ_BASE       32
#define C6MSFC1_NETIO_IRQ_END        \
   (C6MSFC1_NETIO_IRQ_BASE + C6MSFC1_MAX_PA_BAYS - 1)

/* MSFC1 base ram limit (256 Mb) */
#define C6MSFC1_BASE_RAM_LIMIT  256

/* MSFC1 common device addresses */
#define C6MSFC1_GT64K_ADDR         0x14000000ULL
#define C6MSFC1_GT64K_SEC_ADDR     0x15000000ULL
#define C6MSFC1_BOOTFLASH_ADDR     0x1a000000ULL
#define C6MSFC1_NVRAM_ADDR         0x1e000000ULL
#define C6MSFC1_MPFPGA_ADDR        0x1e800000ULL
#define C6MSFC1_IOFPGA_ADDR        0x1e840000ULL
#define C6MSFC1_BITBUCKET_ADDR     0x1f000000ULL
#define C6MSFC1_ROM_ADDR           0x1fc00000ULL
#define C6MSFC1_IOMEM_ADDR         0x20000000ULL
#define C6MSFC1_SRAM_ADDR          0x4b000000ULL
#define C6MSFC1_BSWAP_ADDR         0xc0000000ULL
#define C6MSFC1_PCI_IO_ADDR        0x100000000ULL

/* SRAM size */
#define C6MSFC1_SRAM_SIZE  (4096*1024)

/* Reserved space for ROM in NVRAM */
#define C6MSFC1_NVRAM_ROM_RES_SIZE  2048

/* MSFC1 physical address bus mask: keep only the lower 33 bits */
#define C6MSFC1_ADDR_BUS_MASK   0x1ffffffffULL

/* MSFC1 ELF Platform ID */
#define C6MSFC1_ELF_MACHINE_ID  0x19

#define VM_C6MSFC1(vm) ((c6msfc1_t *)vm->hw_data)

/* MSFC1 router */
typedef struct c6msfc1_router c6msfc1_t;

/* MSFC1 router */
struct c6msfc1_router {
   /* Chassis MAC address */
   n_eth_addr_t mac_addr;

   /* Associated VM instance */
   vm_instance_t *vm;

   /* Midplane FPGA */
   struct c6msfc1_mpfpga_data *mpfpga_data;
   
   /* Midplane EEPROM can be modified to change the chassis MAC address... */
   struct cisco_eeprom cpu_eeprom,mp_eeprom,pem_eeprom;

   /* EEPROMs for CPU and Midplane */
   struct nmc93cX6_group sys_eeprom_g1;

   /* Slot of this MSFC */
   u_int msfc_slot;
};

/* Initialize EEPROM groups */
void c6msfc1_init_eeprom_groups(c6msfc1_t *router);

/* Get network IRQ for specified slot/port */
u_int c6msfc1_net_irq_for_slot_port(u_int slot,u_int port);

/* Show the list of available PA drivers */
void c6msfc1_pa_show_drivers(void);

/* Set chassis MAC address */
int c6msfc1_midplane_set_mac_addr(c6msfc1_t *router,char *mac_addr);

/* Show MSFC1 hardware info */
void c6msfc1_show_hardware(c6msfc1_t *router);

/* dev_c6msfc1_iofpga_init() */
int dev_c6msfc1_iofpga_init(c6msfc1_t *router,m_uint64_t paddr,m_uint32_t len);

/* dev_mpfpga_init() */
int dev_c6msfc1_mpfpga_init(c6msfc1_t *router,m_uint64_t paddr,m_uint32_t len);

/* Register the c6msfc1 platform */
int c6msfc1_platform_register(void);

#endif