Deleted Added
full compact
fm801.c (227843) fm801.c (254263)
1/*-
2 * Copyright (c) 2000 Dmitry Dicky diwil@dataart.com
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

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

28#include "opt_snd.h"
29#endif
30
31#include <dev/sound/pcm/sound.h>
32#include <dev/sound/pcm/ac97.h>
33#include <dev/pci/pcireg.h>
34#include <dev/pci/pcivar.h>
35
1/*-
2 * Copyright (c) 2000 Dmitry Dicky diwil@dataart.com
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

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

28#include "opt_snd.h"
29#endif
30
31#include <dev/sound/pcm/sound.h>
32#include <dev/sound/pcm/ac97.h>
33#include <dev/pci/pcireg.h>
34#include <dev/pci/pcivar.h>
35
36SND_DECLARE_FILE("$FreeBSD: head/sys/dev/sound/pci/fm801.c 227843 2011-11-22 21:28:20Z marius $");
36SND_DECLARE_FILE("$FreeBSD: head/sys/dev/sound/pci/fm801.c 254263 2013-08-12 23:30:01Z scottl $");
37
38#define PCI_VENDOR_FORTEMEDIA 0x1319
39#define PCI_DEVICE_FORTEMEDIA1 0x08011319 /* Audio controller */
40#define PCI_DEVICE_FORTEMEDIA2 0x08021319 /* Joystick controller */
41
42#define FM_PCM_VOLUME 0x00
43#define FM_FM_VOLUME 0x02
44#define FM_I2S_VOLUME 0x04

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

568
569 DPRINT("FM801 init Ok\n");
570 return 0;
571}
572
573static int
574fm801_pci_attach(device_t dev)
575{
37
38#define PCI_VENDOR_FORTEMEDIA 0x1319
39#define PCI_DEVICE_FORTEMEDIA1 0x08011319 /* Audio controller */
40#define PCI_DEVICE_FORTEMEDIA2 0x08021319 /* Joystick controller */
41
42#define FM_PCM_VOLUME 0x00
43#define FM_FM_VOLUME 0x02
44#define FM_I2S_VOLUME 0x04

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

568
569 DPRINT("FM801 init Ok\n");
570 return 0;
571}
572
573static int
574fm801_pci_attach(device_t dev)
575{
576 u_int32_t data;
577 struct ac97_info *codec = 0;
578 struct fm801_info *fm801;
579 int i;
580 int mapped = 0;
581 char status[SND_STATUSLEN];
582
583 fm801 = malloc(sizeof(*fm801), M_DEVBUF, M_WAITOK | M_ZERO);
584 fm801->type = pci_get_devid(dev);
585
576 struct ac97_info *codec = 0;
577 struct fm801_info *fm801;
578 int i;
579 int mapped = 0;
580 char status[SND_STATUSLEN];
581
582 fm801 = malloc(sizeof(*fm801), M_DEVBUF, M_WAITOK | M_ZERO);
583 fm801->type = pci_get_devid(dev);
584
586 data = pci_read_config(dev, PCIR_COMMAND, 2);
587 data |= (PCIM_CMD_PORTEN|PCIM_CMD_MEMEN|PCIM_CMD_BUSMASTEREN);
588 pci_write_config(dev, PCIR_COMMAND, data, 2);
589 data = pci_read_config(dev, PCIR_COMMAND, 2);
585 pci_enable_busmaster(dev);
590
591 for (i = 0; (mapped == 0) && (i < PCI_MAXMAPS_0); i++) {
592 fm801->regid = PCIR_BAR(i);
593 fm801->regtype = SYS_RES_MEMORY;
594 fm801->reg = bus_alloc_resource_any(dev, fm801->regtype,
595 &fm801->regid, RF_ACTIVE);
596 if(!fm801->reg)
597 {

--- 171 unchanged lines hidden ---
586
587 for (i = 0; (mapped == 0) && (i < PCI_MAXMAPS_0); i++) {
588 fm801->regid = PCIR_BAR(i);
589 fm801->regtype = SYS_RES_MEMORY;
590 fm801->reg = bus_alloc_resource_any(dev, fm801->regtype,
591 &fm801->regid, RF_ACTIVE);
592 if(!fm801->reg)
593 {

--- 171 unchanged lines hidden ---