/[dynamips]/trunk/dev_c7200.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

Diff of /trunk/dev_c7200.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

upstream/dynamips-0.2.6-RC2/dev_c7200.h revision 3 by dpavlin, Sat Oct 6 16:05:34 2007 UTC upstream/dynamips-0.2.8-RC1/dev_c7200.h revision 11 by dpavlin, Sat Oct 6 16:33:40 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   * Cisco 7200 (Predator) simulation platform.   * Cisco router simulation platform.
3   * Copyright (c) 2005,2006 Christophe Fillot (cf@utc.fr)   * Copyright (c) 2005,2006 Christophe Fillot (cf@utc.fr)
4   *   *
5   * Generic Cisco 7200 routines and definitions (EEPROM,...).   * Generic Cisco 7200 routines and definitions (EEPROM,...).
# Line 28  Line 28 
28  #include "net.h"  #include "net.h"
29  #include "device.h"  #include "device.h"
30  #include "pci_dev.h"  #include "pci_dev.h"
31  #include "nmc93c46.h"  #include "nmc93cX6.h"
32    #include "dev_mv64460.h"
33  #include "net_io.h"  #include "net_io.h"
34  #include "vm.h"  #include "vm.h"
35    
# Line 47  Line 48 
48  /* 6 slots + 1 I/O card */  /* 6 slots + 1 I/O card */
49  #define C7200_MAX_PA_BAYS  7  #define C7200_MAX_PA_BAYS  7
50    
51    /* C7200 Timer IRQ (virtual) */
52    #define C7200_VTIMER_IRQ 0
53    
54  /* C7200 DUART Interrupt */  /* C7200 DUART Interrupt */
55  #define C7200_DUART_IRQ  5  #define C7200_DUART_IRQ  5
56    
# Line 62  Line 66 
66  /* C7200 Error/OIR Interrupt */  /* C7200 Error/OIR Interrupt */
67  #define C7200_OIR_IRQ    6  #define C7200_OIR_IRQ    6
68    
69    /* Network IRQ */
70    #define C7200_NETIO_IRQ_BASE       32
71    #define C7200_NETIO_IRQ_PORT_BITS  3
72    #define C7200_NETIO_IRQ_PORT_MASK  ((1 << C7200_NETIO_IRQ_PORT_BITS) - 1)
73    #define C7200_NETIO_IRQ_PER_SLOT   (1 << C7200_NETIO_IRQ_PORT_BITS)
74    #define C7200_NETIO_IRQ_END        \
75        (C7200_NETIO_IRQ_BASE + (C7200_MAX_PA_BAYS * C7200_NETIO_IRQ_PER_SLOT) - 1)
76    
77  /* C7200 base ram limit (256 Mb) */  /* C7200 base ram limit (256 Mb) */
78  #define C7200_BASE_RAM_LIMIT  256  #define C7200_BASE_RAM_LIMIT  256
79    
80  /* C7200 common device addresses */  /* C7200 common device addresses */
81  #define C7200_GT64K_ADDR        0x14000000ULL  #define C7200_GT64K_ADDR         0x14000000ULL
82  #define C7200_GT64K_SEC_ADDR    0x15000000ULL  #define C7200_GT64K_SEC_ADDR     0x15000000ULL
83  #define C7200_BOOTFLASH_ADDR    0x1a000000ULL  #define C7200_BOOTFLASH_ADDR     0x1a000000ULL
84  #define C7200_NVRAM_ADDR        0x1e000000ULL  #define C7200_NVRAM_ADDR         0x1e000000ULL
85  #define C7200_NPEG1_NVRAM_ADDR  0x1e400000ULL  #define C7200_MPFPGA_ADDR        0x1e800000ULL
86  #define C7200_MPFPGA_ADDR       0x1e800000ULL  #define C7200_IOFPGA_ADDR        0x1e840000ULL
87  #define C7200_IOFPGA_ADDR       0x1e840000ULL  #define C7200_BITBUCKET_ADDR     0x1f000000ULL
88  #define C7200_BITBUCKET_ADDR    0x1f000000ULL  #define C7200_ROM_ADDR           0x1fc00000ULL
89  #define C7200_ROM_ADDR          0x1fc00000ULL  #define C7200_IOMEM_ADDR         0x20000000ULL
90  #define C7200_IOMEM_ADDR        0x20000000ULL  #define C7200_SRAM_ADDR          0x4b000000ULL
91  #define C7200_SRAM_ADDR         0x4b000000ULL  #define C7200_BSWAP_ADDR         0xc0000000ULL
92  #define C7200_PCI_IO_ADDR       0x100000000ULL  #define C7200_PCI_IO_ADDR        0x100000000ULL
93    
94    /* NPE-G1 specific info */
95    #define C7200_G1_NVRAM_ADDR      0x1e400000ULL
96    
97    /* NPE-G2 specific info */
98    #define C7200_G2_BSWAP_ADDR      0xc0000000ULL
99    #define C7200_G2_BOOTFLASH_ADDR  0xe8000000ULL
100    #define C7200_G2_PCI_IO_ADDR     0xf0000000ULL
101    #define C7200_G2_MV64460_ADDR    0xf1000000ULL
102    #define C7200_G2_MPFPGA_ADDR     0xfe000000ULL
103    #define C7200_G2_IOFPGA_ADDR     0xfe040000ULL
104    #define C7200_G2_NVRAM_ADDR      0xff000000ULL
105    #define C7200_G2_ROM_ADDR        0xfff00000ULL
106    
107    /* NVRAM size for NPE-G2: 2 Mb */
108    #define C7200_G2_NVRAM_SIZE      (2 * 1048576)
109    
110  /* Reserved space for ROM in NVRAM */  /* Reserved space for ROM in NVRAM */
111  #define C7200_NVRAM_ROM_RES_SIZE  2048  #define C7200_NVRAM_ROM_RES_SIZE  2048
# Line 88  Line 116 
116  /* C7200 ELF Platform ID */  /* C7200 ELF Platform ID */
117  #define C7200_ELF_MACHINE_ID  0x19  #define C7200_ELF_MACHINE_ID  0x19
118    
119    /* NPE families */
120    enum {
121       C7200_NPE_FAMILY_MIPS = 0,
122       C7200_NPE_FAMILY_PPC,
123    };
124    
125    #define VM_C7200(vm) ((c7200_t *)vm->hw_data)
126    
127  /* C7200 router */  /* C7200 router */
128  typedef struct c7200_router c7200_t;  typedef struct c7200_router c7200_t;
129    
130  /* Prototype of NPE driver initialization function */  /* Prototype of NPE driver initialization function */
131  typedef int (*c7200_npe_init_fn)(c7200_t *router);  typedef int (*c7200_npe_init_fn)(c7200_t *router);
132    
 /* Prototype of PA driver initialization function */  
 typedef int (*c7200_pa_init_fn)(c7200_t *router,char *name,u_int pa_bay);  
   
 /* Prototype of PA driver shutdown function */  
 typedef int (*c7200_pa_shutdown_fn)(c7200_t *router,u_int pa_bay);  
   
 /* Prototype of PA NIO set function */  
 typedef int (*c7200_pa_set_nio_fn)(c7200_t *router,u_int pa_bay,u_int port_id,  
                                    netio_desc_t *nio);  
   
 /* Prototype of PA NIO unset function */  
 typedef int (*c7200_pa_unset_nio_fn)(c7200_t *router,u_int pa_bay,  
                                      u_int port_id);  
   
 /* Prototype of NM NIO show info function */  
 typedef int (*c7200_pa_show_info_fn)(c7200_t *router,u_int pa_bay);  
   
 /* C7200 Port Adapter Driver */  
 struct c7200_pa_driver {  
    char *dev_type;  
    int supported;  
    c7200_pa_init_fn pa_init;  
    c7200_pa_shutdown_fn pa_shutdown;  
    c7200_pa_set_nio_fn pa_set_nio;  
    c7200_pa_unset_nio_fn pa_unset_nio;  
    c7200_pa_show_info_fn pa_show_info;  
 };  
   
 /* C7200 NIO binding to a slot/port */  
 struct c7200_nio_binding {  
    netio_desc_t *nio;  
    u_int port_id;  
    struct c7200_nio_binding *prev,*next;  
 };  
   
 /* C7200 PA bay */  
 struct c7200_pa_bay {  
    char *dev_name;                       /* Device Name */  
    char *dev_type;                       /* Device Type */  
    struct cisco_eeprom eeprom;           /* PA EEPROM */  
    struct pci_bus *pci_map;              /* PCI bus */  
    struct c7200_pa_driver *pa_driver;    /* PA driver */  
    void *drv_info;                       /* Private driver info */  
    struct c7200_nio_binding *nio_list;   /* NIO bindings to ports */  
 };  
   
