2 * console.c - register a console device
4 * Copyright (c) 2007 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
6 * See file CREDITS for list of people who contributed to this
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2
11 * as published by the Free Software Foundation.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #include <mach/linux.h>
28 int barebox_register_console(char *name
, int stdinfd
, int stdoutfd
)
31 struct linux_console_data
*data
;
33 dev
= xzalloc(sizeof(struct device_d
) + sizeof(struct linux_console_data
));
35 data
= (struct linux_console_data
*)(dev
+ 1);
37 dev
->platform_data
= data
;
38 strcpy(dev
->name
, name
);
40 strcpy(dev
->name
, "console");
43 data
->flags
= CONSOLE_STDIN
;
45 data
->flags
|= CONSOLE_STDOUT
| CONSOLE_STDERR
;
47 data
->stdoutfd
= stdoutfd
;
48 data
->stdinfd
= stdinfd
;
50 return register_device(dev
);