Create Open firmware pseudo driver.

Change ofnet.c to disknet.c and remove almost all ieee1275 specific code.
Create grub_net_malloc to handle iee1275 memory issues in a temporary solution.
This commit is contained in:
Manoel R. Abranches 2010-09-15 13:23:23 -03:00
parent 9a9cee4e43
commit 87fdc7e8d2
15 changed files with 272 additions and 190 deletions

View file

@ -24,7 +24,6 @@
#include <grub/types.h>
#include <grub/machine/ieee1275.h>
/* Maps a device alias to a pathname. */
struct grub_ieee1275_devalias
{
char *name;
@ -65,6 +64,13 @@ struct grub_ieee1275_common_hdr
typedef grub_uint32_t grub_ieee1275_ihandle_t;
typedef grub_uint32_t grub_ieee1275_phandle_t;
struct grub_ofnetcard_data
{
char *path;
grub_ieee1275_ihandle_t handle;
};
/* Maps a device alias to a pathname. */
extern grub_ieee1275_phandle_t EXPORT_VAR(grub_ieee1275_chosen);
extern grub_ieee1275_ihandle_t EXPORT_VAR(grub_ieee1275_mmu);
extern int (* EXPORT_VAR(grub_ieee1275_entry_fn)) (void *);
@ -186,4 +192,6 @@ int EXPORT_FUNC(grub_ieee1275_devices_iterate) (int (*hook)
(struct grub_ieee1275_devalias *
alias));
char *EXPORT_FUNC(grub_ieee1275_get_aliasdevname) (const char *path);
void EXPORT_FUNC(grub_ofnet_findcards) (void);
void EXPORT_FUNC(grub_ofnet_probecards) (void);
#endif /* ! GRUB_IEEE1275_HEADER */

View file

@ -23,32 +23,9 @@
#include <grub/err.h>
#include <grub/types.h>
extern void grub_ofnet_init(void);
extern void grub_ofnet_fini(void);
void grub_ofnet_init(void);
void grub_ofnet_fini(void);
/*
struct grub_net;
struct grub_net_dev
{
/ The device name. /
const char *name;
/ FIXME: Just a template. /
int (*probe) (struct grub_net *net, const void *addr);
void (*reset) (struct grub_net *net);
int (*poll) (struct grub_net *net);
void (*transmit) (struct grub_net *net, const void *destip,
unsigned srcsock, unsigned destsock, const void *packet);
void (*disable) (struct grub_net *net);
/ The next net device. /
struct grub_net_dev *next;
};
typedef struct grub_net_dev *grub_net_dev_t;
struct grub_fs;
*/
struct grub_ofnet
{
/* The net name. */
@ -85,7 +62,7 @@ struct grub_bootp {
char file [128]; /* Boot filename */
// grub_uint32_t filesize ; /*File size (testing)*/
unsigned char vend [64];
};
};
typedef struct grub_bootp* grub_bootp_t;

View file

@ -0,0 +1,5 @@
#ifndef GRUB_DISKNET_HEADER
#define GRUB_DISKNET_HEADER 1
void grub_disknet_init(void);
void grub_disknet_fini(void);
#endif /* ! GRUB_NET_HEADER */

View file

@ -10,9 +10,18 @@ struct etherhdr
grub_uint16_t type;
} __attribute__ ((packed));
#define PCP (x) x & 0xe000
#define CFI (x) x & 0x1000
#define VID (x) x & 0x0fff
#define PCP(x) x & 0xe000
#define CFI(x) x & 0x1000
#define VID(x) x & 0x0fff
#define PRINT_ETH_ADDR(name,addr) grub_printf("%s %x:%x:%x:%x:%x:%x\n",\
name,\
addr[0],\
addr[1],\
addr[2],\
addr[3],\
addr[4],\
addr[5]\
)
struct llchdr
{

View file

@ -6,14 +6,5 @@
#include <grub/ieee1275/ofnet.h>
#include <grub/net/netbuff.h>
grub_ofnet_t grub_net;
grub_bootp_t bootp_pckt;
int send_card_buffer (struct grub_net_buff *pack);
int get_card_packet (struct grub_net_buff *pack);
int card_open (void);
int card_close (void);
#endif

9
include/grub/net/mem.h Normal file
View file

@ -0,0 +1,9 @@
#ifndef GRUB_NETMM_H
#define GRUB_NETMM_H 1
#include <grub/types.h>
#include <grub/symbol.h>
void *EXPORT_FUNC(grub_net_malloc) (grub_size_t size);
#endif /* ! GRUB_MM_H */