Add support for 2.x/3.x firmware adapters which are too old to have a

memory-mapped register window.  This closes the last known issue with
2.x vintage adapters.
This commit is contained in:
Mike Smith 2000-08-04 06:52:00 +00:00
parent cd79a42a80
commit 786cd128a8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=64223
2 changed files with 9 additions and 2 deletions

View File

@ -43,6 +43,8 @@
#include <sys/stat.h>
#include <machine/resource.h>
#include <machine/bus_memio.h>
#include <machine/bus_pio.h>
#include <machine/bus.h>
#include <machine/clock.h>
#include <sys/rman.h>

View File

@ -157,18 +157,23 @@ mlx_pci_attach(device_t dev)
* Allocate the PCI register window.
*/
/* type 2/3 adapters have an I/O region we don't use at base 0 */
/* type 2/3 adapters have an I/O region we don't prefer at base 0 */
switch(sc->mlx_iftype) {
case MLX_IFTYPE_2:
case MLX_IFTYPE_3:
rid = MLX_CFG_BASE1;
sc->mlx_mem = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, 0, ~0, 1, RF_ACTIVE);
if (sc->mlx_mem == NULL) {
rid = MLX_CFG_BASE0;
sc->mlx_mem = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, 1, RF_ACTIVE);
}
break;
case MLX_IFTYPE_4:
case MLX_IFTYPE_5:
rid = MLX_CFG_BASE0;
sc->mlx_mem = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, 0, ~0, 1, RF_ACTIVE);
break;
}
sc->mlx_mem = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, 0, ~0, 1, RF_ACTIVE);
if (sc->mlx_mem == NULL) {
device_printf(sc->mlx_dev, "couldn't allocate mailbox window\n");
mlx_free(sc);