1/*
2 * Copyright 2008, Haiku Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef _PCI2_H
6#define _PCI2_H
7
8
9#include <device_manager.h>
10#include <PCI.h>
11
12
13typedef struct pci_device pci_device;
14
15typedef struct pci_device_module_info {
16	driver_module_info info;
17
18	uint8	(*read_io_8)(pci_device *device, addr_t mappedIOAddress);
19	void	(*write_io_8)(pci_device *device, addr_t mappedIOAddress,
20				uint8 value);
21	uint16	(*read_io_16)(pci_device *device, addr_t mappedIOAddress);
22	void	(*write_io_16)(pci_device *device, addr_t mappedIOAddress,
23				uint16 value);
24	uint32	(*read_io_32)(pci_device *device, addr_t mappedIOAddress);
25	void	(*write_io_32)(pci_device *device, addr_t mappedIOAddress,
26				uint32 value);
27
28	void	*(*ram_address)(pci_device *device, const void *physicalAddress);
29
30	uint32	(*read_pci_config)(pci_device *device, uint8 offset,
31				uint8 size);
32	void	(*write_pci_config)(pci_device *device, uint8 offset,
33				uint8 size, uint32 value);
34	status_t (*find_pci_capability)(pci_device *device, uint8 capID,
35				uint8 *offset);
36	void 	(*get_pci_info)(pci_device *device, struct pci_info *info);
37} pci_device_module_info;
38
39
40/* Attributes of PCI device nodes */
41#define B_PCI_DEVICE_DOMAIN		"pci/domain"		/* uint32 */
42#define B_PCI_DEVICE_BUS		"pci/bus"			/* uint8 */
43#define B_PCI_DEVICE_DEVICE		"pci/device"		/* uint8 */
44#define B_PCI_DEVICE_FUNCTION	"pci/function"		/* uint8 */
45
46#endif	/* _PCI2_H */
47