133  /* C7200 NPE Driver */  /* C7200 NPE Driver */
134  struct c7200_npe_driver {  struct c7200_npe_driver {
135     char *npe_type;     char *npe_type;
136       int npe_family;
137     c7200_npe_init_fn npe_init;     c7200_npe_init_fn npe_init;
138     int max_ram_size;     int max_ram_size;
139     int supported;     int supported;
140     m_uint64_t nvram_addr;     m_uint64_t nvram_addr;
141       int iocard_required;
142     int clpd6729_pci_bus;     int clpd6729_pci_bus;
143     int clpd6729_pci_dev;     int clpd6729_pci_dev;
144     int dec21140_pci_bus;     int dec21140_pci_bus;
# Line 163  struct c7200_router { Line 155  struct c7200_router {
155     /* Associated VM instance */     /* Associated VM instance */
156     vm_instance_t *vm;     vm_instance_t *vm;
157    
158     /* NPE and PA information */     /* MV64460 device for NPE-G2 */
159       struct mv64460_data *mv64460_sysctr;
160    
161       /* Midplane FPGA */
162       struct c7200_mpfpga_data *mpfpga_data;
163    
164       /* NPE and OIR status */
165     struct c7200_npe_driver *npe_driver;     struct c7200_npe_driver *npe_driver;
    struct c7200_pa_bay pa_bay[C7200_MAX_PA_BAYS];  
166     m_uint8_t oir_status;     m_uint8_t oir_status;
167    
168     /* Hidden I/O bridge hack to support PCMCIA */     /* Hidden I/O bridge hack to support PCMCIA */
# Line 175  struct c7200_router { Line 172  struct c7200_router {
172     /* Midplane EEPROM can be modified to change the chassis MAC address... */     /* Midplane EEPROM can be modified to change the chassis MAC address... */
173     struct cisco_eeprom cpu_eeprom,mp_eeprom,pem_eeprom;     struct cisco_eeprom cpu_eeprom,mp_eeprom,pem_eeprom;
174    
175     struct nmc93c46_group sys_eeprom_g1;    /* EEPROMs for CPU and Midplane */     struct nmc93cX6_group sys_eeprom_g1;    /* EEPROMs for CPU and Midplane */
176     struct nmc93c46_group sys_eeprom_g2;    /* EEPROM for PEM */     struct nmc93cX6_group sys_eeprom_g2;    /* EEPROM for PEM */
177     struct nmc93c46_group pa_eeprom_g1;     /* EEPROMs for bays 0, 1, 3, 4 */     struct nmc93cX6_group pa_eeprom_g1;     /* EEPROMs for bays 0, 1, 3, 4 */
178     struct nmc93c46_group pa_eeprom_g2;     /* EEPROMs for bays 2, 5, 6 */     struct nmc93cX6_group pa_eeprom_g2;     /* EEPROMs for bays 2, 5, 6 */
179  };  };
180    
181  /* Initialize EEPROM groups */  /* Initialize system EEPROM groups */
182  void c7200_init_eeprom_groups(c7200_t *router);  void c7200_init_sys_eeprom_groups(c7200_t *router);
   
 /* Create a new router instance */  
 c7200_t *c7200_create_instance(char *name,int instance_id);  
   
 /* Delete a router instance */  
 int c7200_delete_instance(char *name);  
   
 /* Delete all router instances */  
 int c7200_delete_all_instances(void);  
   
 /* Save configuration of a C7200 instance */  
 void c7200_save_config(c7200_t *router,FILE *fd);  
   
 /* Save configurations of all C7200 instances */  
 void c7200_save_config_all(FILE *fd);  
   
 /* Set PA EEPROM definition */  
 int c7200_pa_set_eeprom(c7200_t *router,u_int pa_bay,  
                         const struct cisco_eeprom *eeprom);  
   
 /* Unset PA EEPROM definition (empty bay) */  
 int c7200_pa_unset_eeprom(c7200_t *router,u_int pa_bay);  
   
 /* Check if a bay has a port adapter */  
 int c7200_pa_check_eeprom(c7200_t *router,u_int pa_bay);  
