xref: /qemu/include/hw/pci/pci_bridge.h (revision e78e9ae4a933504d383703870d491615b0261801)
1783753fdSIsaku Yamahata /*
2783753fdSIsaku Yamahata  * QEMU PCI bridge
3783753fdSIsaku Yamahata  *
4783753fdSIsaku Yamahata  * Copyright (c) 2004 Fabrice Bellard
5783753fdSIsaku Yamahata  *
6783753fdSIsaku Yamahata  * This program is free software; you can redistribute it and/or modify
7783753fdSIsaku Yamahata  * it under the terms of the GNU General Public License as published by
8783753fdSIsaku Yamahata  * the Free Software Foundation; either version 2 of the License, or
9783753fdSIsaku Yamahata  * (at your option) any later version.
10783753fdSIsaku Yamahata  *
11783753fdSIsaku Yamahata  * This program is distributed in the hope that it will be useful,
12783753fdSIsaku Yamahata  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13783753fdSIsaku Yamahata  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14783753fdSIsaku Yamahata  * GNU General Public License for more details.
15783753fdSIsaku Yamahata  *
16783753fdSIsaku Yamahata  * You should have received a copy of the GNU General Public License
17783753fdSIsaku Yamahata  * along with this program; if not, write to the Free Software
18783753fdSIsaku Yamahata  * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19783753fdSIsaku Yamahata  *
20783753fdSIsaku Yamahata  * split out pci bus specific stuff from pci.[hc] to pci_bridge.[hc]
21783753fdSIsaku Yamahata  * Copyright (c) 2009 Isaku Yamahata <yamahata at valinux co jp>
22783753fdSIsaku Yamahata  *                    VA Linux Systems Japan K.K.
23783753fdSIsaku Yamahata  *
24783753fdSIsaku Yamahata  */
25783753fdSIsaku Yamahata 
26783753fdSIsaku Yamahata #ifndef QEMU_PCI_BRIDGE_H
27783753fdSIsaku Yamahata #define QEMU_PCI_BRIDGE_H
28783753fdSIsaku Yamahata 
29c759b24fSMichael S. Tsirkin #include "hw/pci/pci.h"
30783753fdSIsaku Yamahata 
31f4c817e0SIsaku Yamahata int pci_bridge_ssvid_init(PCIDevice *dev, uint8_t offset,
32f4c817e0SIsaku Yamahata                           uint16_t svid, uint16_t ssid);
33f4c817e0SIsaku Yamahata 
34783753fdSIsaku Yamahata PCIDevice *pci_bridge_get_device(PCIBus *bus);
3568f79994SIsaku Yamahata PCIBus *pci_bridge_get_sec_bus(PCIBridge *br);
36783753fdSIsaku Yamahata 
3768f79994SIsaku Yamahata pcibus_t pci_bridge_get_base(const PCIDevice *bridge, uint8_t type);
3868f79994SIsaku Yamahata pcibus_t pci_bridge_get_limit(const PCIDevice *bridge, uint8_t type);
39783753fdSIsaku Yamahata 
40*e78e9ae4SDon Koch void pci_bridge_update_mappings(PCIBridge *br);
4168f79994SIsaku Yamahata void pci_bridge_write_config(PCIDevice *d,
4268f79994SIsaku Yamahata                              uint32_t address, uint32_t val, int len);
430208def1SIsaku Yamahata void pci_bridge_disable_base_limit(PCIDevice *dev);
4468f79994SIsaku Yamahata void pci_bridge_reset_reg(PCIDevice *dev);
4568f79994SIsaku Yamahata void pci_bridge_reset(DeviceState *qdev);
4668f79994SIsaku Yamahata 
4760a0e443SAlex Williamson int pci_bridge_initfn(PCIDevice *pci_dev, const char *typename);
48f90c2bcdSAlex Williamson void pci_bridge_exitfn(PCIDevice *pci_dev);
4968f79994SIsaku Yamahata 
5068f79994SIsaku Yamahata 
5168f79994SIsaku Yamahata /*
5268f79994SIsaku Yamahata  * before qdev initialization(qdev_init()), this function sets bus_name and
5368f79994SIsaku Yamahata  * map_irq callback which are necessry for pci_bridge_initfn() to
5468f79994SIsaku Yamahata  * initialize bus.
5568f79994SIsaku Yamahata  */
5668f79994SIsaku Yamahata void pci_bridge_map_irq(PCIBridge *br, const char* bus_name,
5768f79994SIsaku Yamahata                         pci_map_irq_fn map_irq);
58783753fdSIsaku Yamahata 
5945eb768cSMichael S. Tsirkin /* TODO: add this define to pci_regs.h in linux and then in qemu. */
6045eb768cSMichael S. Tsirkin #define  PCI_BRIDGE_CTL_VGA_16BIT	0x10	/* VGA 16-bit decode */
6145eb768cSMichael S. Tsirkin #define  PCI_BRIDGE_CTL_DISCARD		0x100	/* Primary discard timer */
6245eb768cSMichael S. Tsirkin #define  PCI_BRIDGE_CTL_SEC_DISCARD	0x200	/* Secondary discard timer */
6345eb768cSMichael S. Tsirkin #define  PCI_BRIDGE_CTL_DISCARD_STATUS	0x400	/* Discard timer status */
6445eb768cSMichael S. Tsirkin #define  PCI_BRIDGE_CTL_DISCARD_SERR	0x800	/* Discard timer SERR# enable */
6545eb768cSMichael S. Tsirkin 
66783753fdSIsaku Yamahata #endif  /* QEMU_PCI_BRIDGE_H */
67