mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-11 17:04:19 +01:00
Make the bt isa driver work..
- fix cut/paste problem. :-) - don't forget to call isa_dmacascade() - reset the port after we release resources. That last one is a trap to watch out for.. The isa bus driver uses the same port/irq/mem/etc variables for the initial probe hints as it does for allocation/deallocation tracking. Releasing a resource clears the variable and then you loose the hint during attach.. (ouch!)
This commit is contained in:
parent
d6a592e099
commit
0f6bc47029
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=45796
@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: bt_isa.c,v 1.7 1999/04/06 21:15:18 phk Exp $
|
||||
* $Id: bt_isa.c,v 1.8 1999/04/18 15:50:35 peter Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -105,9 +105,9 @@ bt_isa_release_resources(device_t dev)
|
||||
if (bt->port)
|
||||
bus_release_resource(dev, SYS_RES_IOPORT, 0, bt->port);
|
||||
if (bt->irq)
|
||||
bus_release_resource(dev, SYS_RES_IOPORT, 0, bt->irq);
|
||||
bus_release_resource(dev, SYS_RES_IRQ, 0, bt->irq);
|
||||
if (bt->drq)
|
||||
bus_release_resource(dev, SYS_RES_IOPORT, 0, bt->drq);
|
||||
bus_release_resource(dev, SYS_RES_DRQ, 0, bt->drq);
|
||||
bt_free_softc(dev);
|
||||
}
|
||||
|
||||
@ -169,6 +169,7 @@ bt_isa_probe(device_t dev)
|
||||
|
||||
bt_isa_release_resources(dev);
|
||||
|
||||
isa_set_port(dev, ioport);
|
||||
isa_set_drq(dev, info.drq);
|
||||
isa_set_irq(dev, info.irq);
|
||||
|
||||
@ -188,7 +189,7 @@ bt_isa_attach(device_t dev)
|
||||
bus_dma_filter_t *filter;
|
||||
void *filter_arg;
|
||||
bus_addr_t lowaddr;
|
||||
int error;
|
||||
int error, drq;
|
||||
|
||||
/* Initialise softc */
|
||||
error = bt_isa_alloc_resources(dev);
|
||||
@ -197,6 +198,10 @@ bt_isa_attach(device_t dev)
|
||||
return error;
|
||||
}
|
||||
|
||||
/* Program the DMA channel for external control */
|
||||
if ((drq = isa_get_drq(dev)) != -1)
|
||||
isa_dmacascade(drq);
|
||||
|
||||
/* Allocate our parent dmatag */
|
||||
filter = NULL;
|
||||
filter_arg = NULL;
|
||||
@ -236,7 +241,8 @@ bt_isa_attach(device_t dev)
|
||||
return (ENOMEM);
|
||||
}
|
||||
|
||||
if (bt_init(dev)) {
|
||||
error = bt_init(dev);
|
||||
if (error) {
|
||||
bt_isa_release_resources(dev);
|
||||
return (ENOMEM);
|
||||
}
|
||||
|
@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: bt_isa.c,v 1.7 1999/04/06 21:15:18 phk Exp $
|
||||
* $Id: bt_isa.c,v 1.8 1999/04/18 15:50:35 peter Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -105,9 +105,9 @@ bt_isa_release_resources(device_t dev)
|
||||
if (bt->port)
|
||||
bus_release_resource(dev, SYS_RES_IOPORT, 0, bt->port);
|
||||
if (bt->irq)
|
||||
bus_release_resource(dev, SYS_RES_IOPORT, 0, bt->irq);
|
||||
bus_release_resource(dev, SYS_RES_IRQ, 0, bt->irq);
|
||||
if (bt->drq)
|
||||
bus_release_resource(dev, SYS_RES_IOPORT, 0, bt->drq);
|
||||
bus_release_resource(dev, SYS_RES_DRQ, 0, bt->drq);
|
||||
bt_free_softc(dev);
|
||||
}
|
||||
|
||||
@ -169,6 +169,7 @@ bt_isa_probe(device_t dev)
|
||||
|
||||
bt_isa_release_resources(dev);
|
||||
|
||||
isa_set_port(dev, ioport);
|
||||
isa_set_drq(dev, info.drq);
|
||||
isa_set_irq(dev, info.irq);
|
||||
|
||||
@ -188,7 +189,7 @@ bt_isa_attach(device_t dev)
|
||||
bus_dma_filter_t *filter;
|
||||
void *filter_arg;
|
||||
bus_addr_t lowaddr;
|
||||
int error;
|
||||
int error, drq;
|
||||
|
||||
/* Initialise softc */
|
||||
error = bt_isa_alloc_resources(dev);
|
||||
@ -197,6 +198,10 @@ bt_isa_attach(device_t dev)
|
||||
return error;
|
||||
}
|
||||
|
||||
/* Program the DMA channel for external control */
|
||||
if ((drq = isa_get_drq(dev)) != -1)
|
||||
isa_dmacascade(drq);
|
||||
|
||||
/* Allocate our parent dmatag */
|
||||
filter = NULL;
|
||||
filter_arg = NULL;
|
||||
@ -236,7 +241,8 @@ bt_isa_attach(device_t dev)
|
||||
return (ENOMEM);
|
||||
}
|
||||
|
||||
if (bt_init(dev)) {
|
||||
error = bt_init(dev);
|
||||
if (error) {
|
||||
bt_isa_release_resources(dev);
|
||||
return (ENOMEM);
|
||||
}
|
||||
|
@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: bt_isa.c,v 1.7 1999/04/06 21:15:18 phk Exp $
|
||||
* $Id: bt_isa.c,v 1.8 1999/04/18 15:50:35 peter Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -105,9 +105,9 @@ bt_isa_release_resources(device_t dev)
|
||||
if (bt->port)
|
||||
bus_release_resource(dev, SYS_RES_IOPORT, 0, bt->port);
|
||||
if (bt->irq)
|
||||
bus_release_resource(dev, SYS_RES_IOPORT, 0, bt->irq);
|
||||
bus_release_resource(dev, SYS_RES_IRQ, 0, bt->irq);
|
||||
if (bt->drq)
|
||||
bus_release_resource(dev, SYS_RES_IOPORT, 0, bt->drq);
|
||||
bus_release_resource(dev, SYS_RES_DRQ, 0, bt->drq);
|
||||
bt_free_softc(dev);
|
||||
}
|
||||
|
||||
@ -169,6 +169,7 @@ bt_isa_probe(device_t dev)
|
||||
|
||||
bt_isa_release_resources(dev);
|
||||
|
||||
isa_set_port(dev, ioport);
|
||||
isa_set_drq(dev, info.drq);
|
||||
isa_set_irq(dev, info.irq);
|
||||
|
||||
@ -188,7 +189,7 @@ bt_isa_attach(device_t dev)
|
||||
bus_dma_filter_t *filter;
|
||||
void *filter_arg;
|
||||
bus_addr_t lowaddr;
|
||||
int error;
|
||||
int error, drq;
|
||||
|
||||
/* Initialise softc */
|
||||
error = bt_isa_alloc_resources(dev);
|
||||
@ -197,6 +198,10 @@ bt_isa_attach(device_t dev)
|
||||
return error;
|
||||
}
|
||||
|
||||
/* Program the DMA channel for external control */
|
||||
if ((drq = isa_get_drq(dev)) != -1)
|
||||
isa_dmacascade(drq);
|
||||
|
||||
/* Allocate our parent dmatag */
|
||||
filter = NULL;
|
||||
filter_arg = NULL;
|
||||
@ -236,7 +241,8 @@ bt_isa_attach(device_t dev)
|
||||
return (ENOMEM);
|
||||
}
|
||||
|
||||
if (bt_init(dev)) {
|
||||
error = bt_init(dev);
|
||||
if (error) {
|
||||
bt_isa_release_resources(dev);
|
||||
return (ENOMEM);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user