Beispiel #1
0
void __init prom_init_cmdline(void)
{
	char *cp;
	int actr, i;

	actr = 1; /* Always ignore argv[0] */

	cp = &(arcs_cmdline[0]);
	while(actr < prom_argc) {
		for(i = 0; i < NENTS(ignored); i++) {
			int len = strlen(ignored[i]);

			if(!strncmp(prom_argv(actr), ignored[i], len))
				goto pic_cont;
		}
		/* Ok, we want it. */
		strcpy(cp, prom_argv(actr));
		cp += strlen(prom_argv(actr));
		*cp++ = ' ';

	pic_cont:
		actr++;
	}
	if (cp != &(arcs_cmdline[0])) /* get rid of trailing space */
		--cp;
	*cp = '\0';

#ifdef DEBUG_CMDLINE
	prom_printf("prom_init_cmdline: %s\n", &(arcs_cmdline[0]));
#endif
}
Beispiel #2
0
static char * __init move_firmware_args(char* cp)
{
    char *s;
    int actr, i;

    actr = 1; /* Always ignore argv[0] */

    while (actr < prom_argc) {
        for(i = 0; i < NENTS(used_arc); i++) {
            int len = strlen(used_arc[i][0]);

            if (!strncmp(prom_argv(actr), used_arc[i][0], len)) {
                /* Ok, we want it. First append the replacement... */
                strcat(cp, used_arc[i][1]);
                cp += strlen(used_arc[i][1]);
                /* ... and now the argument */
                s = strstr(prom_argv(actr), "=");
                if (s) {
                    s++;
                    strcpy(cp, s);
                    cp += strlen(s);
                }
                *cp++ = ' ';
                break;
            }
        }
        actr++;
    }

    return cp;
}
status_t
TerminalThemesAddon::ApplyDefaultTheme(uint32 flags)
{
	BMessage theme;
	BMessage termpref;
	int32 i;

	// XXX: add font and stuff...

	for (i = 0; i < NENTS(sHaikuPrefsMapInt32); i++) {
		termpref.AddInt32(sHaikuPrefsMapInt32[i].name,
			sHaikuPrefsMapInt32[i].def);
	}

	for (i = 0; i < NENTS(sHaikuPrefsMapColors); i++) {
		AddRGBColor(termpref, sHaikuPrefsMapColors[i].name,
			sHaikuPrefsMapColors[i].def);
	}

	theme.AddMessage(Z_THEME_TERMINAL_SETTINGS, &termpref);
	return ApplyTheme(theme, flags);
}
Beispiel #4
0
void __init prom_init_cmdline(void)
{
    char *cp;
    int actr, i;

    actr = 1; /* Always ignore argv[0] */

    cp = &(arcs_cmdline[0]);
    /*
     * Move ARC variables to the beginning to make sure they can be
     * overridden by later arguments.
     */
    cp = move_firmware_args(cp);

    while (actr < prom_argc) {
        for (i = 0; i < NENTS(ignored); i++) {
            int len = strlen(ignored[i]);

            if (!strncmp(prom_argv(actr), ignored[i], len))
                goto pic_cont;
        }
        /* Ok, we want it. */
        strcpy(cp, prom_argv(actr));
        cp += strlen(prom_argv(actr));
        *cp++ = ' ';

pic_cont:
        actr++;
    }
    if (cp != &(arcs_cmdline[0])) /* get rid of trailing space */
        --cp;
    *cp = '\0';

#ifdef DEBUG_CMDLINE
    prom_printf("prom_init_cmdline: %s\n", &(arcs_cmdline[0]));
#endif
}
Beispiel #5
0
static int	ofwn_probe(struct netif *, void *);
static int	ofwn_match(struct netif *, void *);
static void	ofwn_init(struct iodesc *, void *);
static int	ofwn_get(struct iodesc *, void *, size_t, time_t);
static int	ofwn_put(struct iodesc *, void *, size_t);
static void	ofwn_end(struct netif *);

extern struct netif_stats	ofwn_stats[];

struct netif_dif ofwn_ifs[] = {
	/*	dif_unit	dif_nsel	dif_stats	dif_private	*/
	{	0,		1,		&ofwn_stats[0],	0,	},
};

struct netif_stats ofwn_stats[NENTS(ofwn_ifs)];

