Date: Sun, 2 Apr 2006 06:25:07 GMT From: John-Mark Gurney <jmg@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 94449 for review Message-ID: <200604020625.k326P77x013871@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=94449 Change 94449 by jmg@jmg_carbon-60 on 2006/04/02 06:24:07 convert FreeBSD's width to HV's size enum... and use the union to get the proper returned data.. hopefully packing won't be an issue... Affected files ... .. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/hv_pci.c#7 edit Differences ... ==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/hv_pci.c#7 (text+ko) ==== @@ -157,22 +157,46 @@ int width) { struct hvpci_softc *sc; - int r; -#ifdef notyet + pci_config_size_t size; pci_cfg_data_t data; -#endif - uint32_t data; + uint32_t ret; sc = device_get_softc(dev); - data = 0; + switch (width) { + case 1: + size = PCI_CFG_SIZE_BYTE; + break; + case 2: + size = PCI_CFG_SIZE_WORD; + break; + case 4: + size = PCI_CFG_SIZE_DWORD; + break; + default: + panic("unsupported width: %d", width); + } + r = hvio_config_get(sc->hs_devhandle, HVPCI_BDF(bus, slot, func), - reg, width, &data); + reg, size, &data); printf("%d = read_config(%#x, %#x, %d, %d) = %#x\n", r, - sc->hs_devhandle, HVPCI_BDF(bus, slot, func), reg, width, data); - if (r == H_EOK) - return data; + sc->hs_devhandle, HVPCI_BDF(bus, slot, func), reg, width, data.dw); + + if (r == H_EOK) { + switch (width) { + case 1: + ret = data.b; + break; + case 2: + ret = data.w; + break; + case 4: + ret = data.dw; + break; + } + return ret; + } return -1; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200604020625.k326P77x013871>