Browse Source

Add Select Boot in Bios Window

master
xiaqichao@ict.ac.cn 14 years ago
parent
commit
1b46e7110f
  1. 37
      Targets/Bonito3a780e/Bonito/tgt_machdep.c
  2. 8
      fb/cfb_console.c
  3. 1338
      pmon/cmds/cmd_main/cmd_main.c
  4. 6
      pmon/cmds/cmd_main/cmd_main.h
  5. 2
      pmon/cmds/cmd_main/window.c
  6. 2
      pmon/cmds/cmd_main/window.h
  7. 1
      pmon/dev/kbd.c
  8. 3
      pmon/fs/termio.c
  9. 31
      sys/dev/ata/wd.c
  10. 10
      sys/dev/pci/rtl8168.c
  11. 21
      sys/kern/subr_autoconf.c
  12. 7
      sys/sys/atapi.h

37
Targets/Bonito3a780e/Bonito/tgt_machdep.c

@ -31,6 +31,8 @@
*
*/
#include <include/stdarg.h>
unsigned int mem_size = 0;
#include <include/stdio.h>
#include <include/string.h>
#include <include/file.h>
@ -183,6 +185,18 @@ static inline unsigned char CMOS_READ(unsigned char addr);
static inline void CMOS_WRITE(unsigned char val, unsigned char addr);
static void init_legacy_rtc(void);
#ifdef INTERFACE_3A780E
#define REV_ROW_LINE 560
#define INF_ROW_LINE 576
int afxIsReturnToPmon = 0;
struct FackTermDev
{
int dev;
};
#endif
#ifdef USE_GPIO_SERIAL
//modified by zhanghualiang
//this function is for parallel port to send and received data
@ -431,7 +445,7 @@ superio_reinit();
memorysize = memsz > 240 ? 240 << 20 : memsz << 20;
#endif
memorysize_high = memsz > 240 ? (((unsigned long long)memsz) - 240) << 20 : 0;
mem_size = memsz;
#if 0 /* whd : Disable gpu controller of MCP68 */
//*(unsigned int *)0xbfe809e8 = 0x122380;
//*(unsigned int *)0xbfe809e8 = 0x2280;
@ -590,14 +604,9 @@ unsigned int addr;
extern void vt82c686_init(void);
int psaux_init(void);
extern int video_hw_init (void);
extern int init_win_device(void);
extern int fb_init(unsigned long,unsigned long);
int afxIsReturnToPmon = 0;
struct FackTermDev
{
int dev;
};
void
tgt_devconfig()
{
@ -729,15 +738,17 @@ tgt_devconfig()
// psaux_init();
#endif
#ifdef INTERFACE_3A780E
vga_available = 1;
kbd_available=1;
bios_available = 1; //support usb_kbd in bios
init_win_device();
// Ask user whether to set bios menu
#if 1
//#if 1
printf("Press <Del> to set BIOS,waiting for 3 seconds here..... \n");
#endif
//#endif
get_update(tmp_date);
for (ic = 0; ic < 11; ic++){
video_putchar1(2 + (len+2)*8+ic*8, 560, tmp_date[ic]);
@ -745,9 +756,9 @@ tgt_devconfig()
video_set_color(0xf);
vga_available = 0; //lwg close printf output
// init_win_device();
init_win_device();
vga_available = 0; //lwg close printf output
{
@ -837,7 +848,7 @@ run:
printf("devconfig done.\n");
}
#endif
extern int test_icache_1(short *addr);
extern int test_icache_2(int addr);
extern int test_icache_3(int addr);

8
fb/cfb_console.c

@ -753,10 +753,12 @@ void video_putchar (int xx, int yy, unsigned char c)
{
video_drawchars (xx, yy + VIDEO_LOGO_HEIGHT, &c, 1);
}
#ifdef INTERFACE_3A780E
void video_putchar1(int xx, int yy, unsigned char c)
{
video_drawchars (xx, yy, &c, 1);
}
#endif
void video_putchar_xor (int xx, int yy, unsigned char c)
{
video_drawchars_xor (xx, yy + VIDEO_LOGO_HEIGHT, &c, 1);
@ -1530,6 +1532,7 @@ SWAP16 ((unsigned short) (((255 >> 3) << 11) | ((255 >> 2) << 5) | (0 >> 3))),
SWAP16 ((unsigned short) (((255 >> 3) << 11) | ((255 >> 2) << 5) | (255 >> 3)))
};
#ifdef INTERFACE_3A780E
void video_set_color(unsigned char color)
{
#ifndef FB_MENU_NOCLOLOR
@ -1540,7 +1543,7 @@ void video_set_color(unsigned char color)
eorx = fgx ^ bgx;
#endif
}
#endif
static void __cprint(int y, int x,int width,char color, const char *buf)
{
#ifndef FB_MENU_NOCLOLOR
@ -1582,6 +1585,7 @@ void set_cursor_fb(unsigned char x,unsigned char y)
}
/*****************************************************************************/
#if 0
void get_screen_address(int xx,int yy)
{
long dest0;
@ -1590,7 +1594,7 @@ dest0 = video_fb_address + offset;
return dest0;
}
#endif
int fb_init (unsigned long fbbase,unsigned long iobase)
{
unsigned char color8;

1338
pmon/cmds/cmd_main/cmd_main.c

File diff suppressed because it is too large

6
pmon/cmds/cmd_main/cmd_main.h

@ -45,6 +45,8 @@ struct win_para {
char w_kpara[128];
char vendor[40+1];
int capacity; //unit GB
char dev_name[5]; /* Lc add */
int w_used; /* Lc add */
};
/* discripte find device
* win_mask : 1_bit : usb0, 2_bit : wd0, 3_bit : sata0, 4_bit : sata1
@ -54,7 +56,11 @@ struct win_device {
char win_mask;
struct win_para sata0;
struct win_para sata1;
struct win_para sata2; /* Lc add */
struct win_para sata3; /* Lc add */
struct win_para ide;
struct win_para ide0; /* Lc add */
struct win_para ide1; /* Lc add */
struct win_para usb;
};

2
pmon/cmds/cmd_main/window.c

@ -215,7 +215,7 @@ void w_leaveconsole()
#endif
}
void ww_init(void)
void win_init(void)
{
int i,j;
tty_flush();

2
pmon/cmds/cmd_main/window.h

@ -43,7 +43,7 @@
#define HINT_WIN_HEIGHT (VIDEO_HEIGHT - 6)//31
void w_present(void);
void ww_init(void);
void win_init(void);
void w_enterconsole(void);
void w_leaveconsole(void);

1
pmon/dev/kbd.c

@ -490,6 +490,7 @@ static inline void handle_mouse_event(unsigned char scancode);
#define KEYBUFF_LEN 64
#define KEYBUFF_MASK (KEYBUFF_LEN-1)
static unsigned char scancode_queue[KEYBUFF_LEN];
static unsigned int scancode_writeptr=0;
static unsigned int scancode_readptr=0;
void scancode_queue_init()

3
pmon/fs/termio.c

@ -620,6 +620,7 @@ static void
term_open(5, "/dev/tty2", 0, 0); /* vgaout */
}
#ifdef INTERFACE_3A780E
void tty_flush()
{
int cnt;
@ -632,7 +633,7 @@ void tty_flush()
scancode_queue_init();
}
#endif
void *restdout(int (*newwrite) (int fd, const void *buf, size_t n))

31
sys/dev/ata/wd.c

@ -139,6 +139,14 @@ extern int wdcdebug_wd_mask; /* init'ed in ata_wdc.c */
#define readdisklabel(x1, x2, x3, x4, x5) "no label"
#endif
#ifdef INTERFACE_3A780E
#define DEV_MAX_NUM 8
int drivnum[DEV_MAX_NUM] = {-1};
int b_channel[DEV_MAX_NUM] = {-1};
char b_dev_name[DEV_MAX_NUM][41];
unsigned long b_hdsize[DEV_MAX_NUM];
#endif
struct wd_softc {
/* General disk infos */
struct device sc_dev;
@ -163,7 +171,12 @@ struct wd_softc {
#define WDF_WAIT 0x20 /* waiting for resources */
#define WDF_LBA 0x40 /* using LBA mode */
#ifdef INTERFACE_3A780E
unsigned long sc_capacity; /* disk size Lc modify */
#else
int sc_capacity;
#endif
int cyl; /* actual drive parameters */
int heads;
int sectors;
@ -272,6 +285,13 @@ wdprobe(parent, match_, aux)
struct ata_atapi_attach *aa_link = aux;
struct cfdata *match = match_;
#ifdef INTERFACE_3A780E
static int i = 0;
drivnum[i] = aa_link->aa_drv_data->drive;
b_channel[i] = aa_link->aa_channel;
i++;
#endif
if (aa_link == NULL)
return 0;
if (aa_link->aa_type != T_ATA)
@ -307,6 +327,9 @@ wdattach(parent, self, aux)
struct ata_atapi_attach *aa_link= aux;
int i, blank;
char buf[41], c, *p, *q;
#ifdef INTERFACE_3A780E
static int j = 0;
#endif
WDCDEBUG_PRINT(("wdattach\n"), DEBUG_FUNCS | DEBUG_PROBE);
wd->openings = aa_link->aa_openings;
@ -338,6 +361,10 @@ wdattach(parent, self, aux)
}
*q++ = '\0';
#ifdef INTERFACE_3A780E
strcpy(b_dev_name[j], buf);
#endif
printf(": <%s>\n", buf);
wdc_probe_caps(wd->drvp, &wd->sc_params);
@ -383,6 +410,10 @@ wdattach(parent, self, aux)
wd->sc_params.atap_sectors,
wd->sc_capacity);
}
#ifdef INTERFACE_3A780E
b_hdsize[j] = wd->sc_capacity;
j++
#endif
WDCDEBUG_PRINT(("%s: atap_dmatiming_mimi=%d, atap_dmatiming_recom=%d\n",
self->dv_xname, wd->sc_params.atap_dmatiming_mimi,
wd->sc_params.atap_dmatiming_recom), DEBUG_PROBE);

