Deleted Added
full compact
ahc_pci.c (71717) ahc_pci.c (74094)
1/*
2 * FreeBSD, PCI product support functions
3 *
4 * Copyright (c) 1995-2001 Justin T. Gibbs
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 16 unchanged lines hidden (view full) ---

25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
31 * $Id$
32 *
1/*
2 * FreeBSD, PCI product support functions
3 *
4 * Copyright (c) 1995-2001 Justin T. Gibbs
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 16 unchanged lines hidden (view full) ---

25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
31 * $Id$
32 *
33 * $FreeBSD: head/sys/dev/aic7xxx/ahc_pci.c 71717 2001-01-27 20:54:24Z gibbs $
33 * $FreeBSD: head/sys/dev/aic7xxx/ahc_pci.c 74094 2001-03-11 06:34:17Z gibbs $
34 */
35
36#include <dev/aic7xxx/aic7xxx_freebsd.h>
37
38#define AHC_PCI_IOADDR PCIR_MAPS /* I/O Address */
39#define AHC_PCI_MEMADDR (PCIR_MAPS + 4) /* Mem I/O Address */
40
41static int ahc_pci_probe(device_t dev);

--- 166 unchanged lines hidden (view full) ---

208 ahc->platform_data->irq =
209 bus_alloc_resource(ahc->dev_softc, SYS_RES_IRQ, &zero,
210 0, ~0, 1, RF_ACTIVE | RF_SHAREABLE);
211 if (ahc->platform_data->irq == NULL)
212 return (ENOMEM);
213 ahc->platform_data->irq_res_type = SYS_RES_IRQ;
214 return (0);
215}
34 */
35
36#include <dev/aic7xxx/aic7xxx_freebsd.h>
37
38#define AHC_PCI_IOADDR PCIR_MAPS /* I/O Address */
39#define AHC_PCI_MEMADDR (PCIR_MAPS + 4) /* Mem I/O Address */
40
41static int ahc_pci_probe(device_t dev);

--- 166 unchanged lines hidden (view full) ---

208 ahc->platform_data->irq =
209 bus_alloc_resource(ahc->dev_softc, SYS_RES_IRQ, &zero,
210 0, ~0, 1, RF_ACTIVE | RF_SHAREABLE);
211 if (ahc->platform_data->irq == NULL)
212 return (ENOMEM);
213 ahc->platform_data->irq_res_type = SYS_RES_IRQ;
214 return (0);
215}
216
217void
218ahc_power_state_change(struct ahc_softc *ahc, ahc_power_state new_state)
219{
220 uint32_t cap;
221 u_int cap_offset;
222
223 /*
224 * Traverse the capability list looking for
225 * the power management capability.
226 */
227 cap = 0;
228 cap_offset = ahc_pci_read_config(ahc->dev_softc,
229 PCIR_CAP_PTR, /*bytes*/1);
230 while (cap_offset != 0) {
231
232 cap = ahc_pci_read_config(ahc->dev_softc,
233 cap_offset, /*bytes*/4);
234 if ((cap & 0xFF) == 1
235 && ((cap >> 16) & 0x3) > 0) {
236 uint32_t pm_control;
237
238 pm_control = ahc_pci_read_config(ahc->dev_softc,
239 cap_offset + 4,
240 /*bytes*/4);
241 pm_control &= ~0x3;
242 pm_control |= new_state;
243 ahc_pci_write_config(ahc->dev_softc,
244 cap_offset + 4,
245 pm_control, /*bytes*/2);
246 break;
247 }
248 cap_offset = (cap >> 8) & 0xFF;
249 }
250}