Use fewer magic constants related to the GCAP register.

This commit is contained in:
jakllsch 2010-08-03 04:02:21 +00:00
parent bbc746ce72
commit 0da82292a5
2 changed files with 13 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: hdaudio.c,v 1.5 2009/10/11 08:50:11 sborrill Exp $ */
/* $NetBSD: hdaudio.c,v 1.6 2010/08/03 04:02:21 jakllsch Exp $ */
/*
* Copyright (c) 2009 Precedence Technologies Ltd <support@precedence.co.uk>
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.5 2009/10/11 08:50:11 sborrill Exp $");
__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.6 2010/08/03 04:02:21 jakllsch Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -125,17 +125,17 @@ hdaudio_init(struct hdaudio_softc *sc)
#endif
gcap = hda_read2(sc, HDAUDIO_MMIO_GCAP);
nis = (gcap >> 8) & 0xf;
nos = (gcap >> 12) & 0xf;
nbidir = (gcap >> 3) & 0x1f;
nis = HDAUDIO_GCAP_ISS(gcap);
nos = HDAUDIO_GCAP_OSS(gcap);
nbidir = HDAUDIO_GCAP_BSS(gcap);
/* Initialize codecs and streams */
hdaudio_codec_init(sc);
hdaudio_stream_init(sc, nis, nos, nbidir);
#if defined(HDAUDIO_DEBUG)
nsdo = (gcap >> 1) & 1;
addr64 = gcap & 1;
nsdo = HDAUDIO_GCAP_NSDO(gcap);
addr64 = HDAUDIO_GCAP_64OK(gcap);
hda_print(sc, "OSS %d ISS %d BSS %d SDO %d%s\n",
nos, nis, nbidir, nsdo, addr64 ? " 64-bit" : "");

View File

@ -1,4 +1,4 @@
/* $NetBSD: hdaudioreg.h,v 1.3 2009/09/06 21:38:17 rmind Exp $ */
/* $NetBSD: hdaudioreg.h,v 1.4 2010/08/03 04:02:21 jakllsch Exp $ */
/*
* Copyright (c) 2009 Precedence Technologies Ltd <support@precedence.co.uk>
@ -44,6 +44,11 @@
* High Definition Audio Memory Mapped Configuration Registers
*/
#define HDAUDIO_MMIO_GCAP 0x000
#define HDAUDIO_GCAP_64OK(x) ((x) & 1)
#define HDAUDIO_GCAP_NSDO(x) ((((x) & 6) != 0) ? ((x) & 6) : 1)
#define HDAUDIO_GCAP_BSS(x) (((x) >> 3) & 0x1f)
#define HDAUDIO_GCAP_ISS(x) (((x) >> 8) & 0x0f)
#define HDAUDIO_GCAP_OSS(x) (((x) >> 12) & 0x0f)
#define HDAUDIO_MMIO_VMIN 0x002
#define HDAUDIO_MMIO_VMAJ 0x003
#define HDAUDIO_MMIO_OUTPAY 0x004