Deleted Added
full compact
tdfx_pci.c (64085) tdfx_pci.c (65146)
1/*
2 * Copyright (c) 2000 by Coleman Kane <cokane@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

23 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 *
1/*
2 * Copyright (c) 2000 by Coleman Kane <cokane@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

23 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 *
31 * $FreeBSD: head/sys/dev/tdfx/tdfx_pci.c 64085 2000-08-01 05:10:29Z cokane $
31 * $FreeBSD: head/sys/dev/tdfx/tdfx_pci.c 65146 2000-08-28 04:28:53Z cokane $
32 */
33
34/* 3dfx driver for FreeBSD 4.x - Finished 11 May 2000, 12:25AM ET
35 *
36 * Copyright (C) 2000, by Coleman Kane <cokane@FreeBSD.org>,
37 * based upon the 3dfx driver written for linux, by Daryll Straus, Jon Taylor,
38 * and Jens Axboe, located at http://linux.3dfx.com.
39 */

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

137 */
138 switch(pci_get_devid(dev)) {
139 case PCI_DEVICE_ALLIANCE_AT3D:
140 device_set_desc(dev, "ProMotion At3D 3D Accelerator");
141 return 0;
142 case PCI_DEVICE_3DFX_VOODOO2:
143 device_set_desc(dev, "3DFX Voodoo II 3D Accelerator");
144 return 0;
32 */
33
34/* 3dfx driver for FreeBSD 4.x - Finished 11 May 2000, 12:25AM ET
35 *
36 * Copyright (C) 2000, by Coleman Kane <cokane@FreeBSD.org>,
37 * based upon the 3dfx driver written for linux, by Daryll Straus, Jon Taylor,
38 * and Jens Axboe, located at http://linux.3dfx.com.
39 */

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

137 */
138 switch(pci_get_devid(dev)) {
139 case PCI_DEVICE_ALLIANCE_AT3D:
140 device_set_desc(dev, "ProMotion At3D 3D Accelerator");
141 return 0;
142 case PCI_DEVICE_3DFX_VOODOO2:
143 device_set_desc(dev, "3DFX Voodoo II 3D Accelerator");
144 return 0;
145 case PCI_DEVICE_3DFX_BANSHEE:
145 /*case PCI_DEVICE_3DFX_BANSHEE:
146 device_set_desc(dev, "3DFX Voodoo Banshee 2D/3D Graphics Accelerator");
147 return 0;
148 case PCI_DEVICE_3DFX_VOODOO3:
149 device_set_desc(dev, "3DFX Voodoo3 2D/3D Graphics Accelerator");
146 device_set_desc(dev, "3DFX Voodoo Banshee 2D/3D Graphics Accelerator");
147 return 0;
148 case PCI_DEVICE_3DFX_VOODOO3:
149 device_set_desc(dev, "3DFX Voodoo3 2D/3D Graphics Accelerator");
150 return 0;
150 return 0;*/
151 case PCI_DEVICE_3DFX_VOODOO1:
152 device_set_desc(dev, "3DFX Voodoo Graphics 3D Accelerator");
153 return 0;;
154 };
155
156 return ENXIO;
157}
158

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

233 device_printf(dev, "Mem1 couldn't be allocated, glide may not work.");
234#endif
235 tdfx_info->memrid2 = 0;
236 }
237 else {
238 tdfx_info->memrid2 = rid;
239 }
240 /* Now to map the PIO stuff */
151 case PCI_DEVICE_3DFX_VOODOO1:
152 device_set_desc(dev, "3DFX Voodoo Graphics 3D Accelerator");
153 return 0;;
154 };
155
156 return ENXIO;
157}
158

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

