Date: Tue, 31 Jul 2007 14:00:03 GMT From: Christopher Davis <loafier@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 124421 for review Message-ID: <200707311400.l6VE03TN044772@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=124421 Change 124421 by loafier@chrisdsoc on 2007/07/31 13:59:50 Update read & write Affected files ... .. //depot/projects/soc2007/loafier_busalloc/src/sys/dev/sound/pci/als4000.c#2 edit Differences ... ==== //depot/projects/soc2007/loafier_busalloc/src/sys/dev/sound/pci/als4000.c#2 (text+ko) ==== @@ -69,8 +69,6 @@ struct sc_info { device_t dev; - bus_space_tag_t st; - bus_space_handle_t sh; bus_dma_tag_t parent_dmat; struct resource *reg, *irq; int regid, irqid; @@ -103,41 +101,41 @@ static u_int32_t als_gcr_rd(struct sc_info *sc, int index) { - bus_space_write_1(sc->st, sc->sh, ALS_GCR_INDEX, index); - return bus_space_read_4(sc->st, sc->sh, ALS_GCR_DATA); + bus_write_1(sc->reg, ALS_GCR_INDEX, index); + return bus_read_4(sc->reg, ALS_GCR_DATA); } static void als_gcr_wr(struct sc_info *sc, int index, int data) { - bus_space_write_1(sc->st, sc->sh, ALS_GCR_INDEX, index); - bus_space_write_4(sc->st, sc->sh, ALS_GCR_DATA, data); + bus_write_1(sc->reg, ALS_GCR_INDEX, index); + bus_write_4(sc->reg, ALS_GCR_DATA, data); } static u_int8_t als_intr_rd(struct sc_info *sc) { - return bus_space_read_1(sc->st, sc->sh, ALS_SB_MPU_IRQ); + return bus_read_1(sc->reg, ALS_SB_MPU_IRQ); } static void als_intr_wr(struct sc_info *sc, u_int8_t data) { - bus_space_write_1(sc->st, sc->sh, ALS_SB_MPU_IRQ, data); + bus_write_1(sc->reg, ALS_SB_MPU_IRQ, data); } static u_int8_t als_mix_rd(struct sc_info *sc, u_int8_t index) { - bus_space_write_1(sc->st, sc->sh, ALS_MIXER_INDEX, index); - return bus_space_read_1(sc->st, sc->sh, ALS_MIXER_DATA); + bus_write_1(sc->reg, ALS_MIXER_INDEX, index); + return bus_read_1(sc->reg, ALS_MIXER_DATA); } static void als_mix_wr(struct sc_info *sc, u_int8_t index, u_int8_t data) { - bus_space_write_1(sc->st, sc->sh, ALS_MIXER_INDEX, index); - bus_space_write_1(sc->st, sc->sh, ALS_MIXER_DATA, data); + bus_write_1(sc->reg, ALS_MIXER_INDEX, index); + bus_write_1(sc->reg, ALS_MIXER_DATA, data); } static void @@ -147,7 +145,7 @@ tries = 1000; do { - v = bus_space_read_1(sc->st, sc->sh, ALS_ESP_WR_STATUS); + v = bus_read_1(sc->reg, ALS_ESP_WR_STATUS); if (~v & 0x80) break; DELAY(20); @@ -156,7 +154,7 @@ if (tries == 0) device_printf(sc->dev, "als_esp_wr timeout"); - bus_space_write_1(sc->st, sc->sh, ALS_ESP_WR_DATA, data); + bus_write_1(sc->reg, ALS_ESP_WR_DATA, data); } static int @@ -164,16 +162,16 @@ { u_int32_t tries, u, v; - bus_space_write_1(sc->st, sc->sh, ALS_ESP_RST, 1); + bus_write_1(sc->reg, ALS_ESP_RST, 1); DELAY(10); - bus_space_write_1(sc->st, sc->sh, ALS_ESP_RST, 0); + bus_write_1(sc->reg, ALS_ESP_RST, 0); DELAY(30); tries = 1000; do { - u = bus_space_read_1(sc->st, sc->sh, ALS_ESP_RD_STATUS8); + u = bus_read_1(sc->reg, ALS_ESP_RD_STATUS8); if (u & 0x80) { - v = bus_space_read_1(sc->st, sc->sh, ALS_ESP_RD_DATA); + v = bus_read_1(sc->reg, ALS_ESP_RD_DATA); if (v == 0xaa) return 0; else @@ -190,7 +188,7 @@ static u_int8_t als_ack_read(struct sc_info *sc, u_int8_t addr) { - u_int8_t r = bus_space_read_1(sc->st, sc->sh, addr); + u_int8_t r = bus_read_1(sc->reg, addr); return r; } @@ -762,8 +760,6 @@ device_printf(dev, "unable to allocate register space\n"); goto bad; } - sc->st = rman_get_bustag(sc->reg); - sc->sh = rman_get_bushandle(sc->reg); sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->irqid, RF_ACTIVE | RF_SHAREABLE); @@ -809,9 +805,9 @@ sc->lock = snd_mtxcreate(device_get_nameunit(dev), "snd_als4000 softc"); sc->dev = dev; - data = pci_read_config(dev, PCIR_COMMAND, 2); - data |= (PCIM_CMD_PORTEN | PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN); - pci_write_config(dev, PCIR_COMMAND, data, 2); + pci_enable_busmaster(dev); + pci_enable_io(dev, SYS_RES_IOPORT); + /* * By default the power to the various components on the * ALS4000 is entirely controlled by the pci powerstate. We
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200707311400.l6VE03TN044772>