Deleted Added
full compact
via82c686.c (193640) via82c686.c (254263)
1/*-
2 * Copyright (c) 2000 David Jones <dej@ox.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

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

32#include <dev/sound/pcm/ac97.h>
33
34#include <dev/pci/pcireg.h>
35#include <dev/pci/pcivar.h>
36#include <sys/sysctl.h>
37
38#include <dev/sound/pci/via82c686.h>
39
1/*-
2 * Copyright (c) 2000 David Jones <dej@ox.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

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

32#include <dev/sound/pcm/ac97.h>
33
34#include <dev/pci/pcireg.h>
35#include <dev/pci/pcivar.h>
36#include <sys/sysctl.h>
37
38#include <dev/sound/pci/via82c686.h>
39
40SND_DECLARE_FILE("$FreeBSD: head/sys/dev/sound/pci/via82c686.c 193640 2009-06-07 19:12:08Z ariff $");
40SND_DECLARE_FILE("$FreeBSD: head/sys/dev/sound/pci/via82c686.c 254263 2013-08-12 23:30:01Z scottl $");
41
42#define VIA_PCI_ID 0x30581106
43#define NSEGS 4 /* Number of segments in SGD table */
44
45#define SEGS_PER_CHAN (NSEGS/2)
46
47#define TIMEOUT 50
48#define VIA_DEFAULT_BUFSZ 0x1000

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

480 struct via_info *via = 0;
481 char status[SND_STATUSLEN];
482 u_int32_t data, cnt;
483
484 via = malloc(sizeof(*via), M_DEVBUF, M_WAITOK | M_ZERO);
485 via->lock = snd_mtxcreate(device_get_nameunit(dev),
486 "snd_via82c686 softc");
487
41
42#define VIA_PCI_ID 0x30581106
43#define NSEGS 4 /* Number of segments in SGD table */
44
45#define SEGS_PER_CHAN (NSEGS/2)
46
47#define TIMEOUT 50
48#define VIA_DEFAULT_BUFSZ 0x1000

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

480 struct via_info *via = 0;
481 char status[SND_STATUSLEN];
482 u_int32_t data, cnt;
483
484 via = malloc(sizeof(*via), M_DEVBUF, M_WAITOK | M_ZERO);
485 via->lock = snd_mtxcreate(device_get_nameunit(dev),
486 "snd_via82c686 softc");
487
488 /* Get resources */
489 data = pci_read_config(dev, PCIR_COMMAND, 2);
490 data |= (PCIM_CMD_PORTEN | PCIM_CMD_BUSMASTEREN);
491 pci_write_config(dev, PCIR_COMMAND, data, 2);
492 data = pci_read_config(dev, PCIR_COMMAND, 2);
488 pci_enable_busmaster(dev);
493
494 /* Wake up and reset AC97 if necessary */
495 data = pci_read_config(dev, VIA_AC97STATUS, 1);
496
497 if ((data & VIA_AC97STATUS_RDY) == 0) {
498 /* Cold reset per ac97r2.3 spec (page 95) */
499 pci_write_config(dev, VIA_ACLINKCTRL, VIA_ACLINK_EN, 1); /* Assert low */
500 DELAY(100); /* Wait T_rst_low */

--- 160 unchanged lines hidden ---
489
490 /* Wake up and reset AC97 if necessary */
491 data = pci_read_config(dev, VIA_AC97STATUS, 1);
492
493 if ((data & VIA_AC97STATUS_RDY) == 0) {
494 /* Cold reset per ac97r2.3 spec (page 95) */
495 pci_write_config(dev, VIA_ACLINKCTRL, VIA_ACLINK_EN, 1); /* Assert low */
496 DELAY(100); /* Wait T_rst_low */

--- 160 unchanged lines hidden ---