Example #1
0
void __init plat_mem_setup(void)
{
	board_be_init = ip32_be_init;

#ifdef CONFIG_SGI_O2MACE_ETH
	{
		char *mac = ArcGetEnvironmentVariable("eaddr");
		str2eaddr(o2meth_eaddr, mac);
	}
#endif

#if defined(CONFIG_SERIAL_CORE_CONSOLE)
	{
		char* con = ArcGetEnvironmentVariable("console");
		if (con && *con == 'd') {
			static char options[8] __initdata;
			char *baud = ArcGetEnvironmentVariable("dbaud");
			if (baud)
				strcpy(options, baud);
			add_preferred_console("ttyS", *(con + 1) == '2' ? 1 : 0,
					      baud ? options : NULL);
		}
	}
#endif
}
void __init plat_mem_setup(void)
{
	char *ctype;
	char *cserial;

	board_be_init = ip22_be_init;

	/*                                                            
                                                                   
                                                                 
  */
	sgihpc_init();

	/*                              */
	sgimc_init();

#ifdef CONFIG_BOARD_SCACHE
	/*                                 */
	indy_sc_init();
#endif

	/*                                  
                        */
	set_io_port_base((unsigned long)ioremap(0x00080000,
						0x1fffffff - 0x00080000));
	/*                                                     
                                                           
                                             
   
                                                     
                            
  */
	ctype = ArcGetEnvironmentVariable("console");
	cserial = ArcGetEnvironmentVariable("ConsoleOut");

	if ((ctype && *ctype == 'd') || (cserial && *cserial == 's')) {
		static char options[8] __initdata;
		char *baud = ArcGetEnvironmentVariable("dbaud");
		if (baud)
			strcpy(options, baud);
		add_preferred_console("ttyS", *(ctype + 1) == '2' ? 1 : 0,
				      baud ? options : NULL);
	} else if (!ctype || *ctype != 'g') {
Example #3
0
void __init plat_mem_setup(void)
{
	char *ctype;
	char *cserial;

	board_be_init = ip22_be_init;
	ip22_time_init();

	/* Init the INDY HPC I/O controller.  Need to call this before
	 * f*****g with the memory controller because it needs to know the
	 * boardID and whether this is a Guiness or a FullHouse machine.
	 */
	sgihpc_init();

	/* Init INDY memory controller. */
	sgimc_init();

#ifdef CONFIG_BOARD_SCACHE
	/* Now enable boardcaches, if any. */
	indy_sc_init();
#endif

	/* Set EISA IO port base for Indigo2
	 * ioremap cannot fail */
	set_io_port_base((unsigned long)ioremap(0x00080000,
						0x1fffffff - 0x00080000));
	/* ARCS console environment variable is set to "g?" for
	 * graphics console, it is set to "d" for the first serial
	 * line and "d2" for the second serial line.
	 *
	 * Need to check if the case is 'g' but no keyboard:
	 * (ConsoleIn/Out = serial)
	 */
	ctype = ArcGetEnvironmentVariable("console");
	cserial = ArcGetEnvironmentVariable("ConsoleOut");

	if ((ctype && *ctype == 'd') || (cserial && *cserial == 's')) {
		static char options[8];
		char *baud = ArcGetEnvironmentVariable("dbaud");
		if (baud)
			strcpy(options, baud);
		add_preferred_console("ttyS", *(ctype + 1) == '2' ? 1 : 0,
				      baud ? options : NULL);
	} else if (!ctype || *ctype != 'g') {
		/* Use ARC if we don't want serial ('d') or graphics ('g'). */
		prom_flags |= PROM_FLAG_USE_AS_CONSOLE;
		add_preferred_console("arc", 0, NULL);
	}

#if defined(CONFIG_VT) && defined(CONFIG_SGI_NEWPORT_CONSOLE)
	{
		ULONG *gfxinfo;
		ULONG * (*__vec)(void) = (void *) (long)
			*((_PULONG *)(long)((PROMBLOCK)->pvector + 0x20));

		gfxinfo = __vec();
		sgi_gfxaddr = ((gfxinfo[1] >= 0xa0000000
			       && gfxinfo[1] <= 0xc0000000)
			       ? gfxinfo[1] - 0xa0000000 : 0);

		/* newport addresses? */
		if (sgi_gfxaddr == 0x1f0f0000 || sgi_gfxaddr == 0x1f4f0000) {
			conswitchp = &newport_con;
		}
	}
#endif
}
Example #4
0
ARC_STATUS
HalGetEnvironmentVariable (
    IN PCHAR Variable,
    IN USHORT Length,
    OUT PCHAR Buffer
)

/*++

Routine Description:

    This function locates an environment variable and returns its value.

Arguments:

    Variable - Supplies a pointer to a zero terminated environment variable
        name.

    Length - Supplies the length of the value buffer in bytes.

    Buffer - Supplies a pointer to a buffer that receives the variable value.

Return Value:

    ESUCCESS is returned if the enviroment variable is located. Otherwise,
    ENOENT is returned.

NOTE:
    This implementation returns the error code ENOMEM if the output buffer
    is too small.

--*/

{

    PUCHAR Environment_var;
    ULONG Index;
    ARC_STATUS Status;

    //
    // retrieve the variable
    //

    Environment_var = (PUCHAR)ArcGetEnvironmentVariable(Variable);

    if (Environment_var == (PUCHAR)NULL) {

        Status = ENOENT;

    } else {

        //
        // Copy the specified value to the output buffer.
        //

        for (Index = 0; Index < Length; Index += 1) {
            *Buffer = READ_REGISTER_UCHAR(Environment_var);
            if (*Buffer == 0) {
                break;
            }

            Buffer += 1;
            Environment_var += 1;
        }

        //
        // If the length terminated the loop, then return not enough memory.
        // Otherwise, return success.
        //

        if (Index == Length) {
            Status = ENOMEM;

        } else {
            Status = ESUCCESS;
        }
    }

    return Status;
}
Example #5
0
VOID
main (
    VOID
    )
/*++

Routine Description:

    This calls other functions to communicate with the user, get the
    firmware update file, verify it, and do the update.

    Success and error messages are printed out by this function
    and/or functions below this one.

    
Arguments:

    None.

Return Value:

    None.

--*/

{
    ARC_STATUS Status;
    LONG Index;
    ULONG CurrentLine;
    ULONG FirmwareBufferAddress;
    ULONG FirmwareBufferLength;
    ULONG FirmwareStart;
    ULONG HighROMBlockToBeWritten;
    ULONG LowROMBlockToBeWritten;
    BOOLEAN VariableFound;
    PCONFIGURATION_COMPONENT Controller;
    PCHAR Colon;
    PCHAR EnvironmentValue;
    CHAR PathName[128];
    PCHAR TempArgs;
    CHAR UserSpecifiedPath[128];
    GETSTRING_ACTION Action;
    PCONFIGURATION_COMPONENT Cdrom;


    FwRtlStackPanic = 0;

    VenClearScreen();

    VenSetPosition(1,0);

    VenPrint1(FWUP_INTRO1_MSG, FirmwareVersion);
    VenPrint (FWUP_INTRO2_MSG);
    VenPrint (FWUP_INTRO3_MSG);

    if (!JnFsProceedWithUpdate()) {
	return;
    }

    VenClearScreen();

    VenSetPosition(1,0);
    VenPrint(FWUP_SELECT_LOCATION_MSG);
    VenPrint(FWUP_USE_ARROW_KEYS_MSG);
    VenPrint(FWUP_HIT_ESC_TO_ABORT_MSG);
    
    Index = JzDisplayMenu(UpdateLocationChoices,
			  NUMBER_OF_UPDATELOCATIONCHOICES,
			  0,
			  7,
			  0,
			  FALSE);

    CurrentLine = 12;

    switch (Index) {

	//
	// Floppy drive
	//
        case 0:

	  strcpy(PathName, FWUP_DEFAULT_FLOPPY_LOCATION);
	  break;

	//
	// CD-ROM
	//
        case 1:

	  FwpFindCDROM(PathName);
	  strcat(PathName, FWUP_DEFAULT_CDROM_FILENAME);
	  break;

	//
	// Some other location
	//
	case 2:

	    VenSetPosition(12,0);
	    VenPrint(FWUP_LOCATION_OF_UPDATE_FILE_MSG);
	    do {
	    	Action = JzGetString(UserSpecifiedPath,
				     sizeof(UserSpecifiedPath),
				     NULL,
				     12,
				     strlen(FWUP_LOCATION_OF_UPDATE_FILE_MSG),
				     FALSE
				     );

	    } while ((Action != GetStringEscape) && (Action != GetStringSuccess));

	    if (Action == GetStringEscape) {
	    	return;
	    }

	    CurrentLine += 2;


	    //
	    // Strip off any arguments.
	    //

	    if ((TempArgs = strchr(UserSpecifiedPath, ' ')) != NULL) {
	    	*TempArgs++ = 0;
	    }
	    
            //
            // If the name does not contain a "(", then assume it is not a full
            // pathname.
            //

            if (strchr( UserSpecifiedPath, '(') == NULL) {

                //
                // If the name contains a semicolon, look for an environment
                // variable that defines the path.
                //

                if ((Colon = strchr( UserSpecifiedPath, ':')) != NULL) {

                    for (Index = 0; UserSpecifiedPath[Index] != ':' ; Index++ ) {
                        PathName[Index] = tolower(UserSpecifiedPath[Index]);
                    }

                    PathName[Index++] = ':';
                    PathName[Index++] = 0;
                    EnvironmentValue = ArcGetEnvironmentVariable(PathName);
                    VariableFound = FALSE;

                    if (EnvironmentValue != NULL) {
                        strcpy( PathName, EnvironmentValue);
                        VariableFound = TRUE;
                    } else if (!strcmp(PathName, "cd:")) {
                        for ( Index = 0 ; Index < 8 ; Index++ ) {
                            sprintf(PathName, "scsi(0)cdrom(%d)fdisk(0)", Index);
                            Controller = ArcGetComponent(PathName);
                            if ((Controller != NULL) && (Controller->Type == FloppyDiskPeripheral)) {
                                VariableFound = TRUE;
                                break;
                            }
                        }
                    }

                    if (!VariableFound) {
                        VenSetPosition( 17, 0);
                        VenSetScreenColor(ArcColorRed, ArcColorWhite);
                        VenPrint(FWUP_UNDEFINED_PATHNAME_MSG);
			FwWaitForKeypress(FALSE);
                        VenSetScreenColor(ArcColorWhite, ArcColorBlue);
			return;
                    } else {
                        strcat( PathName, Colon + 1);
                    }

                } else {
		   
		    //
		    // The filespec does not contain a '(' or a :.
		    // FWSEARCHPATH is not supported in this tool.
		    // Therefore, declare an error.
		    //
		      
		    VenSetPosition( 17, 0);
		    VenSetScreenColor(ArcColorRed, ArcColorWhite);
		    VenPrint1(FWUP_BAD_PATHNAME_MSG, UserSpecifiedPath);
		    FwWaitForKeypress(FALSE);
		    VenSetScreenColor(ArcColorWhite, ArcColorBlue);
		    return;
		}

            } else {
                strcpy( PathName, UserSpecifiedPath);
            }
            break;


	//
	// Exit, or internal error.
	//
	case 3:
        default:
	    return;

    }

    VenSetPosition(CurrentLine, 0);
    VenPrint(FWUP_LOCATING_THE_FILE_MSG);
    
    Status = ReadAndVerifyUpdateFile(PathName, &FirmwareBufferAddress,
    				     &FirmwareStart,
				     &FirmwareBufferLength,
				     &LowROMBlockToBeWritten,
				     &HighROMBlockToBeWritten);

    if (Status != ESUCCESS) {
	JnFsDecodeBadStatus(Status);
	FwWaitForKeypress(FALSE);
	return;
    }

    VenClearScreen();

    VenSetPosition(1,0);
    VenPrint(FWUP_UPDATE_FILE_IS_GOOD_MSG);
    
    VenPrint ((PUCHAR)FirmwareBufferAddress);

    //
    // If manufacturing followed the rules, we should be at or above row #14.
    //

    VenPrint("\r\n\n");
    if (!JnFsProceedWithUpdate()) {
	return;
    }

    VenPrint(FWUP_ARE_YOU_REALLY_SURE_MSG);

    if (!JnFsProceedWithUpdate()) {
	return;
    }

#ifdef JENSEN
    Status = JnFsStoreIntoROM((PUCHAR)FirmwareStart, LowROMBlockToBeWritten,
			      HighROMBlockToBeWritten);
#endif // JENSEN

#ifdef MORGAN
    VenPrint1(FWUP_ABOUT_TO_WRITE_ROM_MSG, LowROMBlockToBeWritten);
    FwWaitForKeypress();
    Status = MorganFsStoreIntoROM( LowROMBlockToBeWritten, (PUCHAR)FirmwareStart,
				  FirmwareBufferLength);
#endif // MORGAN

    if (Status != ESUCCESS) {
	JnFsDecodeBadStatus(Status);
        VenPrint(FWUP_FAILED_UPDATE_MSG);
    } else {
        VenPrint(FWUP_SUCCESSFUL_UPDATE_MSG);
    }
    
    FwWaitForKeypress(FALSE);
    return;

}
Example #6
0
static int __init ip22_setup(void)
{
	char *ctype;
#ifdef CONFIG_KGDB
	char *kgdb_ttyd;
#endif

	board_be_init = ip22_be_init;
	ip22_time_init();

	/* Init the INDY HPC I/O controller.  Need to call this before
	 * f*****g with the memory controller because it needs to know the
	 * boardID and whether this is a Guiness or a FullHouse machine.
	 */
	sgihpc_init();

	/* Init INDY memory controller. */
	sgimc_init();

#ifdef CONFIG_BOARD_SCACHE
	/* Now enable boardcaches, if any. */
	indy_sc_init();
#endif

	/* Set EISA IO port base for Indigo2 */
	set_io_port_base(KSEG1ADDR(0x00080000));

	/* ARCS console environment variable is set to "g?" for
	 * graphics console, it is set to "d" for the first serial
	 * line and "d2" for the second serial line.
	 */
	ctype = ArcGetEnvironmentVariable("console");
	if (ctype && *ctype == 'd') {
		static char options[8];
		char *baud = ArcGetEnvironmentVariable("dbaud");
		if (baud)
			strcpy(options, baud);
		add_preferred_console("ttyS", *(ctype + 1) == '2' ? 1 : 0,
				      baud ? options : NULL);
	} else if (!ctype || *ctype != 'g') {
		/* Use ARC if we don't want serial ('d') or Newport ('g'). */
		prom_flags |= PROM_FLAG_USE_AS_CONSOLE;
		add_preferred_console("arc", 0, NULL);
	}

#ifdef CONFIG_KGDB
	kgdb_ttyd = prom_getcmdline();
	if ((kgdb_ttyd = strstr(kgdb_ttyd, "kgdb=ttyd")) != NULL) {
		int line;
		kgdb_ttyd += strlen("kgdb=ttyd");
		if (*kgdb_ttyd != '1' && *kgdb_ttyd != '2')
			printk(KERN_INFO "KGDB: Uknown serial line /dev/ttyd%c"
			       ", falling back to /dev/ttyd1\n", *kgdb_ttyd);
		line = *kgdb_ttyd == '2' ? 0 : 1;
		printk(KERN_INFO "KGDB: Using serial line /dev/ttyd%d for "
		       "session\n", line ? 1 : 2);
		rs_kgdb_hook(line);

		printk(KERN_INFO "KGDB: Using serial line /dev/ttyd%d for "
		       "session, please connect your debugger\n", line ? 1:2);

		remote_debug = 1;
		/* Breakpoints and stuff are in sgi_irq_setup() */
	}
#endif

#ifdef CONFIG_VT
#ifdef CONFIG_SGI_NEWPORT_CONSOLE
	if (ctype && *ctype == 'g'){
		ULONG *gfxinfo;
		ULONG * (*__vec)(void) = (void *) (long)
			*((_PULONG *)(long)((PROMBLOCK)->pvector + 0x20));

		gfxinfo = __vec();
		sgi_gfxaddr = ((gfxinfo[1] >= 0xa0000000
			       && gfxinfo[1] <= 0xc0000000)
			       ? gfxinfo[1] - 0xa0000000 : 0);

		/* newport addresses? */
		if (sgi_gfxaddr == 0x1f0f0000 || sgi_gfxaddr == 0x1f4f0000) {
			conswitchp = &newport_con;
		}
	}
#endif
#endif

	return 0;
}
Example #7
0
void __init plat_setup(void)
{
	board_be_init = ip32_be_init;

	rtc_mips_get_time = mc146818_get_cmos_time;
	rtc_mips_set_mmss = mc146818_set_rtc_mmss;

	board_time_init = ip32_time_init;
	board_timer_setup = ip32_timer_setup;

#ifdef CONFIG_SERIAL_8250
	{
		static struct uart_port o2_serial[2];

		memset(o2_serial, 0, sizeof(o2_serial));
		o2_serial[0].type	= PORT_16550A;
		o2_serial[0].line	= 0;
		o2_serial[0].irq	= MACEISA_SERIAL1_IRQ;
		o2_serial[0].flags	= UPF_SKIP_TEST;
		o2_serial[0].uartclk	= 1843200;
		o2_serial[0].iotype	= UPIO_MEM;
		o2_serial[0].membase	= (char *)&mace->isa.serial1;
		o2_serial[0].fifosize	= 14;
                /* How much to shift register offset by. Each UART register
		 * is replicated over 256 byte space */
		o2_serial[0].regshift	= 8;
		o2_serial[1].type	= PORT_16550A;
		o2_serial[1].line	= 1;
		o2_serial[1].irq	= MACEISA_SERIAL2_IRQ;
		o2_serial[1].flags	= UPF_SKIP_TEST;
		o2_serial[1].uartclk	= 1843200;
		o2_serial[1].iotype	= UPIO_MEM;
		o2_serial[1].membase	= (char *)&mace->isa.serial2;
		o2_serial[1].fifosize	= 14;
		o2_serial[1].regshift	= 8;

		early_serial_setup(&o2_serial[0]);
		early_serial_setup(&o2_serial[1]);
	}
#endif
#ifdef CONFIG_SGI_O2MACE_ETH
	{
		char *mac = ArcGetEnvironmentVariable("eaddr");
		str2eaddr(o2meth_eaddr, mac);
	}
#endif

#if defined(CONFIG_SERIAL_CORE_CONSOLE)
	{
		char* con = ArcGetEnvironmentVariable("console");
		if (con && *con == 'd') {
			static char options[8];
			char *baud = ArcGetEnvironmentVariable("dbaud");
			if (baud)
				strcpy(options, baud);
			add_preferred_console("ttyS", *(con + 1) == '2' ? 1 : 0,
					      baud ? options : NULL);
		}
	}
#endif
}