1/*
2 * Copyright 2005-2008, Axel D��rfler, axeld@pinc-software.de. All rights reserved.
3 * Copyright 2003, Marcus Overhagen. All rights reserved.
4 *
5 * Distributed under the terms of the MIT License.
6 */
7
8
9#include <PCI.h>
10
11#include "pci_private.h"
12#include "pci_info.h"
13#include "pci.h"
14
15
16device_manager_info *gDeviceManager;
17extern struct pci_arch_module gPCIArchModule;
18
19static int32
20pci_old_module_std_ops(int32 op, ...)
21{
22	switch (op) {
23		case B_MODULE_INIT:
24		{
25			status_t status;
26
27			TRACE(("PCI: pci_module_init\n"));
28
29			status = pci_init();
30			if (status < B_OK)
31				return status;
32
33			pci_print_info();
34
35			return B_OK;
36		}
37
38		case B_MODULE_UNINIT:
39			TRACE(("PCI: pci_module_uninit\n"));
40			pci_uninit();
41			return B_OK;
42	}
43
44	return B_BAD_VALUE;
45}
46
47
48static struct pci_module_info sOldPCIModule = {
49	{
50		{
51			B_PCI_MODULE_NAME,
52			B_KEEP_LOADED,
53			pci_old_module_std_ops
54		},
55		NULL
56	},
57	&pci_read_io_8,
58	&pci_write_io_8,
59	&pci_read_io_16,
60	&pci_write_io_16,
61	&pci_read_io_32,
62	&pci_write_io_32,
63	&pci_get_nth_pci_info,
64	&pci_read_config,
65	&pci_write_config,
66	&pci_ram_address,
67	&pci_find_capability,
68	&pci_reserve_device,
69	&pci_unreserve_device,
70	&pci_update_interrupt_line
71};
72
73module_dependency module_dependencies[] = {
74	{B_DEVICE_MANAGER_MODULE_NAME, (module_info **)&gDeviceManager},
75	{}
76};
77
78driver_module_info gPCILegacyDriverModule = {
79	{
80		PCI_LEGACY_DRIVER_MODULE_NAME,
81		0,
82		NULL,
83	},
84	NULL
85};
86
87module_info *modules[] = {
88	(module_info *)&sOldPCIModule,
89	(module_info *)&gPCIRootModule,
90	(module_info *)&gPCIDeviceModule,
91	(module_info *)&gPCILegacyDriverModule,
92#if defined(__INTEL__) || defined(__x86_64__)
93	// add platforms when they provide an arch specific module
94	(module_info *)&gPCIArchModule,
95#endif
96	NULL
97};
98