.put = serial_hw_put
};
-const char *
+struct grub_serial_port *
grub_arcserial_add_port (const char *path)
{
struct grub_serial_port *port;
grub_serial_register (port);
- return port->name;
+ return port;
}
static int
return 0;
}
-static const char *
+static struct grub_serial_port *
add_port (struct ofserial_hash_ent *ent)
{
struct grub_serial_port *port;
grub_serial_register (port);
- return port->name;
+ return port;
}
-const char *
+const struct grub_serial_port *
grub_ofserial_add_port (const char *path)
{
struct ofserial_hash_ent *ent;
#include <grub/dl.h>
#include <grub/acpi.h>
-char *
+struct grub_serial_port *
grub_ns8250_spcr_init (void)
{
struct grub_acpi_spcr *spcr;
return 0;
}
-char *
+struct grub_serial_port *
grub_serial_ns8250_add_port (grub_port_t port, struct grub_serial_config *config)
{
struct grub_serial_port *p;
/* Give the opportunity for SPCR to configure a default com port. */
if (config != NULL)
grub_serial_port_configure (&com_ports[i], config);
- return com_names[i];
+ return &com_ports[i];
}
grub_outb (0x5a, port + UART_SR);
grub_serial_config_defaults (p);
grub_serial_register (p);
- return p->name;
+ return p;
}
-char *
+struct grub_serial_port *
grub_serial_ns8250_add_mmio (grub_addr_t addr, unsigned int acc_size,
struct grub_serial_config *config)
{
{
if (config != NULL)
grub_serial_port_configure (&com_ports[i], config);
- return com_names[i];
+ return &com_ports[i];
}
p = grub_malloc (sizeof (*p));
grub_serial_config_defaults (p);
grub_serial_register (p);
- return p->name;
+ return p;
}
if (!port && grub_strncmp (name, "port", sizeof ("port") - 1) == 0
&& grub_isxdigit (name [sizeof ("port") - 1]))
{
- name = grub_serial_ns8250_add_port (grub_strtoul (&name[sizeof ("port") - 1],
+ port = grub_serial_ns8250_add_port (grub_strtoul (&name[sizeof ("port") - 1],
0, 16), NULL);
- if (name == NULL)
+ if (port == NULL)
return NULL;
-
- FOR_SERIAL_PORTS (port)
- if (grub_strcmp (port->name, name) == 0)
- break;
}
if (!port && grub_strncmp (name, "mmio,", sizeof ("mmio,") - 1) == 0
&& grub_isxdigit (name [sizeof ("mmio,") - 1]))
break;
}
- name = grub_serial_ns8250_add_mmio (addr, acc_size, NULL);
- if (name == NULL)
+ port = grub_serial_ns8250_add_mmio (addr, acc_size, NULL);
+ if (port == NULL)
return NULL;
-
- FOR_SERIAL_PORTS (port)
- if (grub_strcmp (port->name, name) == 0) {
- break;
- }
}
#if (defined(__i386__) || defined(__x86_64__)) && !defined(GRUB_MACHINE_IEEE1275) && !defined(GRUB_MACHINE_QEMU)
if (!port && grub_strcmp (name, "auto") == 0)
{
/* Look for an SPCR if any. If not, default to com0. */
- name = grub_ns8250_spcr_init ();
- if (name == NULL)
- name = "com0";
-
- FOR_SERIAL_PORTS (port)
- if (grub_strcmp (port->name, name) == 0)
- break;
+ port = grub_ns8250_spcr_init ();
+ if (port == NULL)
+ {
+ FOR_SERIAL_PORTS (port)
+ if (grub_strcmp (port->name, "com0") == 0)
+ break;
+ }
}
#endif
#endif
#ifdef GRUB_MACHINE_IEEE1275
if (!port && grub_strncmp (name, "ieee1275/", sizeof ("ieee1275/") - 1) == 0)
{
- name = grub_ofserial_add_port (&name[sizeof ("ieee1275/") - 1]);
- if (!name)
- return NULL;
-
- FOR_SERIAL_PORTS (port)
- if (grub_strcmp (port->name, name) == 0)
- break;
+ port = grub_ofserial_add_port (&name[sizeof ("ieee1275/") - 1]);
+ if (port == NULL)
+ return NULL;
}
#endif
#if defined(__mips__) || defined (__i386__) || defined (__x86_64__)
void grub_ns8250_init (void);
-char *grub_ns8250_spcr_init (void);
-char *grub_serial_ns8250_add_port (grub_port_t port, struct grub_serial_config *config);
-char *grub_serial_ns8250_add_mmio (grub_addr_t addr, unsigned int acc_size,
- struct grub_serial_config *config);
+struct grub_serial_port *grub_ns8250_spcr_init (void);
+struct grub_serial_port *grub_serial_ns8250_add_port (grub_port_t port,
+ struct grub_serial_config *config);
+struct grub_serial_port *grub_serial_ns8250_add_mmio (grub_addr_t addr,
+ unsigned int acc_size,
+ struct grub_serial_config *config);
#endif
#ifdef GRUB_MACHINE_IEEE1275
void grub_ofserial_init (void);
#ifdef GRUB_MACHINE_ARC
void
grub_arcserial_init (void);
-const char *
-grub_arcserial_add_port (const char *path);
+struct grub_serial_port *grub_arcserial_add_port (const char *path);
#endif
struct grub_serial_port *grub_serial_find (const char *name);