ahc_pci.c (78555) | ahc_pci.c (79874) |
---|---|
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 78555 2001-06-21 16:18:27Z mjacob $ | 33 * $FreeBSD: head/sys/dev/aic7xxx/ahc_pci.c 79874 2001-07-18 21:39:48Z 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); --- 55 unchanged lines hidden (view full) --- 97 return (ENOMEM); 98 strcpy(name, device_get_nameunit(dev)); 99 ahc = ahc_alloc(dev, name); 100 if (ahc == NULL) 101 return (ENOMEM); 102 103 ahc_set_unit(ahc, device_get_unit(dev)); 104 | 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); --- 55 unchanged lines hidden (view full) --- 97 return (ENOMEM); 98 strcpy(name, device_get_nameunit(dev)); 99 ahc = ahc_alloc(dev, name); 100 if (ahc == NULL) 101 return (ENOMEM); 102 103 ahc_set_unit(ahc, device_get_unit(dev)); 104 |
105 /* 106 * Should we bother disabling 39Bit addressing 107 * based on installed memory? 108 */ 109 if (sizeof(bus_addr_t) > 4) 110 ahc->flags |= AHC_39BIT_ADDRESSING; 111 |
|
105 /* Allocate a dmatag for our SCB DMA maps */ 106 /* XXX Should be a child of the PCI bus dma tag */ 107 error = bus_dma_tag_create(/*parent*/NULL, /*alignment*/1, 108 /*boundary*/0, | 112 /* Allocate a dmatag for our SCB DMA maps */ 113 /* XXX Should be a child of the PCI bus dma tag */ 114 error = bus_dma_tag_create(/*parent*/NULL, /*alignment*/1, 115 /*boundary*/0, |
109 /*lowaddr*/BUS_SPACE_MAXADDR_32BIT, | 116 (ahc->flags & AHC_39BIT_ADDRESSING) 117 ? 0x7FFFFFFFFF 118 : BUS_SPACE_MAXADDR_32BIT, |
110 /*highaddr*/BUS_SPACE_MAXADDR, 111 /*filter*/NULL, /*filterarg*/NULL, 112 /*maxsize*/MAXBSIZE, /*nsegments*/AHC_NSEG, 113 /*maxsegsz*/AHC_MAXTRANSFER_SIZE, 114 /*flags*/BUS_DMA_ALLOCNOW, 115 &ahc->parent_dmat); 116 117 if (error != 0) { --- 59 unchanged lines hidden (view full) --- 177 } 178 } 179#endif 180 if (regs == NULL && (command & PCIM_CMD_PORTEN) != 0) { 181 regs_type = SYS_RES_IOPORT; 182 regs_id = AHC_PCI_IOADDR; 183 regs = bus_alloc_resource(ahc->dev_softc, regs_type, 184 ®s_id, 0, ~0, 1, RF_ACTIVE); | 119 /*highaddr*/BUS_SPACE_MAXADDR, 120 /*filter*/NULL, /*filterarg*/NULL, 121 /*maxsize*/MAXBSIZE, /*nsegments*/AHC_NSEG, 122 /*maxsegsz*/AHC_MAXTRANSFER_SIZE, 123 /*flags*/BUS_DMA_ALLOCNOW, 124 &ahc->parent_dmat); 125 126 if (error != 0) { --- 59 unchanged lines hidden (view full) --- 186 } 187 } 188#endif 189 if (regs == NULL && (command & PCIM_CMD_PORTEN) != 0) { 190 regs_type = SYS_RES_IOPORT; 191 regs_id = AHC_PCI_IOADDR; 192 regs = bus_alloc_resource(ahc->dev_softc, regs_type, 193 ®s_id, 0, ~0, 1, RF_ACTIVE); |
185 if (regs) { | 194 if (regs != NULL) { |
186 ahc->tag = rman_get_bustag(regs); 187 ahc->bsh = rman_get_bushandle(regs); 188 command &= ~PCIM_CMD_MEMEN; 189 ahc_pci_write_config(ahc->dev_softc, PCIR_COMMAND, 190 command, /*bytes*/1); 191 } 192 } | 195 ahc->tag = rman_get_bustag(regs); 196 ahc->bsh = rman_get_bushandle(regs); 197 command &= ~PCIM_CMD_MEMEN; 198 ahc_pci_write_config(ahc->dev_softc, PCIR_COMMAND, 199 command, /*bytes*/1); 200 } 201 } |
193 ahc->platform_data->regs_res_type = regs_type; 194 ahc->platform_data->regs_res_id = regs_id; 195 ahc->platform_data->regs = regs; 196 | |
197 if (regs == NULL) { 198 device_printf(ahc->dev_softc, 199 "can't allocate register resources\n"); 200 return (ENOMEM); 201 } | 202 if (regs == NULL) { 203 device_printf(ahc->dev_softc, 204 "can't allocate register resources\n"); 205 return (ENOMEM); 206 } |
207 ahc->platform_data->regs_res_type = regs_type; 208 ahc->platform_data->regs_res_id = regs_id; 209 ahc->platform_data->regs = regs; |
|
202 return (0); 203} 204 205int 206ahc_pci_map_int(struct ahc_softc *ahc) 207{ 208 int zero; 209 --- 44 unchanged lines hidden --- | 210 return (0); 211} 212 213int 214ahc_pci_map_int(struct ahc_softc *ahc) 215{ 216 int zero; 217 --- 44 unchanged lines hidden --- |