First import
[xorg_rtime.git] / xorg-server-1.4 / hw / xfree86 / common / xf86DoScanPci.c
blob0c6668a49d373bda226bcef8f0685e5d148a352c
1 /*
2 * Copyright (c) 1999-2002 by The XFree86 Project, Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
22 * Except as contained in this notice, the name of the copyright holder(s)
23 * and author(s) shall not be used in advertising or otherwise to promote
24 * the sale, use or other dealings in this Software without prior written
25 * authorization from the copyright holder(s) and author(s).
29 * Finish setting up the server.
30 * Call the functions from the scanpci module.
33 #ifdef HAVE_XORG_CONFIG_H
34 #include <xorg-config.h>
35 #endif
37 #include <ctype.h>
38 #include <stdlib.h>
39 #include <X11/X.h>
40 #include <X11/Xmd.h>
41 #include "os.h"
42 #include "loaderProcs.h"
43 #include "xf86.h"
44 #include "xf86Priv.h"
45 #include "xf86Pci.h"
46 #include "xf86ScanPci.h"
49 void DoScanPci(int argc, char **argv, int i)
51 int j,skip,globalVerbose,scanpciVerbose;
52 ScanPciSetupProcPtr PciSetup;
53 ScanPciDisplayCardInfoProcPtr DisplayPCICardInfo;
54 int errmaj, errmin;
57 * first we need to finish setup of the OS so that we can call other
58 * functions in the server
60 OsInit();
63 * The old verbosity processing that was here isn't useful anymore, but
64 * for compatibility purposes, ignore verbosity changes after the -scanpci
65 * flag.
67 globalVerbose = xf86Verbose;
70 * next we process the arguments that are remaining on the command line,
71 * so that things like the module path can be set there
73 for ( j = i+1; j < argc; j++ ) {
74 if ((skip = ddxProcessArgument(argc, argv, j)))
75 j += (skip - 1);
79 * Was the verbosity level increased? If so, set it back.
81 if (xf86Verbose > globalVerbose)
82 xf86SetVerbosity(globalVerbose);
85 * Setting scanpciVerbose to 0 will ensure that the output will go to
86 * stderr for all reasonable default stderr verbosity levels.
88 scanpciVerbose = 0;
91 * now get the loader set up and load the scanpci module
93 /* Initialise the loader */
94 LoaderInit();
95 /* Tell the loader the default module search path */
96 LoaderSetPath(xf86ModulePath);
98 if (!LoadModule("scanpci", NULL, NULL, NULL, NULL, NULL,
99 &errmaj, &errmin)) {
100 LoaderErrorMsg(NULL, "scanpci", errmaj, errmin);
101 exit(1);
103 PciSetup = (ScanPciSetupProcPtr)LoaderSymbol("ScanPciSetupPciIds");
104 DisplayPCICardInfo =
105 (ScanPciDisplayCardInfoProcPtr)LoaderSymbol("ScanPciDisplayPCICardInfo");
107 if (!(*PciSetup)())
108 FatalError("ScanPciSetupPciIds() failed\n");
109 (*DisplayPCICardInfo)(scanpciVerbose);
112 * That's it; we really should clean things up, but a simple
113 * exit seems to be all we need.
115 exit(0);