183    
184  /* Get bay info */  /* Initialize midplane EEPROM groups */
185  struct c7200_pa_bay *c7200_pa_get_info(c7200_t *router,u_int pa_bay);  void c7200_init_mp_eeprom_groups(c7200_t *router);
186    
187  /* Get PA type */  /* Set EEPROM for the specified slot */
188  char *c7200_pa_get_type(c7200_t *router,u_int pa_bay);  int c7200_set_slot_eeprom(c7200_t *router,u_int slot,
189                              struct cisco_eeprom *eeprom);
190    
191  /* Get driver info about the specified slot */  /* Get network IRQ for specified slot/port */
192  void *c7200_pa_get_drvinfo(c7200_t *router,u_int pa_bay);  u_int c7200_net_irq_for_slot_port(u_int slot,u_int port);
   
 /* Set driver info for the specified slot */  
 int c7200_pa_set_drvinfo(c7200_t *router,u_int pa_bay,void *drv_info);  
   
 /* Add a PA binding */  
 int c7200_pa_add_binding(c7200_t *router,char *dev_type,u_int pa_bay);  
   
 /* Remove a PA binding */  
 int c7200_pa_remove_binding(c7200_t *router,u_int pa_bay);  
   
 /* Find a NIO binding */  
 struct c7200_nio_binding *  
 c7200_pa_find_nio_binding(c7200_t *router,u_int pa_bay,u_int port_id);  
   
 /* Add a network IO binding */  
 int c7200_pa_add_nio_binding(c7200_t *router,u_int pa_bay,u_int port_id,  
                              char *nio_name);  
   
 /* Remove a NIO binding */  
 int c7200_pa_remove_nio_binding(c7200_t *router,u_int pa_bay,u_int port_id);  
   
 /* Remove all NIO bindings for the specified PA */  
 int c7200_pa_remove_all_nio_bindings(c7200_t *router,u_int pa_bay);  
   
 /* Enable a Network IO descriptor for a Port Adapter */  
 int c7200_pa_enable_nio(c7200_t *router,u_int pa_bay,u_int port_id);  
   
 /* Disable Network IO descriptor of a Port Adapter */  
 int c7200_pa_disable_nio(c7200_t *router,u_int pa_bay,u_int port_id);  
   
 /* Enable all NIO of the specified PA */  
 int c7200_pa_enable_all_nio(c7200_t *router,u_int pa_bay);  
   
 /* Disable all NIO of the specified PA */  
 int c7200_pa_disable_all_nio(c7200_t *router,u_int pa_bay);  
   
 /* Initialize a Port Adapter */  
 int c7200_pa_init(c7200_t *router,u_int pa_bay);  
   
 /* Shutdown a Port Adapter */  
 int c7200_pa_shutdown(c7200_t *router,u_int pa_bay);  
   
 /* Shutdown all PA of a router */  
 int c7200_pa_shutdown_all(c7200_t *router);  
   
 /* Show info about all NMs */  
 int c7200_pa_show_all_info(c7200_t *router);  
   
 /* Create a Port Adapter (command line) */  
 int c7200_cmd_pa_create(c7200_t *router,char *str);  
   
 /* Add a Network IO descriptor binding (command line) */  
 int c7200_cmd_add_nio(c7200_t *router,char *str);  
