Warning, cross-references for /kernel/drivers/serial/mcs9922.c need to be fixed.
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #include "drivers/pci/pci.h"
0021 #include "arch/i386.h"
0022 #include "arch/i386-percpu.h"
0023 #include "util/printf.h"
0024 #include "mem/physical.h"
0025 #include "mem/virtual.h"
0026 #include "kernel.h"
0027
0028 #define MCS9922_VID 0x9710
0029 #define MCS9922_DID 0x9922
0030
0031 #define DEBUG_MCS9922
0032
0033 #ifdef DEBUG_MCS9922
0034 #define DLOG(fmt,...) DLOG_PREFIX("MCS9922",fmt,##__VA_ARGS__)
0035 #else
0036 #define DLOG(fmt,...) ;
0037 #endif
0038
0039 uint16 serial_port1 = 0x03F8;
0040
0041
0042 extern void initialize_serial_port (void);
0043
0044 bool
0045 mcs9922_init (void)
0046 {
0047 uint device_index, port_num;
0048
0049 if (!pci_find_device (MCS9922_VID, MCS9922_DID, 0xFF, 0xFF, 0, &device_index)) {
0050 return FALSE;
0051 }
0052
0053 if (device_index == (uint)(~0)) {
0054 DLOG ("Unable to detect compatible device.");
0055 return FALSE;
0056 }
0057
0058 if (pci_decode_bar (device_index, 0, NULL, &port_num, NULL)) {
0059 serial_port1 = port_num;
0060 DLOG ("Found Port Number: 0x%X", serial_port1);
0061 initialize_serial_port ();
0062 return TRUE;
0063 } else {
0064 DLOG ("Bar decoding failed!");
0065 return FALSE;
0066 }
0067 }
0068
0069 #include "module/header.h"
0070
0071 static const struct module_ops mod_ops = {
0072 .init = mcs9922_init
0073 };
0074
0075 DEF_MODULE (serial___mcs9922, "MosChip 9922 PCI-E serial card driver", &mod_ops, {"pci"});
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086