struct netif_driver ofwnet = {
	"net",			/* netif_bname */
	ofwn_match,		/* netif_match */
	ofwn_probe,		/* netif_probe */
	ofwn_init,		/* netif_init */
	ofwn_get,		/* netif_get */
	ofwn_put,		/* netif_put */
	ofwn_end,		/* netif_end */
	ofwn_ifs,		/* netif_ifs */
	NENTS(ofwn_ifs)		/* netif_nifs */
};

static ihandle_t	netinstance;
Beispiel #6
0
const char version[] = "3.01";
int	debug = 1;


void (*sa_cleanup)(void) = NULL;


void (*i386_probe1[])(void) = {
	gateA20on, cninit, memprobe
};
void (*i386_probe2[])(void) = {
 	diskprobe
};

struct i386_boot_probes probe_list[] = {
	{ "probing", i386_probe1, NENTS(i386_probe1) },
	{ "disk",    i386_probe2, NENTS(i386_probe2) }
};
int nibprobes = NENTS(probe_list);


struct fs_ops file_system[] = {
	{ ufs_open,    ufs_close,    ufs_read,    ufs_write,    ufs_seek,
	  ufs_stat,    ufs_readdir    },
#ifdef notdef
	{ fat_open,    fat_close,    fat_read,    fat_write,    fat_seek,
	  fat_stat,    fat_readdir    },
	{ nfs_open,    nfs_close,    nfs_read,    nfs_write,    nfs_seek,
	  nfs_stat,    nfs_readdir    },
	{ cd9660_open, cd9660_close, cd9660_read, cd9660_write, cd9660_seek,
	  cd9660_stat, cd9660_readdir },
Beispiel #7
0
/* forward declarations */
int prom_probe __P((struct netif *, void *));
int prom_match __P((struct netif *, void *));
void prom_init __P((struct iodesc *, void *));
int prom_get __P((struct iodesc *, void *, size_t, time_t));
int prom_put __P((struct iodesc *, void *, size_t));
void prom_end __P((struct netif *));

extern int try_bootp;

extern struct netif_stats       prom_stats[];
struct netif_dif prom_ifs[] = {
/*	dif_unit	dif_nsel	dif_stats	dif_private	*/
{	0,		1,		&prom_stats[0],	0,		},
};
struct netif_stats prom_stats[NENTS(prom_ifs)];

struct netif_driver prom_netif_driver = {
	"prom",				/* netif_bname */
	prom_match,			/* netif_match */
	prom_probe,			/* netif_probe */
	prom_init,			/* netif_init */
	prom_get,			/* netif_get */
	prom_put,			/* netif_put */
	prom_end,			/* netif_end */
	prom_ifs,			/* netif_ifs */
	NENTS(prom_ifs)			/* netif_nifs */
};

static int sc_fd;				/* PROM file id */
Beispiel #8
0
const struct x_sw execsw[] = {
	{ "elf", elf_probe,	elf_load,	elf_ldsym },
/*	{ "som", som_probe,	som_load,	som_ldsym }, */
	{ ""   , NULL,		NULL },
};

struct fs_ops file_system[] = {
	{ lif_open,    lif_close,    lif_read,    lif_write,    lif_seek,
	  lif_stat,    lif_readdir    },
	{ ufs_open,    ufs_close,    ufs_read,    ufs_write,    ufs_seek,
	  ufs_stat,    ufs_readdir    },
	{ cd9660_open, cd9660_close, cd9660_read, cd9660_write, cd9660_seek,
	  cd9660_stat, cd9660_readdir },
};
int nfsys = NENTS(file_system);

struct devsw devsw[] = {
	{ "ct",	iodcstrategy, ctopen, ctclose, noioctl },
	{ "sd",	iodcstrategy, dkopen, dkclose, noioctl },
	{ "lf", iodcstrategy, lfopen, lfclose, noioctl }
};
int	ndevs = NENTS(devsw);

struct consdev	constab[] = {
	{ ite_probe, ite_init, ite_getc, ite_putc },
	{ NULL }
};
struct consdev *cn_tab;

Beispiel #9
0
static int	net_probe(struct netif *, void *);
static int	net_match(struct netif *, void *);
static void	net_init(struct iodesc *, void *);
static int	net_get(struct iodesc *, void *, size_t, time_t);
static int	net_put(struct iodesc *, void *, size_t);
static void	net_end(struct netif *);

extern struct netif_stats net_stats[];

struct netif_dif net_ifs[] = {
	/*	dif_unit	dif_nsel	dif_stats	dif_private */
	{	0,		1,		&net_stats[0],	0,	},
};

struct netif_stats net_stats[NENTS(net_ifs)];

struct netif_driver uboot_net = {
	"uboot_eth",		/* netif_bname */
	net_match,		/* netif_match */
	net_probe,		/* netif_probe */
	net_init,		/* netif_init */
	net_get,		/* netif_get */
	net_put,		/* netif_put */
	net_end,		/* netif_end */
	net_ifs,		/* netif_ifs */
	NENTS(net_ifs)		/* netif_nifs */
};

struct uboot_softc {
	uint32_t	sc_pad;
status_t
TerminalThemesAddon::MakeThemeHaiku(BMessage &theme, uint32 flags)
{
	BMessage termpref;
	BMessage lines;
	status_t err;
	BString value;
	int n, i;
	
	(void)flags;
	err = MyMessage(theme, termpref);
	if (err)
		termpref.MakeEmpty();
	
	err = LoadHaikuTerminalSettings(lines);
	
	for (i = 0; i < NENTS(sHaikuPrefsMapInt32); i++) {
		int v;

		if (lines.FindString(sHaikuPrefsMapInt32[i].pref, &value) < B_OK)
			continue;

		n = sscanf(value.String(), "%d", &v);
		//printf("n=%d '%s'\n", n, value.String());

		if (n == 1)
			termpref.AddInt32(sHaikuPrefsMapInt32[i].name, v);
	}

	for (i = 0; i < NENTS(sHaikuPrefsMapColors); i++) {
		int r, g, b;

		if (lines.FindString(sHaikuPrefsMapColors[i].pref, &value) < B_OK)
			continue;

		n = sscanf(value.String(), "%d%*[, ]%d%*[, ]%d", &r, &g, &b);
		//printf("n=%d '%s' %d,%d,%d\n", n, value.String(), r, g, b);

		if (n == 3) {
			rgb_color c = make_color(r, g, b, 255);
			AddRGBColor(termpref, sHaikuPrefsMapColors[i].name, c);
		}
	}

	BFont font;
	BString s;
	font_family family;
	font_style style;
	float size = 12.0;
	memset(&family, 0, sizeof(family));
	memset(&style, 0, sizeof(style));

	if (lines.FindString(PREF_HALF_FONT_FAMILY, &s) == B_OK)
		strncpy(family, s.String(), B_FONT_FAMILY_LENGTH);

	if (lines.FindString(PREF_HALF_FONT_STYLE, &s) == B_OK)
		strncpy(style, s.String(), B_FONT_STYLE_LENGTH);

	font.SetFamilyAndStyle(family, style);

	if (lines.FindString(PREF_HALF_FONT_SIZE, &s) == B_OK)
		sscanf(s.String(), "%f", &size);

	font.SetSize(size);

	//termpref.PrintToStream();

	err = SetMyMessage(theme, termpref);
	return B_OK;
}
status_t
TerminalThemesAddon::ApplyThemeHaiku(BMessage &theme, uint32 flags)
{
	BMessage termpref;
	BMessage lines;
	status_t err;
	int32 ival;
	rgb_color color;
	BString s;
	int i;

	err = MyMessage(theme, termpref);
	if (err)
		return err;

	for (i = 0; i < NENTS(sHaikuPrefsMapInt32); i++) {
		if (termpref.FindInt32(sHaikuPrefsMapInt32[i].name, &ival) < B_OK)
			ival = sHaikuPrefsMapInt32[i].def;
		s = "";
		s << ival;
		lines.AddString(sHaikuPrefsMapInt32[i].pref, s.String());
	}

	for (i = 0; i < NENTS(sHaikuPrefsMapColors); i++) {
		if (FindRGBColor(termpref, sHaikuPrefsMapColors[i].name, 0, &color) != B_OK)
			color = sHaikuPrefsMapColors[i].def;
		s = "";
		s << color.red << ", " << color.green << ", " << color.blue;
		lines.AddString(sHaikuPrefsMapColors[i].pref, s.String());
	}

	BFont tFont;
	for (i = 0; FindFont(termpref, TP_FONT, i, &tFont) == B_OK; i++) {
		// at least set the size
		s = "";
		s << (int32)tFont.Size();
		lines.AddString(PREF_HALF_FONT_SIZE, s.String());
		//tFont.PrintToStream();
		//printf("fixed: %d\n", tFont.IsFixed());
		//printf("f&h fixed: %d\n", tFont.IsFullAndHalfFixed());
		// don't even try to set the font if it's not there or not fixed
		if (!tFont.IsFixed() && !tFont.IsFullAndHalfFixed())
			continue;
		font_family ff;
		font_style fs;
		tFont.GetFamilyAndStyle(&ff, &fs);
		s = "";
		s << ff;
		lines.AddString(PREF_HALF_FONT_FAMILY, s.String());
		s = "";
		s << fs;
		lines.AddString(PREF_HALF_FONT_STYLE, s.String());
	}

	if (flags & UI_THEME_SETTINGS_SAVE && AddonFlags() & Z_THEME_ADDON_DO_SAVE) {
		SaveHaikuTerminalSettings(lines);
	}

	if (flags & UI_THEME_SETTINGS_APPLY && AddonFlags() & Z_THEME_ADDON_DO_APPLY) {
		BList teamList;
		app_info ainfo;
		int32 count, i;
		be_roster->GetAppList(&teamList);
		count = teamList.CountItems();
		for (i = 0; i < count; i++) {
			if (be_roster->GetRunningAppInfo((team_id)((addr_t)teamList.ItemAt(i)), &ainfo) == B_OK) {
				if (!strcmp(ainfo.signature, kHaikuTerminalAppSig)) {
					err = B_OK;
					//XXX: WRITEME
/*					BMessage msg(MSG_R5_SET_PREF);
					BMessenger msgr(NULL, ainfo.team);
					tp.x = 0;
					tp.y = 0;
					
					//msg.AddData("", 'UBYT', &(tp.p), sizeof(struct tpref));
					msg.AddData("", 'UBYT', &(tp), sizeof(struct termprefs));
					msg.AddSpecifier("Window", 0L);
					err = msgr.SendMessage(&msg);
*/
				}
			}
		}
	}
	
	return B_OK;
}
Beispiel #12
0
#include <sys/param.h>
#include <sys/disklabel.h>
#include <sys/reboot.h>
#include <dev/cons.h>

#include <machine/iomod.h>

#include "dev_hppa.h"

extern int debug;

const char cdevs[][4] = {
	"ite", "", "", "", "", "", "", "",
	"", "", "", "", ""
};
const int ncdevs = NENTS(cdevs);

const struct pdc_devs {
	char	name[3];
	int	dev_type;
} pdc_devs[] = {
	{ "dk",  0 },
	{ "ct",  1 },
	{ "lf",  2 },
	{ "",   -1 },
	{ "rd", -1 },
	{ "sw", -1 },
	{ "fl", -1 },
};

/* pass dev_t to the open routines */
Beispiel #13
0
        int	le_id;
        int	le_regs;
        int	le_mem;
        int	le_nvram;
        int	le_heat;
        int	le_bonus;
} le0conf[] = {
/* offsets for:	   ID   REGS     MEM   NVRAM	le_heat	le_bonus*/
{		    0,	0x4000, 0x8000, 0xC008,	1,	10   }
};

extern struct netif_stats	le_stats[];

struct netif_dif le_ifs[] = {
/*	dif_unit	dif_nsel	dif_stats	dif_private	*/
{	0,		NENTS(le0conf),	&le_stats[0],	le0conf,	},
};

struct netif_stats le_stats[NENTS(le_ifs)];

struct netif_driver le_driver = {
	"le",			/* netif_bname */
	le_match,		/* netif_match */
	le_probe,		/* netif_probe */
	le_init,		/* netif_init */
	le_get,			/* netif_get */
	le_put,			/* netif_put */
	le_end,			/* netif_end */
	le_ifs,			/* netif_ifs */
	NENTS(le_ifs)		/* netif_nifs */
};
Beispiel #14
0
 * THE POSSIBILITY OF SUCH DAMAGE.
 */

#include "libsa.h"
#include "biosdev.h"
#include <sys/param.h>
#include <dev/cons.h>

extern int debug;

/* XXX use slot for 'rd' for 'hd' pseudo-device */
const char bdevs[][4] = {
	"wd", "", "fd", "wt", "sd", "st", "cd", "mcd",
	"", "", "", "", "", "", "", "scd", "", "hd", ""
};
const int nbdevs = NENTS(bdevs);

const char cdevs[][4] = {
	"cn", "", "", "", "", "", "", "",
	"com", "", "", "", "pc"
};
const int ncdevs = NENTS(cdevs);

/* pass dev_t to the open routines */
int
devopen(struct open_file *f, const char *fname, char **file)
{
	struct devsw *dp = devsw;
	register int i, rc = 1;

	*file = (char *)fname;