193    
194  /* Show the list of available PA drivers */  /* Show the list of available PA drivers */
195  void c7200_pa_show_drivers(void);  void c7200_pa_show_drivers(void);
# Line 280  struct c7200_npe_driver *c7200_npe_get_d Line 200  struct c7200_npe_driver *c7200_npe_get_d
200  /* Set the NPE type */  /* Set the NPE type */
201  int c7200_npe_set_type(c7200_t *router,char *npe_type);  int c7200_npe_set_type(c7200_t *router,char *npe_type);
202    
 /* Show the list of available NPE drivers */  
 void c7200_npe_show_drivers(void);  
   
203  /* Set Midplane type */  /* Set Midplane type */
204  int c7200_midplane_set_type(c7200_t *router,char *midplane_type);  int c7200_midplane_set_type(c7200_t *router,char *midplane_type);
205    
# Line 292  int c7200_midplane_set_mac_addr(c7200_t Line 209  int c7200_midplane_set_mac_addr(c7200_t
209  /* Show C7200 hardware info */  /* Show C7200 hardware info */
210  void c7200_show_hardware(c7200_t *router);  void c7200_show_hardware(c7200_t *router);
211    
 /* Initialize default parameters for a C7200 */  
 void c7200_init_defaults(c7200_t *router);  
   
 /* Initialize the C7200 Platform */  
 int c7200_init_platform(c7200_t *router);  
   
 /* Boot the IOS image */  
 int c7200_boot_ios(c7200_t *router);  
   
 /* Initialize a Cisco 7200 instance */  
 int c7200_init_instance(c7200_t *router);  
   
 /* Stop a Cisco 7200 instance */  
 int c7200_stop_instance(c7200_t *router);  
   
