View | Details | Raw Unified | Return to bug 32530 | Differences between
and this patch

Collapse All | Expand All

(-)sys/dev/sound/isa/emu8000.c (-19 / +28 lines)
Lines 1895-1924 Link Here
1895
static int
1895
static int
1896
emu_allocres(sc_p scp, device_t dev)
1896
emu_allocres(sc_p scp, device_t dev)
1897
{
1897
{
1898
	int iobase;
1898
	int i;
1899
1899
1900
	if (scp->io[0] == NULL) {
1900
	/*
1901
		scp->io_rid[0] = 0;
1901
	 * Attempt to allocate the EMU8000's three I/O port ranges.
1902
		scp->io[0] = bus_alloc_resource(dev, SYS_RES_IOPORT, &scp->io_rid[0], 0, ~0, 4, RF_ACTIVE);
1902
	 */
1903
	}
1903
	for (i = 0; i < 3; i++)
1904
	if (scp->io[0] == NULL)
1904
	{
1905
		return (1);
1905
		if (scp->io[i] == NULL)
1906
	iobase = rman_get_start(scp->io[0]);
1906
		{
1907
	if (scp->io[1] == NULL) {
1907
			scp->io_rid[i] = i;
1908
		scp->io_rid[1] = 1;
1908
			scp->io[i] = bus_alloc_resource(dev, SYS_RES_IOPORT,
1909
		scp->io[1] = bus_alloc_resource(dev, SYS_RES_IOPORT, &scp->io_rid[1], iobase + 0x400, iobase + 0x400 + 3, 4, RF_ACTIVE);
1909
							&(scp->io_rid[i]),
1910
	}
1910
							0, ~0, 4, RF_ACTIVE);
1911
	if (scp->io[2] == NULL) {
1911
		}
1912
		scp->io_rid[2] = 2;
1913
		scp->io[2] = bus_alloc_resource(dev, SYS_RES_IOPORT, &scp->io_rid[2], iobase + 0x800, iobase + 0x800 + 3, 4, RF_ACTIVE);
1914
	}
1912
	}
1915
1913
1916
	if (scp->io[0] == NULL || scp->io[1] == NULL || scp->io[2] == NULL) {
1914
	/*
1917
		printf("emu_allocres: failed.\n");
1915
	 * Fail if any of the I/O ranges failed (I.e. weren't identified and
1918
		return (1);
1916
	 * configured by PNP, which can happen if the ID of the card isn't
1917
	 * known by the PNP quirk-handling logic)
1918
	 */
1919
	if (scp->io[0] == NULL || scp->io[1] == NULL || scp->io[2] == NULL)
1920
	{
1921
		printf("emu%d: Resource alloc failed, pnp_quirks "
1922
		       "may need { 0x%08x, 0x%08x }\n",
1923
		       device_get_unit(dev),
1924
		       isa_get_vendorid(dev),
1925
		       isa_get_logicalid(dev));
1926
1927
		return 1;
1919
	}
1928
	}
1920
1929
1921
	return (0);
1930
	return 0;
1922
}
1931
}
1923
1932
1924
/* Releases resources. */
1933
/* Releases resources. */

Return to bug 32530