]> git.pld-linux.org Git - packages/kernel.git/blob - 2.6.1-serial_updates-lkml.patch
- obsolete
[packages/kernel.git] / 2.6.1-serial_updates-lkml.patch
1 diff -Nru a/drivers/serial/8250_acpi.c b/drivers/serial/8250_acpi.c
2 --- a/drivers/serial/8250_acpi.c        Fri Jan 16 22:06:23 2004
3 +++ b/drivers/serial/8250_acpi.c        Fri Jan 16 22:06:23 2004
4 @@ -1,6 +1,7 @@
5  /*
6 - * serial/acpi.c
7   * Copyright (c) 2002-2003 Matthew Wilcox for Hewlett-Packard
8 + * Copyright (C) 2004 Hewlett-Packard Co
9 + *     Bjorn Helgaas <bjorn.helgaas@hp.com>
10   *
11   * This program is free software; you can redistribute it and/or modify
12   * it under the terms of the GNU General Public License as published by
13 @@ -11,13 +12,21 @@
14  #include <linux/acpi.h>
15  #include <linux/init.h>
16  #include <linux/module.h>
17 +#include <linux/tty.h>
18  #include <linux/serial.h>
19 +#include <linux/tty.h>
20 +#include <linux/serial_core.h>
21  
22  #include <acpi/acpi_bus.h>
23  
24  #include <asm/io.h>
25  #include <asm/serial.h>
26  
27 +struct serial_private {
28 +       int     line;
29 +       void    *iomem_base;
30 +};
31 +
32  static acpi_status acpi_serial_mmio(struct serial_struct *req,
33                                     struct acpi_resource_address64 *addr)
34  {
35 @@ -94,38 +103,72 @@
36  
37  static int acpi_serial_add(struct acpi_device *device)
38  {
39 +       struct serial_private *priv;
40         acpi_status status;
41         struct serial_struct serial_req;
42 -       int line;
43 +       int result;
44  
45         memset(&serial_req, 0, sizeof(serial_req));
46  
47 +       priv = kmalloc(sizeof(struct serial_private), GFP_KERNEL);
48 +       if (!priv) {
49 +               result = -ENOMEM;
50 +               goto fail;
51 +       }
52 +       memset(priv, 0, sizeof(*priv));
53 +
54         status = acpi_walk_resources(device->handle, METHOD_NAME__CRS,
55                                      acpi_serial_resource, &serial_req);
56 -       if (ACPI_FAILURE(status))
57 -               return -ENODEV;
58 +       if (ACPI_FAILURE(status)) {
59 +               result = -ENODEV;
60 +               goto fail;
61 +       }
62  
63 -       if (!serial_req.iomem_base && !serial_req.port) {
64 +       if (serial_req.iomem_base)
65 +               priv->iomem_base = serial_req.iomem_base;
66 +       else if (!serial_req.port) {
67                 printk(KERN_ERR "%s: no iomem or port address in %s _CRS\n",
68                         __FUNCTION__, device->pnp.bus_id);
69 -               return -ENODEV;
70 +               result = -ENODEV;
71 +               goto fail;
72         }
73  
74         serial_req.baud_base = BASE_BAUD;
75 -       serial_req.flags = ASYNC_SKIP_TEST|ASYNC_BOOT_AUTOCONF|ASYNC_AUTO_IRQ;
76 +       serial_req.flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF |
77 +                          UPF_AUTO_IRQ  | UPF_RESOURCES;
78  
79 -       line = register_serial(&serial_req);
80 -       if (line < 0) {
81 -               printk(KERN_WARNING "Couldn't register serial port %s: %d",
82 -                       device->pnp.bus_id, line);
83 -               return -ENODEV;
84 +       priv->line = register_serial(&serial_req);
85 +       if (priv->line < 0) {
86 +               printk(KERN_WARNING "Couldn't register serial port %s: %d\n",
87 +                       device->pnp.bus_id, priv->line);
88 +               result = -ENODEV;
89 +               goto fail;
90         }
91  
92 +       acpi_driver_data(device) = priv;
93         return 0;
94 +
95 +fail:
96 +       if (serial_req.iomem_base)
97 +               iounmap(serial_req.iomem_base);
98 +       kfree(priv);
99 +
100 +       return result;
101  }
102  
103  static int acpi_serial_remove(struct acpi_device *device, int type)
104  {
105 +       struct serial_private *priv;
106 +
107 +       if (!device || !acpi_driver_data(device))
108 +               return -EINVAL;
109 +
110 +       priv = acpi_driver_data(device);
111 +       unregister_serial(priv->line);
112 +       if (priv->iomem_base)
113 +               iounmap(priv->iomem_base);
114 +       kfree(priv);
115 +
116         return 0;
117  }
118  
119 diff -Nru a/drivers/serial/8250_hcdp.c b/drivers/serial/8250_hcdp.c
120 --- a/drivers/serial/8250_hcdp.c        Fri Jan 16 22:06:23 2004
121 +++ b/drivers/serial/8250_hcdp.c        Fri Jan 16 22:06:23 2004
122 @@ -185,7 +185,7 @@
123  #else
124                 port.irq = gsi;
125  #endif
126 -               port.flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF;
127 +               port.flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF | UPF_RESOURCES;
128                 if (gsi)
129                         port.flags |= ASYNC_AUTO_IRQ;
130  
131 diff -Nru a/drivers/serial/Kconfig b/drivers/serial/Kconfig
132 --- a/drivers/serial/Kconfig    Fri Jan 16 22:06:23 2004
133 +++ b/drivers/serial/Kconfig    Fri Jan 16 22:06:23 2004
134 @@ -62,6 +62,15 @@
135  
136           If unsure, say N.
137  
138 +config SERIAL_8250_HCDP
139 +       bool "Console device discovery via EFI HCDP table"
140 +       depends on IA64
141 +       depends on SERIAL_8250_CONSOLE=y
142 +       ---help---
143 +         If you wish to make the serial console port described by the EFI
144 +         HCDP table available for use as serial console, say Y here.  See
145 +         <http://www.dig64.org/specifications/DIG64_HCDPv10a_01.pdf>.
146 +
147  config SERIAL_8250_CS
148         tristate "8250/16550 PCMCIA device support"
149         depends on PCMCIA && SERIAL_8250
150 @@ -83,15 +92,6 @@
151         ---help---
152           If you wish to enable serial port discovery via the ACPI
153           namespace, say Y here.  If unsure, say N.
154 -
155 -config SERIAL_8250_HCDP
156 -       bool "8250/16550 device discovery support via EFI HCDP table"
157 -       depends on IA64 && SERIAL_8250
158 -       ---help---
159 -         If you wish to make the serial console port described by the EFI
160 -         HCDP table available for use as serial console or general
161 -         purpose port, say Y here. See
162 -         <http://www.dig64.org/specifications/DIG64_HCDPv10a_01.pdf>.
163  
164  config SERIAL_8250_NR_UARTS
165         int "Maximum number of non-legacy 8250/16550 serial ports"
This page took 0.056648 seconds and 3 git commands to generate.