pci.hh revision 10388
13901Ssaidi@eecs.umich.edu/* 23388Sgblack@eecs.umich.edu * Copyright (c) 2014 ARM Limited 33388Sgblack@eecs.umich.edu * All rights reserved 43388Sgblack@eecs.umich.edu * 53388Sgblack@eecs.umich.edu * The license below extends only to copyright in the software and shall 63388Sgblack@eecs.umich.edu * not be construed as granting a license to any other intellectual 73388Sgblack@eecs.umich.edu * property including but not limited to intellectual property relating 83388Sgblack@eecs.umich.edu * to a hardware implementation of the functionality of the software 93388Sgblack@eecs.umich.edu * licensed hereunder. You may use the software subject to the license 103388Sgblack@eecs.umich.edu * terms below provided that you ensure that this notice is replicated 113388Sgblack@eecs.umich.edu * unmodified and in its entirety in all distributions of the software, 123388Sgblack@eecs.umich.edu * modified or unmodified, in source code or in binary form. 133388Sgblack@eecs.umich.edu * 143388Sgblack@eecs.umich.edu * Redistribution and use in source and binary forms, with or without 153388Sgblack@eecs.umich.edu * modification, are permitted provided that the following conditions are 163388Sgblack@eecs.umich.edu * met: redistributions of source code must retain the above copyright 173388Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer; 183388Sgblack@eecs.umich.edu * redistributions in binary form must reproduce the above copyright 193388Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the 203388Sgblack@eecs.umich.edu * documentation and/or other materials provided with the distribution; 213388Sgblack@eecs.umich.edu * neither the name of the copyright holders nor the names of its 223388Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from 233388Sgblack@eecs.umich.edu * this software without specific prior written permission. 243388Sgblack@eecs.umich.edu * 253388Sgblack@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 263388Sgblack@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 273388Sgblack@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 283388Sgblack@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 293388Sgblack@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 303270SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 313270SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 323270SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 333270SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 343270SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 353270SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 363270SN/A * 373270SN/A * Authors: Andreas Sandberg 383270SN/A */ 393270SN/A 403270SN/A#ifndef __DEV_VIRTIO_PCI_HH__ 413270SN/A#define __DEV_VIRTIO_PCI_HH__ 427741Sgblack@eecs.umich.edu 433280SN/A#include "base/statistics.hh" 443270SN/A#include "dev/virtio/base.hh" 453274SN/A#include "dev/pcidev.hh" 463270SN/A 473270SN/Astruct PciVirtIOParams; 483274SN/A 497741Sgblack@eecs.umich.educlass PciVirtIO : public PciDevice 503280SN/A{ 5112616Sgabeblack@google.com public: 5212616Sgabeblack@google.com typedef PciVirtIOParams Params; 5312616Sgabeblack@google.com PciVirtIO(const Params *params); 5412616Sgabeblack@google.com virtual ~PciVirtIO(); 5512236Sgabeblack@google.com 5612616Sgabeblack@google.com Tick read(PacketPtr pkt); 573270SN/A Tick write(PacketPtr pkt); 583270SN/A 593270SN/A void kick(); 603270SN/A 613274SN/A protected: 627741Sgblack@eecs.umich.edu /** @{ */ 633280SN/A /** Offsets into VirtIO header (BAR0 relative). */ 6412616Sgabeblack@google.com 6512616Sgabeblack@google.com static const Addr OFF_DEVICE_FEATURES = 0x00; 6612616Sgabeblack@google.com static const Addr OFF_GUEST_FEATURES = 0x04; 6712616Sgabeblack@google.com static const Addr OFF_QUEUE_ADDRESS = 0x08; 6812236Sgabeblack@google.com static const Addr OFF_QUEUE_SIZE = 0x0C; 6912616Sgabeblack@google.com static const Addr OFF_QUEUE_SELECT = 0x0E; 703270SN/A static const Addr OFF_QUEUE_NOTIFY = 0x10; 713270SN/A static const Addr OFF_DEVICE_STATUS = 0x12; 723270SN/A static const Addr OFF_ISR_STATUS = 0x13; 733270SN/A static const Addr OFF_VIO_DEVICE = 0x14; 743274SN/A 757741Sgblack@eecs.umich.edu /** @} */ 763280SN/A 7712616Sgabeblack@google.com static const Addr BAR0_SIZE_BASE = OFF_VIO_DEVICE; 7812616Sgabeblack@google.com 7912616Sgabeblack@google.com 8012616Sgabeblack@google.com VirtIODeviceBase::QueueID queueNotify; 8112236Sgabeblack@google.com 8212616Sgabeblack@google.com bool interruptDeliveryPending; 833270SN/A 843270SN/A VirtIODeviceBase &vio; 853270SN/A 863270SN/A MakeCallback<PciVirtIO, &PciVirtIO::kick> callbackKick; 873274SN/A}; 887741Sgblack@eecs.umich.edu 893280SN/A#endif // __DEV_VIRTIO_PCI_HH__ 9012616Sgabeblack@google.com