xref: /openbsd/sys/dev/cardbus/cardbus_exrom.h (revision fc61954a)
1 /*	$OpenBSD: cardbus_exrom.h,v 1.4 2013/06/20 09:52:09 mpi Exp $	*/
2 /*	$NetBSD: cardbus_exrom.h,v 1.2 1999/12/15 12:28:54 kleink Exp $	*/
3 
4 /*
5  * Copyright (c) 1999 The NetBSD Foundation, Inc.
6  * All rights reserved.
7  *
8  * This code is derived from software contributed to
9  * The NetBSD Foundation by Johan Danielsson.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  *
15  * 1. Redistributions of source code must retain the above copyright
16  *    notice, this list of conditions and the following disclaimer.
17  *
18  * 2. Redistributions in binary form must reproduce the above copyright
19  *    notice, this list of conditions and the following disclaimer in the
20  *    documentation and/or other materials provided with the distribution.
21  *
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
24  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
27  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  */
35 
36 #ifndef _DEV_CARDBUS_CARDBUS_EXROM_H_
37 #define _DEV_CARDBUS_CARDBUS_EXROM_H_
38 
39 /* PCI ROM header fields */
40 #define CARDBUS_EXROM_SIGNATURE	0x00
41 #define CARDBUS_EXROM_DATA_PTR	0x18
42 
43 /* PCI ROM data structure fields */
44 #define CARDBUS_EXROM_DATA_SIGNATURE	0x00 /* Signature ("PCIR") */
45 #define CARDBUS_EXROM_DATA_VENDOR_ID	0x04 /* Vendor Identification */
46 #define CARDBUS_EXROM_DATA_DEVICE_ID	0x06 /* Device Identification */
47 #define CARDBUS_EXROM_DATA_LENGTH	0x0a /* PCI Data Structure Length */
48 #define CARDBUS_EXROM_DATA_REV		0x0c /* PCI Data Structure Revision */
49 #define CARDBUS_EXROM_DATA_CLASS_CODE	0x0d /* Class Code */
50 #define CARDBUS_EXROM_DATA_IMAGE_LENGTH	0x10 /* Image Length */
51 #define CARDBUS_EXROM_DATA_DATA_REV	0x12 /* Revision Level of Code/Data */
52 #define CARDBUS_EXROM_DATA_CODE_TYPE	0x14 /* Code Type */
53 #define CARDBUS_EXROM_DATA_INDICATOR	0x15 /* Indicator */
54 
55 
56 struct cardbus_rom_image {
57 	unsigned int		rom_image;	/* image number */
58 	size_t			image_size;
59 	bus_space_tag_t		romt;
60 	bus_space_handle_t	romh;		/* subregion */
61 	SIMPLEQ_ENTRY(cardbus_rom_image) next;
62 };
63 
64 SIMPLEQ_HEAD(cardbus_rom_image_head, cardbus_rom_image);
65 
66 int	cardbus_read_exrom(bus_space_tag_t, bus_space_handle_t,
67 	    struct cardbus_rom_image_head *);
68 
69 #endif /* !_DEV_CARDBUS_CARDBUS_EXROM_H_ */
70