#ifndef NETBOOT_H #define NETBOOT_H #include #include /* Self-update over the BBA: receive a .dol via raw ethernet and launch it. * * Deliberately NOT built on an IP stack. Frames carry a private ethertype * and a 12-byte header, so there is no ARP, no IP, no checksums and no * libogc network driver competing with us for the EXI channel -- it reuses * exactly the two paths the test suite already proves on hardware: * bba_tx_bytes() for TX and the SPRAM ring at RRP for RX. * * The transfer is STOP-AND-WAIT (one block in flight, ACKed before the next). * That is not just simplicity: the gateware does not consume RRP, so * RXFrameAssembler can overwrite ring pages the GC has not read yet. One * block in flight means the ring never has more than one frame outstanding, * so the missing overflow protection cannot bite. Do not "optimise" this * into a sliding window without adding RBFI-style protection first. */ #define NB_ETHERTYPE 0x88B5u /* IEEE 802 local experimental ethertype 1 */ #define NB_MAGIC 0x47435550u /* "GCUP" */ #define NB_OP_DATA 0x01u /* host -> GC: one block */ #define NB_OP_ACK 0x02u /* GC -> host: block received */ #define NB_OP_DONE 0x03u /* host -> GC: transfer complete, launch */ #define NB_BLOCK_MAX 1024u /* payload bytes per frame */ /* Receive a .dol into `dst`. Returns its length, or <0 on error. * `status` (optional) is called with a human-readable progress line. */ int netboot_receive(void *dst, u32 maxlen, void (*status)(const char *msg)); /* Launch a .dol image already in memory. Does not return on success. * Returns <0 if the image is not a plausible DOL. */ int netboot_launch(const void *dol); #endif