mirror of
https://github.com/xcat2/xNBA.git
synced 2024-12-14 07:11:32 +00:00
Added back in the actual call to load().
This commit is contained in:
parent
e301acc0d4
commit
fda36a0c1a
@ -187,24 +187,36 @@ int main ( void ) {
|
||||
/* Skip this device the next time we encounter it */
|
||||
skip = 1;
|
||||
|
||||
/* Print out what we're doing */
|
||||
printf ( "Booting from %s %s at %s "
|
||||
"using the %s driver\n",
|
||||
/* Print out device information */
|
||||
printf ( "%s (%s) %s at %s\n",
|
||||
dev.bus_driver->name_device ( &dev.bus_dev ),
|
||||
dev.device_driver->name,
|
||||
dev.type_driver->name,
|
||||
dev.bus_driver->describe_device ( &dev.bus_dev ),
|
||||
dev.device_driver->name );
|
||||
dev.bus_driver->describe_device ( &dev.bus_dev ) );
|
||||
|
||||
/* Probe boot device */
|
||||
if ( ! probe ( &dev ) ) {
|
||||
/* Device found on bus, but probe failed */
|
||||
printf ( "...probe failed on %s\n" );
|
||||
printf ( "...probe failed\n" );
|
||||
continue;
|
||||
}
|
||||
|
||||
printf ( "%s: %s\n",
|
||||
|
||||
/* Print out device information */
|
||||
printf ( "%s %s has %s\n",
|
||||
dev.bus_driver->name_device ( &dev.bus_dev ),
|
||||
dev.type_driver->name,
|
||||
dev.type_driver->describe_device ( dev.type_dev ) );
|
||||
|
||||
/* Configure boot device */
|
||||
if ( ! configure ( &dev ) ) {
|
||||
/* Configuration (e.g. DHCP) failed */
|
||||
printf ( "...configuration failed\n" );
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Boot from the device */
|
||||
load ( &dev, load_block );
|
||||
|
||||
}
|
||||
|
||||
/* Call registered per-object exit functions */
|
||||
@ -391,8 +403,10 @@ static const struct proto protos[] = {
|
||||
#endif
|
||||
};
|
||||
|
||||
int loadkernel(const char *fname)
|
||||
{
|
||||
int loadkernel ( const char *fname,
|
||||
int ( * load_block ) ( unsigned char *data,
|
||||
unsigned int blocknum,
|
||||
unsigned int len, int eof ) ) {
|
||||
static const struct proto * const last_proto =
|
||||
&protos[sizeof(protos)/sizeof(protos[0])];
|
||||
const struct proto *proto;
|
||||
|
@ -234,7 +234,8 @@ static unsigned short tcpudpchksum(struct iphdr *ip);
|
||||
/*
|
||||
* Find out what our boot parameters are
|
||||
*/
|
||||
static int nic_load_configuration ( struct nic *nic ) {
|
||||
static int nic_configure ( struct type_dev *type_dev ) {
|
||||
struct nic *nic = ( struct nic * ) type_dev;
|
||||
int server_found;
|
||||
|
||||
if ( ! nic->nic_op->connect ( nic ) ) {
|
||||
@ -262,16 +263,7 @@ static int nic_load_configuration ( struct nic *nic ) {
|
||||
printf("No Server found\n");
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
LOAD - Try to get booted
|
||||
**************************************************************************/
|
||||
static int nic_load(struct dev *dev __unused)
|
||||
{
|
||||
const char *kernel;
|
||||
printf("\nMe: %@", arptable[ARP_CLIENT].ipaddr.s_addr );
|
||||
#ifndef NO_DHCP_SUPPORT
|
||||
printf(", DHCP: %@", dhcp_server );
|
||||
@ -297,6 +289,19 @@ static int nic_load(struct dev *dev __unused)
|
||||
printf("\n=>>"); getchar();
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
LOAD - Try to get booted
|
||||
**************************************************************************/
|
||||
static int nic_load ( struct type_dev *type_dev,
|
||||
int ( * process ) ( unsigned char *data,
|
||||
unsigned int blocknum,
|
||||
unsigned int size, int eof ) ) {
|
||||
const char *kernel;
|
||||
|
||||
/* Now use TFTP to load file */
|
||||
#ifdef DOWNLOAD_PROTO_NFS
|
||||
rpc_init();
|
||||
@ -309,7 +314,7 @@ static int nic_load(struct dev *dev __unused)
|
||||
#endif
|
||||
: KERNEL_BUF;
|
||||
if ( kernel ) {
|
||||
loadkernel(kernel); /* We don't return except on error */
|
||||
loadkernel(kernel,process); /* We don't return except on error */
|
||||
printf("Unable to load file.\n");
|
||||
} else {
|
||||
printf("No filename\n");
|
||||
@ -343,6 +348,8 @@ struct type_driver nic_driver = {
|
||||
.name = "NIC",
|
||||
.type_dev = ( struct type_dev * ) &nic,
|
||||
.describe_device = nic_describe_device,
|
||||
.configure = nic_configure,
|
||||
.load = nic_load,
|
||||
};
|
||||
|
||||
/* Careful. We need an aligned buffer to avoid problems on machines
|
||||
|
@ -180,6 +180,11 @@ struct type_driver {
|
||||
char *name;
|
||||
struct type_dev *type_dev; /* single instance */
|
||||
char * ( * describe_device ) ( struct type_dev *type_dev );
|
||||
int ( * configure ) ( struct type_dev *type_dev );
|
||||
int ( * load ) ( struct type_dev *type_dev,
|
||||
int ( * process ) ( unsigned char *data,
|
||||
unsigned int blocknum,
|
||||
unsigned int len, int eof ) );
|
||||
};
|
||||
|
||||
#define __type_driver __attribute__ (( used, __section__ ( ".drivers.type" ) ))
|
||||
@ -266,6 +271,17 @@ static inline void select_device ( struct dev *dev,
|
||||
dev->bus_driver = bus_driver;
|
||||
memcpy ( &dev->bus_loc, bus_loc, sizeof ( dev->bus_loc ) );
|
||||
}
|
||||
/* Configure a device */
|
||||
static inline int configure ( struct dev *dev ) {
|
||||
return dev->type_driver->configure ( dev->type_dev );
|
||||
}
|
||||
/* Boot from a device */
|
||||
static inline int load ( struct dev *dev,
|
||||
int ( * process ) ( unsigned char *data,
|
||||
unsigned int blocknum,
|
||||
unsigned int len, int eof ) ) {
|
||||
return dev->type_driver->load ( dev->type_dev, process );
|
||||
}
|
||||
|
||||
/* Linker symbols for the various tables */
|
||||
extern struct bus_driver bus_drivers[];
|
||||
|
@ -182,7 +182,7 @@ External prototypes
|
||||
/* main.c */
|
||||
struct Elf_Bhdr;
|
||||
extern int main();
|
||||
extern int loadkernel P((const char *fname));
|
||||
extern int loadkernel P((const char *fname, int (*)(unsigned char *, unsigned int, unsigned int, int)));
|
||||
extern char as_main_program;
|
||||
/* nic.c */
|
||||
extern void rx_qdrain P((void));
|
||||
|
Loading…
Reference in New Issue
Block a user