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

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

upstream/dynamips-0.2.6-RC5/pci_dev.c revision 6 by dpavlin, Sat Oct 6 16:09:07 2007 UTC upstream/dynamips-0.2.7-RC1/pci_dev.c revision 7 by dpavlin, Sat Oct 6 16:23:47 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   * PCI devices.   * PCI devices.
# Line 15  Line 15 
15  #include <unistd.h>  #include <unistd.h>
16  #include <sys/types.h>  #include <sys/types.h>
17    
18  #include "mips64.h"  #include "cpu.h"
19    #include "vm.h"
20  #include "dynamips.h"  #include "dynamips.h"
21  #include "memory.h"  #include "memory.h"
22  #include "device.h"  #include "device.h"
 #include "vm.h"  
23    
24  #define DEBUG_PCI 1  #define DEBUG_PCI 1
25    
# Line 109  struct pci_device *pci_dev_lookup(struct Line 109  struct pci_device *pci_dev_lookup(struct
109  }  }
110    
111  /* Handle the address register access */  /* Handle the address register access */
112  void pci_dev_addr_handler(cpu_mips_t *cpu,struct pci_bus *pci_bus,  void pci_dev_addr_handler(cpu_gen_t *cpu,struct pci_bus *pci_bus,
113                            u_int op_type,int swap,m_uint64_t *data)                            u_int op_type,int swap,m_uint64_t *data)
114  {  {
115     if (op_type == MTS_WRITE)     if (op_type == MTS_WRITE)
# Line 126  void pci_dev_addr_handler(cpu_mips_t *cp Line 126  void pci_dev_addr_handler(cpu_mips_t *cp
126   *   *
127   * The data is read/written at address 0xcfc.   * The data is read/written at address 0xcfc.
128   */   */
129  void pci_dev_data_handler(cpu_mips_t *cpu,struct pci_bus *pci_bus,  void pci_dev_data_handler(cpu_gen_t *cpu,struct pci_bus *pci_bus,
130                            u_int op_type,int swap,m_uint64_t *data)                            u_int op_type,int swap,m_uint64_t *data)
131  {    {  
132     struct pci_device *dev;     struct pci_device *dev;
133     int bus,device,function,reg;     int bus,device,function,reg;
134    
135     if (op_type == MTS_READ)     if (op_type == MTS_READ)
136        *data = 0;        *data = 0x0;
137    
138     /*     /*
139      * http://www.mega-tokyo.com/osfaq2/index.php/PciSectionOfPentiumVme      * http://www.mega-tokyo.com/osfaq2/index.php/PciSectionOfPentiumVme
# Line 158  void pci_dev_data_handler(cpu_mips_t *cp Line 158  void pci_dev_data_handler(cpu_mips_t *cp
158     if (op_type == MTS_READ) {     if (op_type == MTS_READ) {
159        cpu_log(cpu,"PCI","read request at pc=0x%llx: "        cpu_log(cpu,"PCI","read request at pc=0x%llx: "
160                "bus=%d,device=%d,function=%d,reg=0x%2.2x\n",                "bus=%d,device=%d,function=%d,reg=0x%2.2x\n",
161                cpu->pc, bus, device, function, reg);                cpu_get_pc(cpu), bus, device, function, reg);
162     } else {     } else {
163        cpu_log(cpu,"PCI","write request (data=0x%8.8x) at pc=0x%llx: "        cpu_log(cpu,"PCI","write request (data=0x%8.8x) at pc=0x%llx: "
164                "bus=%d,device=%d,function=%d,reg=0x%2.2x\n",                "bus=%d,device=%d,function=%d,reg=0x%2.2x\n",
165                pci_swap(*data,swap), cpu->pc, bus, device, function, reg);                pci_swap(*data,swap), cpu_get_pc(cpu),
166                  bus, device, function, reg);
167     }     }
168  #endif  #endif
169    
# Line 170  void pci_dev_data_handler(cpu_mips_t *cp Line 171  void pci_dev_data_handler(cpu_mips_t *cp
171        if (op_type == MTS_READ) {        if (op_type == MTS_READ) {
172           cpu_log(cpu,"PCI","read request for unknown device at pc=0x%llx "           cpu_log(cpu,"PCI","read request for unknown device at pc=0x%llx "
173                   "(bus=%d,device=%d,function=%d,reg=0x%2.2x).\n",                   "(bus=%d,device=%d,function=%d,reg=0x%2.2x).\n",
174                   cpu->pc, bus, device, function, reg);                   cpu_get_pc(cpu), bus, device, function, reg);
175        } else {        } else {
176           cpu_log(cpu,"PCI","write request (data=0x%8.8x) for unknown device "           cpu_log(cpu,"PCI","write request (data=0x%8.8x) for unknown device "
177                   "at pc=0x%llx (bus=%d,device=%d,function=%d,reg=0x%2.2x).\n",                   "at pc=0x%llx (bus=%d,device=%d,function=%d,reg=0x%2.2x).\n",
178                   pci_swap(*data,swap), cpu->pc, bus, device, function, reg);                   pci_swap(*data,swap), cpu_get_pc(cpu),
179                     bus, device, function, reg);
180        }        }
181    
182        /* Returns an invalid device ID */        /* Returns an invalid device ID */
# Line 425  void pci_bus_remove(struct pci_bus *pci_ Line 427  void pci_bus_remove(struct pci_bus *pci_
427  }  }
428    
429  /* Read a configuration register of a PCI bridge */  /* Read a configuration register of a PCI bridge */
430  static m_uint32_t pci_bridge_read_reg(cpu_mips_t *cpu,struct pci_device *dev,  static m_uint32_t pci_bridge_read_reg(cpu_gen_t *cpu,struct pci_device *dev,
431                                        int reg)                                        int reg)
432  {  {
433     struct pci_bridge *bridge = dev->priv_data;     struct pci_bridge *bridge = dev->priv_data;
# Line 447  static m_uint32_t pci_bridge_read_reg(cp Line 449  static m_uint32_t pci_bridge_read_reg(cp
449  }  }
450    
451  /* Write a configuration register of a PCI bridge */  /* Write a configuration register of a PCI bridge */
452  static void pci_bridge_write_reg(cpu_mips_t *cpu,struct pci_device *dev,  static void pci_bridge_write_reg(cpu_gen_t *cpu,struct pci_device *dev,
453                                   int reg,m_uint32_t value)                                   int reg,m_uint32_t value)
454  {  {
455     struct pci_bridge *bridge = dev->priv_data;     struct pci_bridge *bridge = dev->priv_data;

Legend:
Removed from v.6  
changed lines
  Added in v.7

  ViewVC Help
Powered by ViewVC 1.1.26