xref: /netbsd/sys/dev/cardbus/cardbusreg.h (revision c302bc74)
1 /*	$NetBSD: cardbusreg.h,v 1.8 2023/05/06 22:17:28 andvar Exp $ */
2 
3 /*
4  * Copyright (c) 2001
5  *       HAYAKAWA Koichi.  All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
20  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
24  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
25  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  * POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef _DEV_CARDBUS_CARDBUSREG_H_
30 #define _DEV_CARDBUS_CARDBUSREG_H_
31 
32 #include <dev/pci/pcivar.h>	/* for pcitag_t */
33 
34 /* Base Registers */
35 #define CARDBUS_CIS_REG    0x28
36 #define CARDBUS_ROM_REG	   0x30
37 #  define CARDBUS_CIS_ASIMASK 0x07
38 #    define CARDBUS_CIS_ASI(x) (CARDBUS_CIS_ASIMASK & (x))
39 #  define CARDBUS_CIS_ASI_TUPLE 0x00
40 #  define CARDBUS_CIS_ASI_BAR0  0x01
41 #  define CARDBUS_CIS_ASI_BAR1  0x02
42 #  define CARDBUS_CIS_ASI_BAR2  0x03
43 #  define CARDBUS_CIS_ASI_BAR3  0x04
44 #  define CARDBUS_CIS_ASI_BAR4  0x05
45 #  define CARDBUS_CIS_ASI_BAR5  0x06
46 #  define CARDBUS_CIS_ASI_ROM   0x07
47 #  define CARDBUS_CIS_ADDRMASK 0x0ffffff8
48 #    define CARDBUS_CIS_ADDR(x) (CARDBUS_CIS_ADDRMASK & (x))
49 #    define CARDBUS_CIS_ASI_BAR(x) (((CARDBUS_CIS_ASIMASK & (x))-1)*4+PCI_BAR0)
50 #    define CARDBUS_CIS_ASI_ROM_IMAGE(x) (((x) >> 28) & 0xf)
51 
52 #endif /* !_DEV_CARDBUS_CARDBUSREG_H_ */
53