1 /* $OpenBSD: cardbus_exrom.h,v 1.3 2005/09/12 18:52:49 fgsch 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 * 3. Neither the name of The NetBSD Foundation nor the names of its
23 * contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38
39 #ifndef _DEV_CARDBUS_CARDBUS_EXROM_H_
40 #define _DEV_CARDBUS_CARDBUS_EXROM_H_
41
42 /* PCI ROM header fields */
43 #define CARDBUS_EXROM_SIGNATURE 0x00
44 #define CARDBUS_EXROM_DATA_PTR 0x18
45
46 /* PCI ROM data structure fields */
47 #define CARDBUS_EXROM_DATA_SIGNATURE 0x00 /* Signature ("PCIR") */
48 #define CARDBUS_EXROM_DATA_VENDOR_ID 0x04 /* Vendor Identification */
49 #define CARDBUS_EXROM_DATA_DEVICE_ID 0x06 /* Device Identification */
50 #define CARDBUS_EXROM_DATA_LENGTH 0x0a /* PCI Data Structure Length */
51 #define CARDBUS_EXROM_DATA_REV 0x0c /* PCI Data Structure Revision */
52 #define CARDBUS_EXROM_DATA_CLASS_CODE 0x0d /* Class Code */
53 #define CARDBUS_EXROM_DATA_IMAGE_LENGTH 0x10 /* Image Length */
54 #define CARDBUS_EXROM_DATA_DATA_REV 0x12 /* Revision Level of Code/Data */
55 #define CARDBUS_EXROM_DATA_CODE_TYPE 0x14 /* Code Type */
56 #define CARDBUS_EXROM_DATA_INDICATOR 0x15 /* Indicator */
57
58
59 struct cardbus_rom_image {
60 unsigned int rom_image; /* image number */
61 size_t image_size;
62 bus_space_tag_t romt;
63 bus_space_handle_t romh; /* subregion */
64 SIMPLEQ_ENTRY(cardbus_rom_image) next;
65 };
66
67 SIMPLEQ_HEAD(cardbus_rom_image_head, cardbus_rom_image);
68
69 int cardbus_read_exrom(bus_space_tag_t, bus_space_handle_t,
70 struct cardbus_rom_image_head *);
71
72 #endif /* !_DEV_CARDBUS_CARDBUS_EXROM_H_ */