10
sys/dev/pci/rtl8168.c

@ -436,6 +436,14 @@ r8168_attach(struct device * parent, struct device * self, void *aux)
data2 = read_eeprom(tp, 9);
tp->dev_addr[4] = 0xff & data2;
tp->dev_addr[5] = 0xff & (data2 >> 8);
#ifdef INTERFACE_3A780E
{
int i = 0;
for (; i < 6; i++) {
MACAddr0[i] = tp->dev_addr[i];
}
}
#endif
RTL_W8(tp, Cfg9346, Cfg9346_Unlock);
MAC = data | data1 <<16;
@ -519,7 +527,7 @@ r8168_attach(struct device * parent, struct device * self, void *aux)
return;
}
//intrstr = pci_intr_st//ring(pc, ih);
intrstr = pci_intr_string(pc, ih);
status = RTL_R16(tp, IntrStatus);
tp->sc_ih = pci_intr_establish(pc, ih, IPL_NET, rtl8168_interrupt, tp, self->dv_xname);
#if 0

21
sys/kern/subr_autoconf.c

@ -63,6 +63,11 @@
/*
* Autoconfiguration subroutines.
*/
#ifdef INTERFACE_3A780E
#define DEV_MAX_NUM 8
char *b_name[DEV_MAX_NUM];
int b_idenum[DEV_MAX_NUM];
#endif
typedef int (*cond_predicate_t) __P((struct device *, void *));
@ -406,6 +411,22 @@ config_attach(parent, match, aux, print)
if (parent == ROOT)
printf("%s (root)", dev->dv_xname);
else {
#ifdef INTERFACE_3A780E
{
static i = 0;
if (strstr(dev->dv_xname, "wd") != NULL || strstr(dev->dv_xname, "cd") != NULL || strstr(dev->dv_xname,"usb") != NULL) {
/* use for BIOS code find the drive */
b_name[i] = dev->dv_xname;
if (strstr(parent->dv_xname, "pciide") != NULL) {
/* use for BIOS code to differentiate the IDE controller or SATA controller. b_idenum = 0 : SATA controller, b_idenum = 1 : IDE controller */
b_idenum[i] = parent->dv_xname[6] - 48;
}
i++;
}
b_name[i] = NULL;
}
#endif
printf("%s at %s", dev->dv_xname, parent->dv_xname);
if (print)
(void) (*print)(aux, (char *)0);

7
sys/sys/atapi.h

@ -0,0 +1,7 @@
#ifndef __ATAPI_H__
#define __ATAPI_H__
struct atapit{
char isatapi;
char devnu;
};
#endif
Loading…
Cancel
Save