212  /* Trigger an OIR event */  /* Trigger an OIR event */
213  int c7200_trigger_oir_event(c7200_t *router,u_int slot_mask);  int c7200_trigger_oir_event(c7200_t *router,u_int slot_mask);
214    
# Line 319  int c7200_pa_stop_online(c7200_t *router Line 221  int c7200_pa_stop_online(c7200_t *router
221  /* dev_c7200_iofpga_init() */  /* dev_c7200_iofpga_init() */
222  int dev_c7200_iofpga_init(c7200_t *router,m_uint64_t paddr,m_uint32_t len);  int dev_c7200_iofpga_init(c7200_t *router,m_uint64_t paddr,m_uint32_t len);
223    
224  /* dev_mpfpga_init() */  /* Register the c7200 platform */
225  int dev_c7200_mpfpga_init(c7200_t *router,m_uint64_t paddr,m_uint32_t len);  int c7200_platform_register(void);
226    
227    /* Hypervisor C7200 initialization */
228    extern int hypervisor_c7200_init(vm_platform_t *platform);
229    
230  /* PA drivers */  /* PA drivers */
231  extern struct c7200_pa_driver dev_c7200_io_fe_driver;  extern struct cisco_card_driver dev_c7200_iocard_fe_driver;
232  extern struct c7200_pa_driver dev_c7200_pa_fe_tx_driver;  extern struct cisco_card_driver dev_c7200_iocard_2fe_driver;
233  extern struct c7200_pa_driver dev_c7200_pa_4e_driver;  extern struct cisco_card_driver dev_c7200_iocard_ge_e_driver;
234  extern struct c7200_pa_driver dev_c7200_pa_8e_driver;  extern struct cisco_card_driver dev_c7200_pa_fe_tx_driver;
235  extern struct c7200_pa_driver dev_c7200_pa_4t_driver;  extern struct cisco_card_driver dev_c7200_pa_2fe_tx_driver;
236  extern struct c7200_pa_driver dev_c7200_pa_8t_driver;  extern struct cisco_card_driver dev_c7200_pa_ge_driver;
237  extern struct c7200_pa_driver dev_c7200_pa_a1_driver;  extern struct cisco_card_driver dev_c7200_pa_4e_driver;
238  extern struct c7200_pa_driver dev_c7200_pa_pos_oc3_driver;  extern struct cisco_card_driver dev_c7200_pa_8e_driver;
239  extern struct c7200_pa_driver dev_c7200_pa_4b_driver;  extern struct cisco_card_driver dev_c7200_pa_4t_driver;
240    extern struct cisco_card_driver dev_c7200_pa_8t_driver;
241    extern struct cisco_card_driver dev_c7200_pa_a1_driver;
242    extern struct cisco_card_driver dev_c7200_pa_pos_oc3_driver;
243    extern struct cisco_card_driver dev_c7200_pa_4b_driver;
244    extern struct cisco_card_driver dev_c7200_pa_mc8te1_driver;
245    
246  #endif  #endif

Legend:
Removed from v.3  
changed lines
  Added in v.11

  ViewVC Help
Powered by ViewVC 1.1.26