1366f6083SPeter Grehan /*- 2366f6083SPeter Grehan * Copyright (c) 2011 NetApp, Inc. 3366f6083SPeter Grehan * All rights reserved. 4366f6083SPeter Grehan * 5366f6083SPeter Grehan * Redistribution and use in source and binary forms, with or without 6366f6083SPeter Grehan * modification, are permitted provided that the following conditions 7366f6083SPeter Grehan * are met: 8366f6083SPeter Grehan * 1. Redistributions of source code must retain the above copyright 9366f6083SPeter Grehan * notice, this list of conditions and the following disclaimer. 10366f6083SPeter Grehan * 2. Redistributions in binary form must reproduce the above copyright 11366f6083SPeter Grehan * notice, this list of conditions and the following disclaimer in the 12366f6083SPeter Grehan * documentation and/or other materials provided with the distribution. 13366f6083SPeter Grehan * 14366f6083SPeter Grehan * THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND 15366f6083SPeter Grehan * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16366f6083SPeter Grehan * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17366f6083SPeter Grehan * ARE DISCLAIMED. IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE 18366f6083SPeter Grehan * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19366f6083SPeter Grehan * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20366f6083SPeter Grehan * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21366f6083SPeter Grehan * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22366f6083SPeter Grehan * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23366f6083SPeter Grehan * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24366f6083SPeter Grehan * SUCH DAMAGE. 25366f6083SPeter Grehan * 26366f6083SPeter Grehan * $FreeBSD$ 27366f6083SPeter Grehan */ 28366f6083SPeter Grehan 29366f6083SPeter Grehan #include <sys/cdefs.h> 30366f6083SPeter Grehan __FBSDID("$FreeBSD$"); 31366f6083SPeter Grehan 32366f6083SPeter Grehan #include "pci_emul.h" 33366f6083SPeter Grehan 34366f6083SPeter Grehan static int 35366f6083SPeter Grehan pci_hostbridge_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts) 36366f6083SPeter Grehan { 37366f6083SPeter Grehan 38366f6083SPeter Grehan /* config space */ 39366f6083SPeter Grehan pci_set_cfgdata16(pi, PCIR_VENDOR, 0x1275); /* NetApp */ 40366f6083SPeter Grehan pci_set_cfgdata16(pi, PCIR_DEVICE, 0x1275); /* NetApp */ 41*a0df62cdSTycho Nightingale pci_set_cfgdata8(pi, PCIR_HDRTYPE, PCIM_HDRTYPE_NORMAL); 42366f6083SPeter Grehan pci_set_cfgdata8(pi, PCIR_CLASS, PCIC_BRIDGE); 43366f6083SPeter Grehan pci_set_cfgdata8(pi, PCIR_SUBCLASS, PCIS_BRIDGE_HOST); 44366f6083SPeter Grehan 4574f80b23SNeel Natu pci_emul_add_pciecap(pi, PCIEM_TYPE_ROOT_PORT); 4674f80b23SNeel Natu 47366f6083SPeter Grehan return (0); 48366f6083SPeter Grehan } 49366f6083SPeter Grehan 50062b878fSPeter Grehan static int 51062b878fSPeter Grehan pci_amd_hostbridge_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts) 52062b878fSPeter Grehan { 53062b878fSPeter Grehan (void) pci_hostbridge_init(ctx, pi, opts); 54062b878fSPeter Grehan pci_set_cfgdata16(pi, PCIR_VENDOR, 0x1022); /* AMD */ 55062b878fSPeter Grehan pci_set_cfgdata16(pi, PCIR_DEVICE, 0x7432); /* made up */ 56062b878fSPeter Grehan 57062b878fSPeter Grehan return (0); 58062b878fSPeter Grehan } 59062b878fSPeter Grehan 60062b878fSPeter Grehan struct pci_devemu pci_de_amd_hostbridge = { 61062b878fSPeter Grehan .pe_emu = "amd_hostbridge", 62062b878fSPeter Grehan .pe_init = pci_amd_hostbridge_init, 63062b878fSPeter Grehan }; 64062b878fSPeter Grehan PCI_EMUL_SET(pci_de_amd_hostbridge); 65062b878fSPeter Grehan 66366f6083SPeter Grehan struct pci_devemu pci_de_hostbridge = { 67366f6083SPeter Grehan .pe_emu = "hostbridge", 68366f6083SPeter Grehan .pe_init = pci_hostbridge_init, 69366f6083SPeter Grehan }; 70366f6083SPeter Grehan PCI_EMUL_SET(pci_de_hostbridge); 71