233 device_printf(dev, "Mem1 couldn't be allocated, glide may not work.");
234#endif
235 tdfx_info->memrid2 = 0;
236 }
237 else {
238 tdfx_info->memrid2 = rid;
239 }
240 /* Now to map the PIO stuff */
241/* rid = 0;
241 rid = PCIR_IOBASE0_2;
242 tdfx_info->pio0 = pci_read_config(dev, 0x2c, 2);
243 tdfx_info->pio0max = pci_read_config(dev, 0x30, 2) + tdfx_info->pio0;
242 tdfx_info->piorange = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
243 0, ~0, 1, RF_ACTIVE | RF_SHAREABLE);
244 if(tdfx_info->piorange == NULL) {
245#ifdef DEBUG
246 device_printf(dev, "Couldn't map PIO range.");
247#endif
248 tdfx_info->piorid = 0;
249 }
250 else {
251 tdfx_info->piorid = rid;
244 tdfx_info->piorange = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
245 0, ~0, 1, RF_ACTIVE | RF_SHAREABLE);
246 if(tdfx_info->piorange == NULL) {
247#ifdef DEBUG
248 device_printf(dev, "Couldn't map PIO range.");
249#endif
250 tdfx_info->piorid = 0;
251 }
252 else {
253 tdfx_info->piorid = rid;
252 }*/
254 }
253 } else {
254 tdfx_info->addr1 = 0;
255 tdfx_info->memrange2 = NULL;
256 tdfx_info->piorange = NULL;
257 }
258
259 /*
260 * Set Writecombining, or at least Uncacheable for the memory region, if we

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

539 case PCI_DEVICE_ID_FREEBSD:
540 if(piod->size != 2) return -EINVAL;
541 copyout(&tdfx_info->type, piod->value, piod->size);
542 return 0;
543 case PCI_BASE_ADDRESS_0_FREEBSD:
544 if(piod->size != 4) return -EINVAL;
545 copyout(&tdfx_info->addr0, piod->value, piod->size);
546 return 0;
255 } else {
256 tdfx_info->addr1 = 0;
257 tdfx_info->memrange2 = NULL;
258 tdfx_info->piorange = NULL;
259 }
260
261 /*
262 * Set Writecombining, or at least Uncacheable for the memory region, if we

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

541 case PCI_DEVICE_ID_FREEBSD:
542 if(piod->size != 2) return -EINVAL;
543 copyout(&tdfx_info->type, piod->value, piod->size);
544 return 0;
545 case PCI_BASE_ADDRESS_0_FREEBSD:
546 if(piod->size != 4) return -EINVAL;
547 copyout(&tdfx_info->addr0, piod->value, piod->size);
548 return 0;
549 case PCI_BASE_ADDRESS_1_FREEBSD:
550 if(piod->size != 4) return -EINVAL;
551 copyout(&tdfx_info->addr1, piod->value, piod->size);
552 return 0;
553 case PCI_PRIBUS_FREEBSD:
554 if(piod->size != 1) return -EINVAL;
555 break;
556 case PCI_IOBASE_0_FREEBSD:
557 if(piod->size != 2) return -EINVAL;
558 break;
559 case PCI_IOLIMIT_0_FREEBSD:
560 if(piod->size != 2) return -EINVAL;
561 break;
547 case SST1_PCI_SPECIAL1_FREEBSD:
548 if(piod->size != 4) return -EINVAL;
549 break;
550 case PCI_REVISION_ID_FREEBSD:
551 if(piod->size != 1) return -EINVAL;
552 break;
553 case SST1_PCI_SPECIAL4_FREEBSD:
554 if(piod->size != 4) return -EINVAL;

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

667 * applications expect the port to be of type short, so I needed to change
668 * this within the function */
669static int
670tdfx_do_pio_rd(struct tdfx_pio_data *piod)
671{
672 /* Return val */
673 u_int8_t ret_byte;
674 u_int workport;
562 case SST1_PCI_SPECIAL1_FREEBSD:
563 if(piod->size != 4) return -EINVAL;
564 break;
565 case PCI_REVISION_ID_FREEBSD:
566 if(piod->size != 1) return -EINVAL;
567 break;
568 case SST1_PCI_SPECIAL4_FREEBSD:
569 if(piod->size != 4) return -EINVAL;

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

682 * applications expect the port to be of type short, so I needed to change
683 * this within the function */
684static int
685tdfx_do_pio_rd(struct tdfx_pio_data *piod)
686{
687 /* Return val */
688 u_int8_t ret_byte;
689 u_int workport;
690 struct tdfx_softc *tdfx_info =
691 (struct tdfx_softc*)devclass_get_softc(tdfx_devclass, piod->device);
692
675 /* Restricts the access of ports other than those we use */
693 /* Restricts the access of ports other than those we use */
676 if((piod->port != VGA_INPUT_STATUS_1C) || (piod->port != SC_INDEX) ||
677 (piod->port != SC_DATA) || (piod->port != VGA_MISC_OUTPUT_READ))
694 if(((piod->port != VGA_INPUT_STATUS_1C) || (piod->port != SC_INDEX) ||
695 (piod->port != SC_DATA) || (piod->port != VGA_MISC_OUTPUT_READ)) &&
696 (piod->port < tdfx_info->pio0) && (piod->port > tdfx_info->pio0max))
678 return -EPERM;
679
680 /* All VGA STATUS REGS are byte registers, size should never be > 1 */
681 if(piod->size != 1) {
682 return -EINVAL;
683 }
684
685 /* Write the data to the intended port */

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

690}
691
692static int
693tdfx_do_pio_wt(struct tdfx_pio_data *piod)
694{
695 /* return val */
696 u_int8_t ret_byte;
697 u_int workport;
697 return -EPERM;
698
699 /* All VGA STATUS REGS are byte registers, size should never be > 1 */
700 if(piod->size != 1) {
701 return -EINVAL;
702 }
703
704 /* Write the data to the intended port */

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

709}
710
711static int
712tdfx_do_pio_wt(struct tdfx_pio_data *piod)
713{
714 /* return val */
715 u_int8_t ret_byte;
716 u_int workport;
717 struct tdfx_softc *tdfx_info = (struct
718 tdfx_softc*)devclass_get_softc(tdfx_devclass, piod->device);
698 /* Replace old switch w/ massive if(...) */
699 /* Restricts the access of ports other than those we use */
719 /* Replace old switch w/ massive if(...) */
720 /* Restricts the access of ports other than those we use */
700 if((piod->port != SC_INDEX) && (piod->port != SC_DATA) &&
701 (piod->port != VGA_MISC_OUTPUT_READ)) /* Can't write VGA_ST_1C */
721 if(((piod->port != SC_INDEX) && (piod->port != SC_DATA) &&
722 (piod->port != VGA_MISC_OUTPUT_READ)) /* Can't write VGA_ST_1C */ &&
723 (piod->port < tdfx_info->pio0) && (piod->port > tdfx_info->pio0max))
702 return -EPERM;
703
704 /* All VGA STATUS REGS are byte registers, size should never be > 1 */
705 if(piod->size != 1) {
706 return -EINVAL;
707 }
708
709 /* Write the data to the intended port */

--- 134 unchanged lines hidden ---
724 return -EPERM;
725
726 /* All VGA STATUS REGS are byte registers, size should never be > 1 */
727 if(piod->size != 1) {
728 return -EINVAL;
729 }
730
731 /* Write the data to the intended port */

--- 134 unchanged lines hidden ---