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