Overview   API Reference  

i440fx_host_bridge.hpp

00001 #if !defined(__I440FX_HOST_BRIDGE_HPP__)
00002 #define __I440FX_HOST_BRIDGE_HPP__
00003 
00004 //
00005 // local includes
00006 //
00007 #include "core/machine/iospace/iospace_handler.hpp"
00008 #include "core/machine/pci/pci_bridge_base.hpp"
00009 #include "i440fx_config_address.hpp"
00010 #include "i440fx_config_space.hpp"
00011 
00012 //
00013 // forward declarations
00014 //
00015 struct machine_base;
00016 
00017 //
00018 // stub PCI device implementing unused functions to remove this stuff from the bridge class.
00019 //     pci_device_base is too large to be inherited here.
00020 //
00021 namespace detail
00022 {
00023     struct i440fx_pci_device : public pci_device
00024     {
00025         virtual inline const pci_ioregion *get_ioregion(const uint8_t region_num) const
00026         {
00027             // the i440FX bridge itself has no I/O regions.
00028             return nullptr;
00029         }
00030 
00031         virtual inline const search_result search_ioregion(enum pci_ioregion::type type,
00032                                                            l4_gpa_t base, l4_gpa_t size=1) const
00033         {
00034             // the i440FX bridge itself has no I/O regions.
00035             return search_result();
00036         }
00037     };
00038 }
00039 
00045 struct i440fx_host_bridge : public iospace_handler, public detail::i440fx_pci_device,
00046                             public pci_bridge_base
00047 {
00048     static const l4_port_t CONFIG_ADDRESS = 0x0cf8;     // size 32 bit, 32 bit access
00049     static const l4_port_t CONFIG_DATA    = 0x0cfc;     // size 32 bit, 8-32 bit access
00050 
00051   protected:
00052     i440fx_config_space config_space;
00053     i440fx_config_address config_address;
00054 
00055   public:
00056     i440fx_host_bridge(machine_base &machine);
00057     virtual ~i440fx_host_bridge(void);
00058 
00059     //
00060     // iospace_handler: override I/O space access handlers
00061     //
00062     virtual uint32_t read_ioport(l4_port_t port, access_size access_size);
00063     virtual int write_ioport(l4_port_t port, uint32_t data, access_size access_size);
00064 
00065     //
00066     // pci_device: override name
00067     //
00068     virtual inline const char *name(void) const
00069     {
00070         return "[VRT] i440FX host bridge";
00071     }
00072 
00073     //
00074     // pci_device/pci_bridge: override reset
00075     //
00076     virtual int reset(void);
00077 
00078     //
00079     // pci_device: override PCI configuration space access handlers
00080     //
00081     virtual inline const pci_config_header64 &get_config_space(void) const
00082     {
00083         return config_space;
00084     }
00085 
00086     virtual l4_umword_t read_config_space(pci_config_header16::offset_t offset,
00087                                           access_size access_size);
00088     virtual int write_config_space(pci_config_header16::offset_t offset,
00089                                    l4_umword_t data, access_size access_size);
00090 };
00091 
00092 #endif
00093 
00094 // ***** end of source ***** //
00095 

L4vmm Reference Manual, written by Mario Schwalbe  © 2006-2008