FreeBSD/Linux Kernel Cross Reference
sys/pci/wdc_p.c
1 /*
2 *
3 * Copyright (c) 1996 Wolfgang Helbig <helbig@ba-stuttgart.de>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice immediately at the beginning of the file, without modification,
11 * this list of conditions, and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Absolutely no warranty of function or purpose is made by the author.
16 * 4. Modifications may be freely made to this file if the above conditions
17 * are met.
18 *
19 * $FreeBSD$
20 */
21
22 /*
23 * The sole purpose of this code currently is to tell the ISA wdc driver,
24 * whether there is a CMD640 IDE chip attached to the PCI bus.
25 */
26
27 #include "pci.h"
28 #if NPCI > 0
29 #include "opt_wd.h"
30 #ifdef CMD640
31
32 #include <sys/param.h>
33 #include <sys/kernel.h>
34 #include <pci/pcireg.h>
35 #include <pci/pcivar.h>
36 #include <i386/isa/wdc_p.h>
37
38 /*
39 * PCI-ID's of IDE-Controller
40 */
41
42 #define CMD640B_PCI_ID 0x06401095
43
44 static const char* wdc_pci_probe __P((pcici_t tag, pcidi_t type));
45 static void wdc_pci_attach __P((pcici_t config_id, int unit));
46
47 static u_long wdc_pci_count = 0;
48
49 static struct pci_device wdc_pci_driver = {
50 "wdc",
51 wdc_pci_probe,
52 wdc_pci_attach,
53 &wdc_pci_count,
54 NULL
55 };
56
57 DATA_SET (pcidevice_set, wdc_pci_driver);
58
59 static const char*
60 wdc_pci_probe (pcici_t tag, pcidi_t type)
61 {
62 if (type == CMD640B_PCI_ID)
63 return "CMD 640B IDE";
64
65 return NULL;
66 }
67
68 static void
69 wdc_pci_attach(pcici_t config_id, int unit)
70 {
71 if (pci_conf_read(config_id, PCI_ID_REG) == CMD640B_PCI_ID)
72 wdc_pci(Q_CMD640B);
73 }
74
75 #endif /* CMD640 */
76 #endif /* NPCI > 0 */
Cache object: 82d4262cec5e387b40ec2a6f8bf810ed
|