18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
38c2ecf20Sopenharmony_ci * License.  See the file "COPYING" in the main directory of this archive
48c2ecf20Sopenharmony_ci * for more details.
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * Copyright (C) 2003 Christoph Hellwig (hch@lst.de)
78c2ecf20Sopenharmony_ci * Copyright (C) 1999, 2000, 04 Ralf Baechle (ralf@linux-mips.org)
88c2ecf20Sopenharmony_ci * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci#include <asm/sn/addrs.h>
118c2ecf20Sopenharmony_ci#include <asm/sn/types.h>
128c2ecf20Sopenharmony_ci#include <asm/sn/klconfig.h>
138c2ecf20Sopenharmony_ci#include <asm/sn/agent.h>
148c2ecf20Sopenharmony_ci#include <asm/sn/ioc3.h>
158c2ecf20Sopenharmony_ci#include <asm/pci/bridge.h>
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#ifdef CONFIG_NUMA
188c2ecf20Sopenharmony_ciint pcibus_to_node(struct pci_bus *bus)
198c2ecf20Sopenharmony_ci{
208c2ecf20Sopenharmony_ci	struct bridge_controller *bc = BRIDGE_CONTROLLER(bus);
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci	return bc->nasid;
238c2ecf20Sopenharmony_ci}
248c2ecf20Sopenharmony_ciEXPORT_SYMBOL(pcibus_to_node);
258c2ecf20Sopenharmony_ci#endif /* CONFIG_NUMA */
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_cistatic void ip29_fixup_phy(struct pci_dev *dev)
288c2ecf20Sopenharmony_ci{
298c2ecf20Sopenharmony_ci	int nasid = pcibus_to_node(dev->bus);
308c2ecf20Sopenharmony_ci	u32 sid;
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci	if (nasid != 1)
338c2ecf20Sopenharmony_ci		return; /* only needed on second module */
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci	/* enable ethernet PHY on IP29 systemboard */
368c2ecf20Sopenharmony_ci	pci_read_config_dword(dev, PCI_SUBSYSTEM_VENDOR_ID, &sid);
378c2ecf20Sopenharmony_ci	if (sid == (PCI_VENDOR_ID_SGI | (IOC3_SUBSYS_IP29_SYSBOARD) << 16))
388c2ecf20Sopenharmony_ci		REMOTE_HUB_S(nasid, MD_LED0, 0x09);
398c2ecf20Sopenharmony_ci}
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ciDECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SGI, PCI_DEVICE_ID_SGI_IOC3,
428c2ecf20Sopenharmony_ci			ip29_fixup_phy);
43