Lines Matching +full:pci +full:- +full:x

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
35 * PCI bindings for Apple GMAC and Sun GEM Ethernet controllers
63 #include <dev/pci/pcireg.h>
64 #include <dev/pci/pcivar.h>
113 DRIVER_MODULE(gem, pci, gem_pci_driver, 0, 0);
114 MODULE_PNP_INFO("W32:vendor/device", pci, gem, gem_pci_devlist,
115 nitems(gem_pci_devlist) - 1);
116 MODULE_DEPEND(gem, pci, 1, 1, 1);
137 { -1, 0 }
140 #define GEM_SHARED_PINS "shared-pins"
155 sc->sc_variant = GEM_UNKNOWN; in gem_pci_attach()
158 sc->sc_variant = gem_pci_devlist[i].gpd_variant; in gem_pci_attach()
162 if (sc->sc_variant == GEM_UNKNOWN) { in gem_pci_attach()
169 sc->sc_dev = dev; in gem_pci_attach()
171 if (bus_alloc_resources(dev, gem_pci_res_spec, sc->sc_res)) { in gem_pci_attach()
173 bus_release_resources(dev, gem_pci_res_spec, sc->sc_res); in gem_pci_attach()
181 sc->sc_flags |= GEM_PCI66; in gem_pci_attach()
184 OF_getetheraddr(dev, sc->sc_enaddr); in gem_pci_attach()
187 buf[sizeof(buf) - 1] = '\0'; in gem_pci_attach()
189 sc->sc_flags |= GEM_SERDES; in gem_pci_attach()
194 * The VPD resides in the PCI Expansion ROM (PCI FCode) and can't in gem_pci_attach()
195 * be accessed via the PCI capability pointer. in gem_pci_attach()
196 * ``Writing FCode 3.x Programs'' (newer ones, dated 1997 and later) in gem_pci_attach()
212 #define PCI_VPDRES_ISLARGE(x) ((x) & 0x80) in gem_pci_attach() argument
213 #define PCI_VPDRES_LARGE_NAME(x) ((x) & 0x7f) in gem_pci_attach() argument
230 /* Read PCI Expansion ROM header. */ in gem_pci_attach()
234 device_printf(dev, "unexpected PCI Expansion ROM header\n"); in gem_pci_attach()
238 /* Read PCI Expansion ROM data. */ in gem_pci_attach()
244 device_printf(dev, "unexpected PCI Expansion ROM data\n"); in gem_pci_attach()
249 * Read PCI VPD. in gem_pci_attach()
250 * SUNW,pci-gem cards have a single large resource VPD-R tag in gem_pci_attach()
251 * containing one NA. The VPD used is not in PCI 2.2 standard in gem_pci_attach()
253 * endian and the end tag is non-standard (0x79) and followed in gem_pci_attach()
254 * by an all-zero "checksum" byte. Sun calls this a "Fresh in gem_pci_attach()
272 device_printf(dev, "unexpected PCI VPD\n"); in gem_pci_attach()
275 bus_read_region_1(sc->sc_res[GEM_RES_MEM], in gem_pci_attach()
277 sc->sc_enaddr, ETHER_ADDR_LEN); in gem_pci_attach()
280 * The Xserve G5 has a fake GMAC with an all-zero MAC address. in gem_pci_attach()
284 for (i = 0; i < ETHER_ADDR_LEN && sc->sc_enaddr[i] == 0; i++) {} in gem_pci_attach()
295 if (bus_setup_intr(dev, sc->sc_res[GEM_RES_INTR], INTR_TYPE_NET | in gem_pci_attach()
296 INTR_MPSAFE, NULL, gem_intr, sc, &sc->sc_ih) != 0) { in gem_pci_attach()
305 bus_release_resources(dev, gem_pci_res_spec, sc->sc_res); in gem_pci_attach()
315 bus_teardown_intr(dev, sc->sc_res[GEM_RES_INTR], sc->sc_ih); in gem_pci_detach()
318 bus_release_resources(dev, gem_pci_res_spec, sc->sc_res); in gem_pci_detach()