mac68k: Miscellaneous fixes, cleanup and modernization
Subsystems (3)
cover mac68k: Miscellaneous fixes, cleanup and modernization
This series has various patches from several different people. Two printk modernization patches were originally from Geert Uytterhoeven and three Nubus patches were originally committed to the Linux/mac68k CVS by David Huggins-Daines.
Finn Thain (10):
m68k/mac: IOP - Modernize printing of kernel messages m68k/mac: Modernize printing of kernel messages m68k/mac: Adopt platform_device_register_simple() m68k/mac: Clarify IOP message alloc/free confusion
nubus: Fix nubus_rewinddir (from mac68k CVS)
nubus: Remove slot zero probe (from mac68k CVS)
nubus: Clean up printk calls (from mac68k CVS)
nubus: Fix pointer validation
nubus: Clean up whitespace
nubus: Add MVC and VSC video card definitions
arch/m68k/mac/config.c | 61 ++--- arch/m68k/mac/iop.c | 93 +++----- arch/m68k/mac/misc.c | 23 +- drivers/nubus/nubus.c | 556 +++++++++++++++++---------------------------- include/uapi/linux/nubus.h | 4 +- 5 files changed, 275 insertions(+), 462 deletions(-)
Signature · 1 line
2.10.2
PATCH 1/10 m68k/mac: IOP - Modernize printing of kernel messages
From: Geert Uytterhoeven <[email protected]>
- Introduce helpers for printing debug messages, incl. dummies for validating format strings when debugging is disabled,
- Convert from printk() to pr_*(),
- Add missing continuations,
- Drop superfluous casts.
[Renamed pr_iop* macros, adjusted log message severity and eliminated DEBUG_IOP. -- FT]
--- arch/m68k/mac/iop.c | 74 +++++++++++++++++++++-------------------------------- 1 file changed, 29 insertions(+), 45 deletions(-)
arch/m68k/mac/iop.c +29 -45
@@ -115,7 +115,17 @@#include <asm/macints.h> #include <asm/mac_iop.h> -/*#define DEBUG_IOP*/ +#ifdef DEBUG +#define iop_pr_debug (fmt, ...) \ + printk(KERN_DEBUG "%s: " fmt, __func__, ##__VA_ARGS__) +#define iop_pr_cont (fmt, ...) \ + printk(KERN_CONT fmt, ##__VA_ARGS__) +#else +#define iop_pr_debug (fmt, ...) \ + no_printk(KERN_DEBUG "%s: " fmt, __func__, ##__VA_ARGS__) +#define iop_pr_cont (fmt, ...) \ + no_printk(KERN_CONT fmt, ##__VA_ARGS__) +#endif /* Non-zero if the IOPs are present */
@@ -268,10 +278,10 @@ void __init iop_init(void)int i;if (iop_scc_present) { -printk ("IOP: detected SCC IOP at %p\n" , iop_base[IOP_NUM_SCC ]); +pr_info ("IOP: detected SCC IOP at %p\n" , iop_base[IOP_NUM_SCC ]); }if (iop_ism_present) { -printk ("IOP: detected ISM IOP at %p\n" , iop_base[IOP_NUM_ISM ]); +pr_info ("IOP: detected ISM IOP at %p\n" , iop_base[IOP_NUM_ISM ]);iop_start (iop_base[IOP_NUM_ISM ]);iop_alive (iop_base[IOP_NUM_ISM ]);/* clears the alive flag */ }
@@ -310,9 +320,9 @@ void __init iop_register_interrupts(void)pr_err ("Couldn't register ISM IOP interrupt\n" ); }if (!iop_alive (iop_base[IOP_NUM_ISM ])) { -printk ("IOP: oh my god, they killed the ISM IOP!\n" ); +pr_warn ("IOP: oh my god, they killed the ISM IOP!\n" ); }else { -printk ("IOP: the ISM IOP seems to be alive.\n" ); +pr_warn ("IOP: the ISM IOP seems to be alive.\n" ); } } }
@@ -349,9 +359,8 @@ void iop_complete_message(struct iop_msg *msg)int chan = msg->channel;int i,offset; -#ifdef DEBUG_IOP -printk ("iop_complete(%p): iop %d chan %d\n" , msg, msg->iop_num, msg->channel); -#endif +iop_pr_debug ("msg %p iop_num %d channel %d\n" , msg, msg->iop_num, + msg->channel); offset =IOP_ADDR_RECV_MSG + (msg->channel *IOP_MSG_LEN );
@@ -397,9 +406,7 @@ static void iop_handle_send(uint iop_num, uint chan)struct iop_msg *msg,*msg2;int i,offset; -#ifdef DEBUG_IOP -printk ("iop_handle_send: iop %d channel %d\n" , iop_num, chan); -#endif +iop_pr_debug ("iop_num %d chan %d\n" , iop_num, chan);iop_writeb (iop,IOP_ADDR_SEND_STATE + chan,IOP_MSG_IDLE );
@@ -430,9 +437,7 @@ static void iop_handle_recv(uint iop_num, uint chan)int i,offset;struct iop_msg *msg; -#ifdef DEBUG_IOP -printk ("iop_handle_recv: iop %d channel %d\n" , iop_num, chan); -#endif +iop_pr_debug ("iop_num %d chan %d\n" , iop_num, chan); msg =iop_alloc_msg (); msg->iop_num = iop_num;
@@ -454,14 +459,9 @@ static void iop_handle_recv(uint iop_num, uint chan)if (msg->handler) { (*msg->handler)(msg); }else { -#ifdef DEBUG_IOP -printk ("iop_handle_recv: unclaimed message on iop %d channel %d\n" , iop_num, chan); -printk ("iop_handle_recv:" ); -for (i =0 ; i <IOP_MSG_LEN ; i++) { -printk (" %02X" , (uint ) msg->message[i]); - } -printk ("\n" ); -#endif +iop_pr_debug ("unclaimed message on iop_num %d chan %d\n" , + iop_num, chan); +iop_pr_debug ("%*ph\n" ,IOP_MSG_LEN , msg->message);iop_complete_message (msg); } }
@@ -574,50 +574,34 @@ irqreturn_t iop_ism_irq(int irq, void *dev_id)volatile struct mac_iop *iop = iop_base[iop_num];int i,state; -#ifdef DEBUG_IOP -printk ("iop_ism_irq: status = %02X\n" , (uint ) iop->status_ctrl); -#endif +iop_pr_debug ("status %02X\n" , iop->status_ctrl);/* INT0 indicates a state change on an outgoing message channel */ if (iop->status_ctrl &IOP_INT0 ) { iop->status_ctrl =IOP_INT0 |IOP_RUN |IOP_AUTOINC ; -#ifdef DEBUG_IOP -printk ("iop_ism_irq: new status = %02X, send states" , - (uint ) iop->status_ctrl); -#endif +iop_pr_debug ("new status %02X, send states" , iop->status_ctrl);for (i =0 ; i <NUM_IOP_CHAN ; i++) { state =iop_readb (iop,IOP_ADDR_SEND_STATE + i); -#ifdef DEBUG_IOP -printk (" %02X" , state); -#endif +iop_pr_cont (" %02X" , state);if (state ==IOP_MSG_COMPLETE ) {iop_handle_send (iop_num, i); } } -#ifdef DEBUG_IOP -printk ("\n" ); -#endif +iop_pr_cont ("\n" ); }if (iop->status_ctrl &IOP_INT1 ) {/* INT1 for incoming msgs */ iop->status_ctrl =IOP_INT1 |IOP_RUN |IOP_AUTOINC ; -#ifdef DEBUG_IOP -printk ("iop_ism_irq: new status = %02X, recv states" , - (uint ) iop->status_ctrl); -#endif +iop_pr_debug ("new status %02X, recv states" , iop->status_ctrl);for (i =0 ; i <NUM_IOP_CHAN ; i++) { state =iop_readb (iop,IOP_ADDR_RECV_STATE + i); -#ifdef DEBUG_IOP -printk (" %02X" , state); -#endif +iop_pr_cont (" %02X" , state);if (state ==IOP_MSG_NEW ) {iop_handle_recv (iop_num, i); } } -#ifdef DEBUG_IOP -printk ("\n" ); -#endif +iop_pr_cont ("\n" ); }return IRQ_HANDLED ; }
Signature · 1 line
2.10.2
PATCH 2/10 m68k/mac: Modernize printing of kernel messages
In reply to Finn ThainFrom: Geert Uytterhoeven <[email protected]>
Convert from printk() to pr_*().
[Adjusted log message severity levels and retained bootinfo log. -- FT]
--- arch/m68k/mac/config.c | 12 +++++------- arch/m68k/mac/misc.c | 23 +++++++++-------------- 2 files changed, 14 insertions(+), 21 deletions(-)
arch/m68k/mac/config.c +5 -7
@@ -150,7 +150,7 @@ static void mac_cache_card_flush(int writeback)void __init config_mac (void ) {if (!MACH_IS_MAC ) -printk (KERN_ERR "ERROR: no Mac, but config_mac() called!!\n" ); +pr_err ("ERROR: no Mac, but config_mac() called!!\n" ); mach_sched_init = mac_sched_init; mach_init_IRQ = mac_init_IRQ;
@@ -837,8 +837,7 @@ static void __init mac_identify(void)/* no bootinfo model id -> NetBSD booter was used! */ /* XXX FIXME: breaks for model > 31 */ model = (mac_bi_data.cpuid >>2 ) &63 ; -printk (KERN_WARNING "No bootinfo model ID, using cpuid instead " -"(obsolete bootloader?)\n" ); +pr_warn ("No bootinfo model ID, using cpuid instead (obsolete bootloader?)\n" ); } macintosh_config = mac_data_table;
@@ -880,14 +879,13 @@ static void __init mac_identify(void)*/ iop_preinit (); -printk (KERN_INFO "Detected Macintosh model: %d\n" , model); +pr_info ("Detected Macintosh model: %d\n" , model);/* * Report booter data: */ printk (KERN_DEBUG " Penguin bootinfo data:\n" ); -printk (KERN_DEBUG " Video: addr 0x%lx " -"row 0x%lx depth %lx dimensions %ld x %ld\n" , +printk (KERN_DEBUG " Video: addr 0x%lx row 0x%lx depth %lx dimensions %ld x %ld\n" , mac_bi_data.videoaddr, mac_bi_data.videorow, mac_bi_data.videodepth, mac_bi_data.dimensions &0xFFFF , mac_bi_data.dimensions >>16 );
@@ -912,7 +910,7 @@ static void __init mac_identify(void)static void __init mac_report_hardware (void ) { -printk (KERN_INFO "Apple Macintosh %s\n" , macintosh_config->name); +pr_info ("Apple Macintosh %s\n" , macintosh_config->name); }static void mac_get_model (char *str)
arch/m68k/mac/misc.c +9 -14
@@ -281,8 +281,7 @@ static long via_read_time(void) last_result.idata = result.idata; } -pr_err ("via_read_time: failed to read a stable value; " -"got 0x%08lx then 0x%08lx\n" , +pr_err ("via_read_time: failed to read a stable value; got 0x%08lx then 0x%08lx\n" , last_result.idata, result.idata);return 0 ;
@@ -465,7 +464,7 @@ void mac_poweroff(void)#endif }local_irq_enable (); -printk ("It is now safe to turn off your Macintosh.\n" ); +pr_crit ("It is now safe to turn off your Macintosh.\n" );while (1 ); }
@@ -556,7 +555,7 @@ void mac_reset(void)/* should never get here */ local_irq_enable (); -printk ("Restart failed. Please restart manually.\n" ); +pr_crit ("Restart failed. Please restart manually.\n" );while (1 ); }
@@ -661,17 +660,13 @@ int mac_hwclk(int op, struct rtc_time *t)unmktime (now,0 , &t->tm_year, &t->tm_mon, &t->tm_mday, &t->tm_hour, &t->tm_min, &t->tm_sec); -#if 0 -printk ("mac_hwclk: read %04d-%02d-%-2d %02d:%02d:%02d\n" , - t->tm_year +1900 , t->tm_mon +1 , t->tm_mday, - t->tm_hour, t->tm_min, t->tm_sec); -#endif +pr_debug ("%s: read %04d-%02d-%-2d %02d:%02d:%02d\n" , + __func__, t->tm_year +1900 , t->tm_mon +1 , t->tm_mday, + t->tm_hour, t->tm_min, t->tm_sec); }else {/* write */ -#if 0 -printk ("mac_hwclk: tried to write %04d-%02d-%-2d %02d:%02d:%02d\n" , - t->tm_year +1900 , t->tm_mon +1 , t->tm_mday, - t->tm_hour, t->tm_min, t->tm_sec); -#endif +pr_debug ("%s: tried to write %04d-%02d-%-2d %02d:%02d:%02d\n" , + __func__, t->tm_year +1900 , t->tm_mon +1 , t->tm_mday, + t->tm_hour, t->tm_min, t->tm_sec); now =mktime (t->tm_year +1900 , t->tm_mon +1 , t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
Signature · 1 line
2.10.2
PATCH 3/10 m68k/mac: Adopt platform_device_register_simple()
In reply to Finn ThainThese changes save 1014 bytes according to scripts/bloat-o-meter.
--- arch/m68k/mac/config.c | 49 ++++++++++++------------------------------------- 1 file changed, 12 insertions(+), 37 deletions(-)
arch/m68k/mac/config.c +12 -37
@@ -919,15 +919,6 @@ static void mac_get_model(char *str)strcat (str, macintosh_config->name); } -static struct resource swim_rsrc = { .flags =IORESOURCE_MEM }; - -static struct platform_device swim_pdev = { - .name ="swim" , - .id =-1 , - .num_resources =1 , - .resource = &swim_rsrc, -}; -static const struct resource mac_scsi_iifx_rsrc[]__initconst = { { .flags =IORESOURCE_IRQ ,
@@ -992,26 +983,6 @@ static const struct resource mac_scsi_ccl_rsrc[] __initconst = { }, }; -static struct platform_device esp_0_pdev = { - .name ="mac_esp" , - .id =0 , -}; - -static struct platform_device esp_1_pdev = { - .name ="mac_esp" , - .id =1 , -}; - -static struct platform_device sonic_pdev = { - .name ="macsonic" , - .id =-1 , -}; - -static struct platform_device mace_pdev = { - .name ="macmace" , - .id =-1 , -}; -int __init mac_platform_init (void ) {u8 *swim_base;
@@ -1043,9 +1014,13 @@ int __init mac_platform_init(void) }if (swim_base) { - swim_rsrc.start = (resource_size_t ) swim_base, - swim_rsrc.end = (resource_size_t ) swim_base +0x2000 , -platform_device_register (&swim_pdev); +struct resource swim_rsrc = { + .flags =IORESOURCE_MEM , + .start = (resource_size_t )swim_base, + .end = (resource_size_t )swim_base +0x2000 , + }; + +platform_device_register_simple ("swim" ,-1 , &swim_rsrc,1 ); }/*
@@ -1055,13 +1030,13 @@ int __init mac_platform_init(void)switch (macintosh_config->scsi_type) {case MAC_SCSI_QUADRA :case MAC_SCSI_QUADRA3 : -platform_device_register (&esp_0_pdev); +platform_device_register_simple ("mac_esp" ,0 ,NULL ,0 );break ;case MAC_SCSI_QUADRA2 : -platform_device_register (&esp_0_pdev); +platform_device_register_simple ("mac_esp" ,0 ,NULL ,0 );if ((macintosh_config->ident ==MAC_MODEL_Q900 ) || (macintosh_config->ident ==MAC_MODEL_Q950 )) -platform_device_register (&esp_1_pdev); +platform_device_register_simple ("mac_esp" ,1 ,NULL ,0 );break ;case MAC_SCSI_IIFX :/* Addresses from The Guide to Mac Family Hardware.
@@ -1127,10 +1102,10 @@ int __init mac_platform_init(void)switch (macintosh_config->ether_type) {case MAC_ETHER_SONIC : -platform_device_register (&sonic_pdev); +platform_device_register_simple ("macsonic" ,-1 ,NULL ,0 );break ;case MAC_ETHER_MACE : -platform_device_register (&mace_pdev); +platform_device_register_simple ("macmace" ,-1 ,NULL ,0 );break ; }
Signature · 1 line
2.10.2
PATCH 4/10 m68k/mac: Clarify IOP message alloc/free confusion
In reply to Finn ThainThe alloc/free metaphor used for IOP messages is misleading and can cause mistakes like the pointless msg2 temporary variable. Use a more meaningful name to help simplify the code.
--- arch/m68k/mac/iop.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-)
arch/m68k/mac/iop.c +6 -13
@@ -210,7 +210,7 @@ static int iop_alive(volatile struct mac_iop *iop)return retval; } -static struct iop_msg *iop_alloc_msg (void ) +static struct iop_msg *iop_get_unused_msg (void ) {int i;unsigned long flags;
@@ -229,11 +229,6 @@ static struct iop_msg *iop_alloc_msg(void)return NULL ; } -static void iop_free_msg (struct iop_msg *msg) -{ - msg->status =IOP_MSGSTATUS_UNUSED ; -} -/* * This is called by the startup code before anything else. Its purpose * is to find and initialize the IOPs early in the boot sequence, so that
@@ -372,7 +367,7 @@ void iop_complete_message(struct iop_msg *msg) IOP_ADDR_RECV_STATE + chan, IOP_MSG_COMPLETE);iop_interrupt (iop_base[msg->iop_num]); -iop_free_msg (msg); + msg->status =IOP_MSGSTATUS_UNUSED ; }/*
@@ -403,7 +398,7 @@ static void iop_do_send(struct iop_msg *msg)static void iop_handle_send (uint iop_num,uint chan) {volatile struct mac_iop *iop = iop_base[iop_num]; -struct iop_msg *msg,*msg2; +struct iop_msg *msg;int i,offset;iop_pr_debug ("iop_num %d chan %d\n" , iop_num, chan);
@@ -418,10 +413,8 @@ static void iop_handle_send(uint iop_num, uint chan) msg->reply[i] =iop_readb (iop, offset); }if (msg->handler) (*msg->handler)(msg); - msg2 = msg; + msg->status =IOP_MSGSTATUS_UNUSED ; msg = msg->next; -iop_free_msg (msg2); - iop_send_queue[iop_num][chan] = msg;if (msg)iop_do_send (msg); }
@@ -439,7 +432,7 @@ static void iop_handle_recv(uint iop_num, uint chan)iop_pr_debug ("iop_num %d chan %d\n" , iop_num, chan); - msg =iop_alloc_msg (); + msg =iop_get_unused_msg (); msg->iop_num = iop_num; msg->channel = chan; msg->status =IOP_MSGSTATUS_UNSOL ;
@@ -484,7 +477,7 @@ int iop_send_message(uint iop_num, uint chan, void *privdata,if (chan >=NUM_IOP_CHAN )return -EINVAL ;if (msg_len >IOP_MSG_LEN )return -EINVAL ; - msg =iop_alloc_msg (); + msg =iop_get_unused_msg ();if (!msg)return -ENOMEM ; msg->next =NULL ;
Signature · 1 line
2.10.2
PATCH 5/10 nubus: Fix nubus_rewinddir (from mac68k CVS)
In reply to Finn ThainFrom: David Huggins-Daines <[email protected]>
A long forgotten fix from the linux-mac68k CVS:
Initialize dir->done pointer in nubus_rewinddir().
The original commit is here:
--- drivers/nubus/nubus.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/nubus/nubus.c +2 -0
@@ -285,6 +285,8 @@ EXPORT_SYMBOL(nubus_readdir);int nubus_rewinddir (struct nubus_dir * dir) { dir->ptr = dir->base; + dir->done =0 ; +return 0 ; }EXPORT_SYMBOL (nubus_rewinddir);
Signature · 1 line
2.10.2
PATCH 6/10 nubus: Remove slot zero probe (from mac68k CVS)
In reply to Finn ThainFrom: David Huggins-Daines <[email protected]>
Some long forgotten changes from the linux-mac68k CVS:
Remove the slot 0 (ROM) probing.
Remove the pointless White Screen Of Death crap.
The original commit is here:
--- drivers/nubus/nubus.c | 112 +++----------------------------------------------- 1 file changed, 6 insertions(+), 106 deletions(-)
drivers/nubus/nubus.c +6 -106
@@ -13,7 +13,6 @@#include <linux/nubus.h> #include <linux/errno.h> #include <linux/init.h> -#include <linux/delay.h> #include <linux/module.h> #include <linux/slab.h> #include <asm/setup.h>
@@ -34,14 +33,6 @@ extern void oss_nubus_init(void);#define NUBUS_TEST_PATTERN 0x5A932BC7 -/* Define this if you like to live dangerously - it is known not to -work on pretty much every machine except the Quadra 630 and the LC -III. */ -#undef I_WANT_TO_PROBE_SLOT_ZERO - -/* This sometimes helps combat failure to boot */ -#undef TRY_TO_DODGE_WSOD -/* Globals */ struct nubus_dev * nubus_devices;
@@ -471,10 +462,6 @@ static struct nubus_dev* __initprintk (KERN_INFO " Function 0x%02x:\n" , parent->type);nubus_get_subdir (parent, &dir); -/* Apple seems to have botched the ROM on the IIx */ -if (slot ==0 && (unsigned long )dir.base %2 ) - dir.base +=1 ; -if (console_loglevel >=CONSOLE_LOGLEVEL_DEBUG )printk (KERN_DEBUG "nubus_get_functional_resource: parent is 0x%p, dir is 0x%p\n" , parent->base, dir.base);
@@ -720,83 +707,6 @@ static int __init nubus_get_board_resource(struct nubus_board* board, int slot,return 0 ; } -/* Attempt to bypass the somewhat non-obvious arrangement of -sResources in the motherboard ROM */ -static void __init nubus_find_rom_dir (struct nubus_board * board) -{ -unsigned char * rp; -unsigned char * romdir; -struct nubus_dir dir; -struct nubus_dirent ent; - -/* Check for the extra directory just under the format block */ - rp = board->fblock; -nubus_rewind (&rp,4 , board->lanes); -if (nubus_get_rom (&rp,4 , board->lanes) !=NUBUS_TEST_PATTERN ) { -/* OK, the ROM was telling the truth */ - board->directory = board->fblock; -nubus_move (&board->directory, -nubus_expand32 (board->doffset), - board->lanes); -return ; - } - -/* On "slot zero", you have to walk down a few more -directories to get to the equivalent of a real card's root -directory. We don't know what they were smoking when they -came up with this. */ - romdir =nubus_rom_addr (board->slot); -nubus_rewind (&romdir,ROM_DIR_OFFSET , board->lanes); - dir.base = dir.ptr = romdir; - dir.done =0 ; - dir.mask = board->lanes; - -/* This one points to an "Unknown Macintosh" directory */ -if (nubus_readdir (&dir, &ent) ==-1 ) - goto badrom; - -if (console_loglevel >=CONSOLE_LOGLEVEL_DEBUG ) -printk (KERN_INFO "nubus_get_rom_dir: entry %02x %06x\n" , ent.type, ent.data); -/* This one takes us to where we want to go. */ -if (nubus_readdir (&dir, &ent) ==-1 ) - goto badrom; -if (console_loglevel >=CONSOLE_LOGLEVEL_DEBUG ) -printk (KERN_DEBUG "nubus_get_rom_dir: entry %02x %06x\n" , ent.type, ent.data); -nubus_get_subdir (&ent, &dir); - -/* Resource ID 01, also an "Unknown Macintosh" */ -if (nubus_readdir (&dir, &ent) ==-1 ) - goto badrom; -if (console_loglevel >=CONSOLE_LOGLEVEL_DEBUG ) -printk (KERN_DEBUG "nubus_get_rom_dir: entry %02x %06x\n" , ent.type, ent.data); - -/* FIXME: the first one is *not* always the right one. We -suspect this has something to do with the ROM revision. -"The HORROR ROM" (LC-series) uses 0x7e, while "The HORROR -Continues" (Q630) uses 0x7b. The DAFB Macs evidently use -something else. Please run "Slots" on your Mac (see -include/linux/nubus.h for where to get this program) and -tell us where the 'SiDirPtr' for Slot 0 is. If you feel -brave, you should also use MacsBug to walk down the ROM -directories like this function does and try to find the -path to that address... */ -if (nubus_readdir (&dir, &ent) ==-1 ) - goto badrom; -if (console_loglevel >=CONSOLE_LOGLEVEL_DEBUG ) -printk (KERN_DEBUG "nubus_get_rom_dir: entry %02x %06x\n" , ent.type, ent.data); - -/* Bwahahahaha... */ -nubus_get_subdir (&ent, &dir); - board->directory = dir.base; -return ; - -/* Even more evil laughter... */ - badrom: - board->directory = board->fblock; -nubus_move (&board->directory,nubus_expand32 (board->doffset), board->lanes); -printk (KERN_ERR "nubus_get_rom_dir: ROM weirdness! Notify the developers...\n" ); -} -/* Add a board (might be many devices) to the list */ static struct nubus_board *__init nubus_add_board (int slot,int bytelanes) {
@@ -862,8 +772,11 @@ static struct nubus_board* __init nubus_add_board(int slot, int bytelanes)* since the initial Macintosh ROM releases skipped the check. */ -/* Attempt to work around slot zero weirdness */ -nubus_find_rom_dir (board); +/* Set up the directory pointer */ + board->directory = board->fblock; +nubus_move (&board->directory,nubus_expand32 (board->doffset), + board->lanes); +nubus_get_root_dir (board, &dir);/* We're ready to rock */
@@ -883,9 +796,6 @@ static struct nubus_board* __init nubus_add_board(int slot, int bytelanes)nubus_get_board_resource (board, slot, &ent); } -/* Aaaarrrrgghh! The LC III motherboard has *two* board -resources. I have no idea WTF to do about this. */ -while (nubus_readdir (&dir, &ent) !=-1 ) {struct nubus_dev * dev;struct nubus_dev ** devp;
@@ -954,10 +864,7 @@ void __init nubus_probe_slot(int slot)void __init nubus_scan_bus (void ) {int slot; -/* This might not work on your machine */ -#ifdef I_WANT_TO_PROBE_SLOT_ZERO -nubus_probe_slot (0 ); -#endif +for (slot =9 ; slot <15 ; slot++) {nubus_probe_slot (slot);
@@ -976,13 +883,6 @@ static int __init nubus_init(void)via_nubus_init (); } -#ifdef TRY_TO_DODGE_WSOD -/* Rogue Ethernet interrupts can kill the machine if we don't -do this. Obviously this is bogus. Hopefully the local VIA -gurus can fix the real cause of the problem. */ -mdelay (1000 ); -#endif -/* And probe */ printk ("NuBus: Scanning NuBus slots.\n" ); nubus_devices =NULL ;
Signature · 1 line
2.10.2
PATCH 7/10 nubus: Clean up printk calls (from mac68k CVS)
In reply to Finn ThainFrom: David Huggins-Daines <[email protected]>
Some long forgotten changes from the linux-mac68k CVS:
Fix swapped DrvrSW and DrvrHW values in printk message. Suppress debug printk messages.
Avoid console_loglevel misuse.
The original commits are these:
http://linux-mac68k.cvs.sourceforge.net/viewvc/linux-mac68k/linux-mac68k/drivers/nubus/nubus.c?r1=1.22.2.1&r2=1.22.2.2&pathrev=linux-2_2
http://linux-mac68k.cvs.sourceforge.net/viewvc/linux-mac68k/linux-mac68k/drivers/nubus/nubus.c?r1=1.21&r2=1.22&pathrev=linux-2_2
The CVS commits fell short of removing all of the misuse of console_loglevel in nubus_add_board() so I finished the job. I've also added some missing message severity levels and converted a printk loop to the MAC address "%pM" format specifier.
--- drivers/nubus/nubus.c | 149 ++++++++++++++++++++++---------------------------- 1 file changed, 65 insertions(+), 84 deletions(-)
drivers/nubus/nubus.c +65 -84
@@ -94,7 +94,7 @@ static void nubus_rewind(unsigned char **ptr, int len, int map)/* Sanity check */ if (len >65536 ) -printk (KERN_ERR "rewind of 0x%08x!\n" , len); +pr_err ("rewind of 0x%08x!\n" , len);while (len) { do
@@ -111,7 +111,7 @@ static void nubus_advance(unsigned char **ptr, int len, int map) {unsigned char *p = *ptr;if (len>65536 ) -printk (KERN_ERR "advance of 0x%08x!\n" , len); +pr_err ("advance of 0x%08x!\n" , len);while (len) {while (not_useful (p,map))
@@ -366,14 +366,14 @@ static int __init nubus_show_display_resource(struct nubus_dev* dev, {switch (ent->type) {case NUBUS_RESID_GAMMADIR : -printk (KERN_INFO " gamma directory offset: 0x%06x\n" , ent->data); +pr_info (" gamma directory offset: 0x%06x\n" , ent->data);break ; case 0x0080 ... 0x0085: -printk (KERN_INFO " mode %02X info offset: 0x%06x\n" , +pr_info (" mode %02X info offset: 0x%06x\n" , ent->type, ent->data);break ;default : -printk (KERN_INFO " unknown resource %02X, data 0x%06x\n" , +pr_info (" unknown resource %02X, data 0x%06x\n" , ent->type, ent->data); }return 0 ;
@@ -386,18 +386,13 @@ static int __init nubus_show_network_resource(struct nubus_dev* dev,case NUBUS_RESID_MAC_ADDRESS : {char addr[6 ]; -int i;nubus_get_rsrc_mem (addr, ent,6 ); -printk (KERN_INFO " MAC address: " ); -for (i =0 ; i <6 ; i++) -printk ("%02x%s" , addr[i] &0xff , - i ==5 ?"" :":" ); -printk ("\n" ); +pr_info (" MAC address: %pM\n" , addr);break ; }default : -printk (KERN_INFO " unknown resource %02X, data 0x%06x\n" , +pr_info (" unknown resource %02X, data 0x%06x\n" , ent->type, ent->data); }return 0 ;
@@ -411,7 +406,7 @@ static int __init nubus_show_cpu_resource(struct nubus_dev* dev, {unsigned long meminfo[2 ];nubus_get_rsrc_mem (&meminfo, ent,8 ); -printk (KERN_INFO " memory: [ 0x%08lx 0x%08lx ]\n" , +pr_info (" memory: [ 0x%08lx 0x%08lx ]\n" , meminfo[0 ], meminfo[1 ]);break ; }
@@ -419,12 +414,12 @@ static int __init nubus_show_cpu_resource(struct nubus_dev* dev, {unsigned long rominfo[2 ];nubus_get_rsrc_mem (&rominfo, ent,8 ); -printk (KERN_INFO " ROM: [ 0x%08lx 0x%08lx ]\n" , +pr_info (" ROM: [ 0x%08lx 0x%08lx ]\n" , rominfo[0 ], rominfo[1 ]);break ; }default : -printk (KERN_INFO " unknown resource %02X, data 0x%06x\n" , +pr_info (" unknown resource %02X, data 0x%06x\n" , ent->type, ent->data); }return 0 ;
@@ -444,7 +439,7 @@ static int __init nubus_show_private_resource(struct nubus_dev* dev,nubus_show_cpu_resource (dev, ent);break ;default : -printk (KERN_INFO " unknown resource %02X, data 0x%06x\n" , +pr_info (" unknown resource %02X, data 0x%06x\n" , ent->type, ent->data); }return 0 ;
@@ -459,12 +454,11 @@ static struct nubus_dev* __initstruct nubus_dirent ent;struct nubus_dev * dev; -printk (KERN_INFO " Function 0x%02x:\n" , parent->type); +pr_info (" Function 0x%02x:\n" , parent->type);nubus_get_subdir (parent, &dir); -if (console_loglevel >=CONSOLE_LOGLEVEL_DEBUG ) -printk (KERN_DEBUG "nubus_get_functional_resource: parent is 0x%p, dir is 0x%p\n" , - parent->base, dir.base); +pr_debug ("%s: parent is 0x%p, dir is 0x%p\n" , + __func__, parent->base, dir.base);/* Actually we should probably panic if this fails */ if ((dev =kzalloc (sizeof (*dev),GFP_ATOMIC )) ==NULL )
@@ -485,14 +479,14 @@ static struct nubus_dev* __init dev->type = nbtdata[1 ]; dev->dr_sw = nbtdata[2 ]; dev->dr_hw = nbtdata[3 ]; -printk (KERN_INFO " type: [cat 0x%x type 0x%x hw 0x%x sw 0x%x]\n" , - nbtdata[0 ], nbtdata[1 ], nbtdata[2 ], nbtdata[3 ]); +pr_info (" type: [cat 0x%x type 0x%x sw 0x%x hw 0x%x]\n" , + nbtdata[0 ], nbtdata[1 ], nbtdata[2 ], nbtdata[3 ]);break ; }case NUBUS_RESID_NAME : {nubus_get_rsrc_str (dev->name, &ent,64 ); -printk (KERN_INFO " name: %s\n" , dev->name); +pr_info (" name: %s\n" , dev->name);break ; }case NUBUS_RESID_DRVRDIR :
@@ -504,8 +498,7 @@ static struct nubus_dev* __initnubus_get_subdir (&ent, &drvr_dir);nubus_readdir (&drvr_dir, &drvr_ent); dev->driver =nubus_dirptr (&drvr_ent); -printk (KERN_INFO " driver at: 0x%p\n" , - dev->driver); +pr_info (" driver at: 0x%p\n" , dev->driver);break ; }case NUBUS_RESID_MINOR_BASEOS :
@@ -513,22 +506,20 @@ static struct nubus_dev* __initmultiple framebuffers. It might be handy for Ethernet as well */ nubus_get_rsrc_mem (&dev->iobase, &ent,4 ); -printk (KERN_INFO " memory offset: 0x%08lx\n" , - dev->iobase); +pr_info (" memory offset: 0x%08lx\n" , dev->iobase);break ;case NUBUS_RESID_MINOR_LENGTH :/* Ditto */ nubus_get_rsrc_mem (&dev->iosize, &ent,4 ); -printk (KERN_INFO " memory length: 0x%08lx\n" , - dev->iosize); +pr_info (" memory length: 0x%08lx\n" , dev->iosize);break ;case NUBUS_RESID_FLAGS : dev->flags = ent.data; -printk (KERN_INFO " flags: 0x%06x\n" , dev->flags); +pr_info (" flags: 0x%06x\n" , dev->flags);break ;case NUBUS_RESID_HWDEVID : dev->hwdevid = ent.data; -printk (KERN_INFO " hwdevid: 0x%06x\n" , dev->hwdevid); +pr_info (" hwdevid: 0x%06x\n" , dev->hwdevid);break ;default :/* Local/Private resources have their own
@@ -555,11 +546,10 @@ static int __init nubus_get_vidnames(struct nubus_board* board,char name[32 ]; }; -printk (KERN_INFO " video modes supported:\n" ); +pr_info (" video modes supported:\n" );nubus_get_subdir (parent, &dir); -if (console_loglevel >=CONSOLE_LOGLEVEL_DEBUG ) -printk (KERN_DEBUG "nubus_get_vidnames: parent is 0x%p, dir is 0x%p\n" , - parent->base, dir.base); +pr_debug ("%s: parent is 0x%p, dir is 0x%p\n" , + __func__, parent->base, dir.base);while (nubus_readdir (&dir, &ent) !=-1 ) {
@@ -574,7 +564,7 @@ static int __init nubus_get_vidnames(struct nubus_board* board, size =sizeof (mode) -1 ;memset (&mode,0 ,sizeof (mode));nubus_get_rsrc_mem (&mode, &ent, size); -printk (KERN_INFO " %02X: (%02X) %s\n" , ent.type, +pr_info (" %02X: (%02X) %s\n" , ent.type, mode.id, mode.name); }return 0 ;
@@ -589,21 +579,21 @@ static int __init nubus_get_icon(struct nubus_board* board,int x, y;nubus_get_rsrc_mem (&icon, ent,128 ); -printk (KERN_INFO " icon:\n" ); +pr_info (" icon:\n" );/* We should actually plot these somewhere in the framebuffer init. This is just to demonstrate that they do, in fact, exist */ for (y =0 ; y <32 ; y++) { -printk (KERN_INFO " " ); +pr_info (" " );for (x =0 ; x <32 ; x++) {if (icon[y*4 + x/8 ] & (0x80 >> (x%8 ))) -printk ("*" ); +pr_cont ("*" );else -printk (" " ); +pr_cont (" " ); } -printk ("\n" ); +pr_cont ("\n" ); }return 0 ; }
@@ -616,11 +606,10 @@ static int __init nubus_get_vendorinfo(struct nubus_board* board,static char * vendor_fields[6 ] = {"ID" ,"serial" ,"revision" ,"part" ,"date" ,"unknown field" }; -printk (KERN_INFO " vendor info:\n" ); +pr_info (" vendor info:\n" );nubus_get_subdir (parent, &dir); -if (console_loglevel >=CONSOLE_LOGLEVEL_DEBUG ) -printk (KERN_DEBUG "nubus_get_vendorinfo: parent is 0x%p, dir is 0x%p\n" , - parent->base, dir.base); +pr_debug ("%s: parent is 0x%p, dir is 0x%p\n" , + __func__, parent->base, dir.base);while (nubus_readdir (&dir, &ent) !=-1 ) {
@@ -630,8 +619,7 @@ static int __init nubus_get_vendorinfo(struct nubus_board* board,nubus_get_rsrc_str (name, &ent,64 );if (ent.type >5 ) ent.type =5 ; -printk (KERN_INFO " %s: %s\n" , - vendor_fields[ent.type-1 ], name); +pr_info (" %s: %s\n" , vendor_fields[ent.type -1 ], name); }return 0 ; }
@@ -643,9 +631,8 @@ static int __init nubus_get_board_resource(struct nubus_board* board, int slot,struct nubus_dirent ent;nubus_get_subdir (parent, &dir); -if (console_loglevel >=CONSOLE_LOGLEVEL_DEBUG ) -printk (KERN_DEBUG "nubus_get_board_resource: parent is 0x%p, dir is 0x%p\n" , - parent->base, dir.base); +pr_debug ("%s: parent is 0x%p, dir is 0x%p\n" , + __func__, parent->base, dir.base);while (nubus_readdir (&dir, &ent) !=-1 ) {
@@ -657,38 +644,37 @@ static int __init nubus_get_board_resource(struct nubus_board* board, int slot,useful except insofar as it tells us that we really are looking at a board resource. */ nubus_get_rsrc_mem (nbtdata, &ent,8 ); -printk (KERN_INFO " type: [cat 0x%x type 0x%x hw 0x%x sw 0x%x]\n" , - nbtdata[0 ], nbtdata[1 ], nbtdata[2 ], - nbtdata[3 ]); +pr_info (" type: [cat 0x%x type 0x%x sw 0x%x hw 0x%x]\n" , + nbtdata[0 ], nbtdata[1 ], nbtdata[2 ], nbtdata[3 ]);if (nbtdata[0 ] !=1 || nbtdata[1 ] !=0 || nbtdata[2 ] !=0 || nbtdata[3 ] !=0 ) -printk (KERN_ERR "this sResource is not a board resource!\n" ); +pr_err ("this sResource is not a board resource!\n" );break ; }case NUBUS_RESID_NAME :nubus_get_rsrc_str (board->name, &ent,64 ); -printk (KERN_INFO " name: %s\n" , board->name); +pr_info (" name: %s\n" , board->name);break ;case NUBUS_RESID_ICON :nubus_get_icon (board, &ent);break ;case NUBUS_RESID_BOARDID : -printk (KERN_INFO " board id: 0x%x\n" , ent.data); +pr_info (" board id: 0x%x\n" , ent.data);break ;case NUBUS_RESID_PRIMARYINIT : -printk (KERN_INFO " primary init offset: 0x%06x\n" , ent.data); +pr_info (" primary init offset: 0x%06x\n" , ent.data);break ;case NUBUS_RESID_VENDORINFO :nubus_get_vendorinfo (board, &ent);break ;case NUBUS_RESID_FLAGS : -printk (KERN_INFO " flags: 0x%06x\n" , ent.data); +pr_info (" flags: 0x%06x\n" , ent.data);break ;case NUBUS_RESID_HWDEVID : -printk (KERN_INFO " hwdevid: 0x%06x\n" , ent.data); +pr_info (" hwdevid: 0x%06x\n" , ent.data);break ;case NUBUS_RESID_SECONDINIT : -printk (KERN_INFO " secondary init offset: 0x%06x\n" , ent.data); +pr_info (" secondary init offset: 0x%06x\n" , ent.data);break ;/* WTF isn't this in the functional resources? */ case NUBUS_RESID_VIDNAMES :
@@ -696,11 +682,11 @@ static int __init nubus_get_board_resource(struct nubus_board* board, int slot,break ;/* Same goes for this */ case NUBUS_RESID_VIDMODES : -printk (KERN_INFO " video mode parameter directory offset: 0x%06x\n" , +pr_info (" video mode parameter directory offset: 0x%06x\n" , ent.data);break ;default : -printk (KERN_INFO " unknown resource %02X, data 0x%06x\n" , +pr_info (" unknown resource %02X, data 0x%06x\n" , ent.type, ent.data); } }
@@ -728,21 +714,17 @@ static struct nubus_board* __init nubus_add_board(int slot, int bytelanes) board->fblock = rp;/* Dump the format block for debugging purposes */ -if (console_loglevel >=CONSOLE_LOGLEVEL_DEBUG ) { -int i; -printk (KERN_DEBUG "Slot %X, format block at 0x%p\n" , - slot, rp); -printk (KERN_DEBUG "Format block: " ); -for (i =0 ; i <FORMAT_BLOCK_SIZE ; i +=4 ) { -unsigned short foo, bar; - foo =nubus_get_rom (&rp,2 , bytelanes); - bar =nubus_get_rom (&rp,2 , bytelanes); -printk ("%04x %04x " , foo, bar); - } -printk ("\n" ); - rp = board->fblock; - } - +pr_debug ("Slot %X, format block at 0x%p:\n" , slot, rp); +pr_debug ("%02lx\n" ,nubus_get_rom (&rp,1 , bytelanes)); +pr_debug ("%02lx\n" ,nubus_get_rom (&rp,1 , bytelanes)); +pr_debug ("%08lx\n" ,nubus_get_rom (&rp,4 , bytelanes)); +pr_debug ("%02lx\n" ,nubus_get_rom (&rp,1 , bytelanes)); +pr_debug ("%02lx\n" ,nubus_get_rom (&rp,1 , bytelanes)); +pr_debug ("%08lx\n" ,nubus_get_rom (&rp,4 , bytelanes)); +pr_debug ("%08lx\n" ,nubus_get_rom (&rp,4 , bytelanes)); +pr_debug ("%08lx\n" ,nubus_get_rom (&rp,4 , bytelanes)); + rp = board->fblock; + board->slot = slot; board->slot_addr = (unsigned long )nubus_slot_addr (slot); board->doffset =nubus_get_rom (&rp,4 , bytelanes);
@@ -760,10 +742,10 @@ static struct nubus_board* __init nubus_add_board(int slot, int bytelanes)/* Directory offset should be small and negative... */ if (!(board->doffset &0x00FF0000 )) -printk (KERN_WARNING "Dodgy doffset!\n" ); +pr_warn ("Dodgy doffset!\n" ); dpat =nubus_get_rom (&rp,4 , bytelanes);if (dpat !=NUBUS_TEST_PATTERN ) -printk (KERN_WARNING "Wrong test pattern %08lx!\n" , dpat); +pr_warn ("Wrong test pattern %08lx!\n" , dpat);/* * I wonder how the CRC is meant to work -
@@ -780,7 +762,7 @@ static struct nubus_board* __init nubus_add_board(int slot, int bytelanes)nubus_get_root_dir (board, &dir);/* We're ready to rock */ -printk (KERN_INFO "Slot %X:\n" , slot); +pr_info ("Slot %X:\n" , slot);/* Each slot should have one board resource and any number of functional resources. So we'll fill in some fields in the
@@ -789,10 +771,10 @@ static struct nubus_board* __init nubus_add_board(int slot, int bytelanes)for each of them. */ if (nubus_readdir (&dir, &ent) ==-1 ) {/* We can't have this! */ -printk (KERN_ERR "Board resource not found!\n" ); +pr_err ("Board resource not found!\n" );return NULL ; }else { -printk (KERN_INFO " Board resource:\n" ); +pr_info (" Board resource:\n" );nubus_get_board_resource (board, slot, &ent); }
@@ -839,7 +821,6 @@ void __init nubus_probe_slot(int slot)if (!card_present)continue ; -printk (KERN_DEBUG "Now probing slot %X at %p\n" , slot, rp); dp = *rp;if (dp ==0 )continue ;
@@ -884,7 +865,7 @@ static int __init nubus_init(void) }/* And probe */ -printk ("NuBus: Scanning NuBus slots.\n" ); +pr_info ("NuBus: Scanning NuBus slots.\n" ); nubus_devices =NULL ; nubus_boards =NULL ;nubus_scan_bus ();
Signature · 1 line
2.10.2
PATCH 8/10 nubus: Fix pointer validation
In reply to Finn ThainFix bounds checking on slot-space pointer movement. Remove redundant test for zero byte-lanes value. Fix broken byte-lanes vs. address validation.
--- drivers/nubus/nubus.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/nubus/nubus.c +7 -8
@@ -92,9 +92,6 @@ static void nubus_rewind(unsigned char **ptr, int len, int map) {unsigned char *p=*ptr; -/* Sanity check */ -if (len >65536 ) -pr_err ("rewind of 0x%08x!\n" , len);while (len) { do
@@ -110,8 +107,7 @@ static void nubus_rewind(unsigned char **ptr, int len, int map)static void nubus_advance (unsigned char **ptr,int len,int map) {unsigned char *p = *ptr; -if (len>65536 ) -pr_err ("advance of 0x%08x!\n" , len); +while (len) {while (not_useful (p,map))
@@ -124,10 +120,15 @@ static void nubus_advance(unsigned char **ptr, int len, int map)static void nubus_move (unsigned char **ptr,int len,int map) { +unsigned long slot_space = (unsigned long )*ptr &0xFF000000 ; +if (len >0 )nubus_advance (ptr, len, map);else if (len <0 )nubus_rewind (ptr, -len, map); + +if (((unsigned long )*ptr &0xFF000000 ) != slot_space) +pr_err ("%s: moved out of slot address space!\n" , __func__); }/* Now, functions to read the sResource tree */
@@ -822,8 +823,6 @@ void __init nubus_probe_slot(int slot)continue ; dp = *rp; -if (dp ==0 ) -continue ;/* The last byte of the format block consists of two nybbles which are "mirror images" of each other.
@@ -832,7 +831,7 @@ void __init nubus_probe_slot(int slot)continue ;/* Check that this value is actually *on* one of the bytelanes it claims are valid! */ -if ((dp &0x0F ) >= (1 <<i)) +if (not_useful (rp, dp))continue ;/* Looks promising. Let's put it on the list. */
Signature · 1 line
2.10.2
PATCH 9/10 nubus: Clean up whitespace
In reply to Finn Thain--- drivers/nubus/nubus.c | 284 ++++++++++++++++++++++++-------------------------- 1 file changed, 134 insertions(+), 150 deletions(-)
drivers/nubus/nubus.c +134 -150
@@ -35,8 +35,8 @@ extern void oss_nubus_init(void);/* Globals */ -struct nubus_dev * nubus_devices; -struct nubus_board * nubus_boards; +struct nubus_dev *nubus_devices; +struct nubus_board *nubus_boards;/* Meaning of "bytelanes":
@@ -60,26 +60,26 @@ struct nubus_board* nubus_boards;Etcetera, etcetera. Hopefully this clears up some confusion over what the following code actually does. */ - +static inline int not_useful (void *p,int map) { -unsigned long pv=(unsigned long )p; +unsigned long pv = (unsigned long )p; + pv &=3 ; -if (map & (1 <<pv)) +if (map & (1 << pv))return 0 ;return 1 ; } - +static unsigned long nubus_get_rom (unsigned char **ptr,int len,int map) {/* This will hold the result */ unsigned long v =0 ;unsigned char *p = *ptr; -while (len) - { +while (len) { v <<=8 ; -while (not_useful (p,map)) +while (not_useful (p, map)) p++; v |= *p++; len--;
@@ -90,27 +90,23 @@ static unsigned long nubus_get_rom(unsigned char **ptr, int len, int map)static void nubus_rewind (unsigned char **ptr,int len,int map) { -unsigned char *p=*ptr; +unsigned char *p = *ptr; -while (len) - { -do - { +while (len) { +do { p--; - } -while (not_useful (p, map)); + }while (not_useful (p, map)); len--; } - *ptr=p; + *ptr = p; }static void nubus_advance (unsigned char **ptr,int len,int map) {unsigned char *p = *ptr; -while (len) - { -while (not_useful (p,map)) +while (len) { +while (not_useful (p, map)) p++; p++; len--;
@@ -122,9 +118,9 @@ static void nubus_move(unsigned char **ptr, int len, int map) {unsigned long slot_space = (unsigned long )*ptr &0xFF000000 ; -if (len >0 ) +if (len >0 )nubus_advance (ptr, len, map); -else if (len <0 ) +else if (len <0 )nubus_rewind (ptr, -len, map);if (((unsigned long )*ptr &0xFF000000 ) != slot_space)
@@ -140,23 +136,24 @@ static void nubus_move(unsigned char **ptr, int len, int map)static inline long nubus_expand32 (long foo) { -if (foo &0x00800000 )/* 24bit negative */ +if (foo &0x00800000 )/* 24bit negative */ foo |=0xFF000000 ;return foo; }static inline void *nubus_rom_addr (int slot) -{ +{/* * Returns the first byte after the card. We then walk * backwards to get the lane register and the config */ -return (void *)(0xF1000000 +(slot<<24 )); +return (void *)(0xF1000000 + (slot <<24 )); }static unsigned char *nubus_dirptr (const struct nubus_dirent *nd) {unsigned char *p = nd->base; +/* Essentially, just step over the bytelanes using whatever offset we might have found */ nubus_move (&p,nubus_expand32 (nd->data), nd->mask);
@@ -167,36 +164,36 @@ static unsigned char *nubus_dirptr(const struct nubus_dirent *nd)/* These two are for pulling resource data blocks (i.e. stuff that's pointed to with offsets) out of the card ROM. */ -void nubus_get_rsrc_mem (void *dest,const struct nubus_dirent * dirent, +void nubus_get_rsrc_mem (void *dest,const struct nubus_dirent *dirent,int len) {unsigned char *t = (unsigned char *)dest;unsigned char *p =nubus_dirptr (dirent); -while (len) - { + +while (len) { *t++ =nubus_get_rom (&p,1 , dirent->mask); len--; } }EXPORT_SYMBOL (nubus_get_rsrc_mem); -void nubus_get_rsrc_str (void *dest,const struct nubus_dirent * dirent, +void nubus_get_rsrc_str (void *dest,const struct nubus_dirent *dirent,int len) { -unsigned char *t=(unsigned char *)dest; +unsigned char *t = (unsigned char *)dest;unsigned char *p =nubus_dirptr (dirent); -while (len) - { + +while (len) { *t =nubus_get_rom (&p,1 , dirent->mask); -if (!*t++) +if (!*t++)break ; len--; } }EXPORT_SYMBOL (nubus_get_rsrc_str); -int nubus_get_root_dir (const struct nubus_board * board, -struct nubus_dir * dir) +int nubus_get_root_dir (const struct nubus_board *board, +struct nubus_dir *dir) { dir->ptr = dir->base = board->directory; dir->done =0 ;
@@ -206,8 +203,8 @@ int nubus_get_root_dir(const struct nubus_board* board,EXPORT_SYMBOL (nubus_get_root_dir);/* This is a slyly renamed version of the above */ -int nubus_get_func_dir (const struct nubus_dev * dev, -struct nubus_dir * dir) +int nubus_get_func_dir (const struct nubus_dev *dev, +struct nubus_dir *dir) { dir->ptr = dir->base = dev->directory; dir->done =0 ;
@@ -216,11 +213,11 @@ int nubus_get_func_dir(const struct nubus_dev* dev, }EXPORT_SYMBOL (nubus_get_func_dir); -int nubus_get_board_dir (const struct nubus_board * board, -struct nubus_dir * dir) +int nubus_get_board_dir (const struct nubus_board *board, +struct nubus_dir *dir) {struct nubus_dirent ent; - + dir->ptr = dir->base = board->directory; dir->done =0 ; dir->mask = board->lanes;
@@ -248,6 +245,7 @@ EXPORT_SYMBOL(nubus_get_subdir);int nubus_readdir (struct nubus_dir *nd,struct nubus_dirent *ent) {u32 resid; +if (nd->done)return -1 ;
@@ -258,27 +256,25 @@ int nubus_readdir(struct nubus_dir *nd, struct nubus_dirent *ent) resid =nubus_get_rom (&nd->ptr,4 , nd->mask);/* EOL marker, as per the Apple docs */ -if ((resid&0xff000000 ) ==0xff000000 ) - { +if ((resid &0xff000000 ) ==0xff000000 ) {/* Mark it as done */ nd->done =1 ;return -1 ; }/* First byte is the resource ID */ - ent->type = resid >>24 ; + ent->type = resid >>24 ;/* Low 3 bytes might contain data (or might not) */ ent->data = resid &0xffffff ; - ent->mask = nd->mask; + ent->mask = nd->mask;return 0 ; }EXPORT_SYMBOL (nubus_readdir); -int nubus_rewinddir (struct nubus_dir * dir) +int nubus_rewinddir (struct nubus_dir *dir) { dir->ptr = dir->base; dir->done =0 ; -return 0 ; }EXPORT_SYMBOL (nubus_rewinddir);
@@ -286,20 +282,15 @@ EXPORT_SYMBOL(nubus_rewinddir);/* Driver interface functions, more or less like in pci.c */ struct nubus_dev * -nubus_find_device (unsigned short category, -unsigned short type, -unsigned short dr_hw, -unsigned short dr_sw, -const struct nubus_dev * from) +nubus_find_device (unsigned short category,unsigned short type, +unsigned short dr_hw,unsigned short dr_sw, +const struct nubus_dev *from) { -struct nubus_dev * itor = - from ? from->next : nubus_devices; +struct nubus_dev *itor = from ? from->next : nubus_devices;while (itor) { -if (itor->category == category - && itor->type == type - && itor->dr_hw == dr_hw - && itor->dr_sw == dr_sw) +if (itor->category == category && itor->type == type && + itor->dr_hw == dr_hw && itor->dr_sw == dr_sw)return itor; itor = itor->next; }
@@ -308,16 +299,13 @@ nubus_find_device(unsigned short category,EXPORT_SYMBOL (nubus_find_device);struct nubus_dev * -nubus_find_type (unsigned short category, -unsigned short type, -const struct nubus_dev * from) +nubus_find_type (unsigned short category,unsigned short type, +const struct nubus_dev *from) { -struct nubus_dev * itor = - from ? from->next : nubus_devices; +struct nubus_dev *itor = from ? from->next : nubus_devices;while (itor) { -if (itor->category == category - && itor->type == type) +if (itor->category == category && itor->type == type)return itor; itor = itor->next; }
@@ -326,12 +314,10 @@ nubus_find_type(unsigned short category,EXPORT_SYMBOL (nubus_find_type);struct nubus_dev * -nubus_find_slot (unsigned int slot, -const struct nubus_dev * from) +nubus_find_slot (unsigned int slot,const struct nubus_dev *from) { -struct nubus_dev * itor = - from ? from->next : nubus_devices; - +struct nubus_dev *itor = from ? from->next : nubus_devices; +while (itor) {if (itor->board->slot == slot)return itor;
@@ -342,13 +328,13 @@ nubus_find_slot(unsigned int slot,EXPORT_SYMBOL (nubus_find_slot);int -nubus_find_rsrc (struct nubus_dir * dir,unsigned char rsrc_type, -struct nubus_dirent * ent) +nubus_find_rsrc (struct nubus_dir *dir,unsigned char rsrc_type, +struct nubus_dirent *ent) {while (nubus_readdir (dir, ent) !=-1 ) {if (ent->type == rsrc_type)return 0 ; - } + }return -1 ; }EXPORT_SYMBOL (nubus_find_rsrc);
@@ -362,8 +348,8 @@ EXPORT_SYMBOL(nubus_find_rsrc);among other things. The rest of it should go in the /proc code. For now, we just use it to give verbose boot logs. */ -static int __init nubus_show_display_resource (struct nubus_dev * dev, -const struct nubus_dirent * ent) +static int __init nubus_show_display_resource (struct nubus_dev *dev, +const struct nubus_dirent *ent) {switch (ent->type) {case NUBUS_RESID_GAMMADIR :
@@ -380,14 +366,14 @@ static int __init nubus_show_display_resource(struct nubus_dev* dev,return 0 ; } -static int __init nubus_show_network_resource (struct nubus_dev * dev, -const struct nubus_dirent * ent) +static int __init nubus_show_network_resource (struct nubus_dev *dev, +const struct nubus_dirent *ent) {switch (ent->type) {case NUBUS_RESID_MAC_ADDRESS : {char addr[6 ]; - +nubus_get_rsrc_mem (addr, ent,6 );pr_info (" MAC address: %pM\n" , addr);break ;
@@ -399,13 +385,14 @@ static int __init nubus_show_network_resource(struct nubus_dev* dev,return 0 ; } -static int __init nubus_show_cpu_resource (struct nubus_dev * dev, -const struct nubus_dirent * ent) +static int __init nubus_show_cpu_resource (struct nubus_dev *dev, +const struct nubus_dirent *ent) {switch (ent->type) {case NUBUS_RESID_MEMINFO : {unsigned long meminfo[2 ]; +nubus_get_rsrc_mem (&meminfo, ent,8 );pr_info (" memory: [ 0x%08lx 0x%08lx ]\n" , meminfo[0 ], meminfo[1 ]);
@@ -414,6 +401,7 @@ static int __init nubus_show_cpu_resource(struct nubus_dev* dev,case NUBUS_RESID_ROMINFO : {unsigned long rominfo[2 ]; +nubus_get_rsrc_mem (&rominfo, ent,8 );pr_info (" ROM: [ 0x%08lx 0x%08lx ]\n" , rominfo[0 ], rominfo[1 ]);
@@ -426,8 +414,8 @@ static int __init nubus_show_cpu_resource(struct nubus_dev* dev,return 0 ; } -static int __init nubus_show_private_resource (struct nubus_dev * dev, -const struct nubus_dirent * ent) +static int __init nubus_show_private_resource (struct nubus_dev *dev, +const struct nubus_dirent *ent) {switch (dev->category) {case NUBUS_CAT_DISPLAY :
@@ -446,15 +434,14 @@ static int __init nubus_show_private_resource(struct nubus_dev* dev,return 0 ; } -static struct nubus_dev *__init -nubus_get_functional_resource (struct nubus_board * board, -int slot, -const struct nubus_dirent * parent) +static struct nubus_dev *__init +nubus_get_functional_resource (struct nubus_board *board,int slot, +const struct nubus_dirent *parent) { -struct nubus_dir dir; +struct nubus_dir dir;struct nubus_dirent ent; -struct nubus_dev * dev; - +struct nubus_dev *dev; +pr_info (" Function 0x%02x:\n" , parent->type);nubus_get_subdir (parent, &dir);
@@ -463,18 +450,17 @@ static struct nubus_dev* __init/* Actually we should probably panic if this fails */ if ((dev =kzalloc (sizeof (*dev),GFP_ATOMIC )) ==NULL ) -return NULL ; +return NULL ; dev->resid = parent->type; dev->directory = dir.base; dev->board = board; - -while (nubus_readdir (&dir, &ent) !=-1 ) - { -switch (ent.type) - { + +while (nubus_readdir (&dir, &ent) !=-1 ) { +switch (ent.type) {case NUBUS_RESID_TYPE : {unsigned short nbtdata[4 ]; +nubus_get_rsrc_mem (nbtdata, &ent,8 ); dev->category = nbtdata[0 ]; dev->type = nbtdata[1 ];
@@ -496,6 +482,7 @@ static struct nubus_dev* __inituse this :-) */ struct nubus_dir drvr_dir;struct nubus_dirent drvr_ent; +nubus_get_subdir (&ent, &drvr_dir);nubus_readdir (&drvr_dir, &drvr_ent); dev->driver =nubus_dirptr (&drvr_ent);
@@ -528,16 +515,17 @@ static struct nubus_dev* __initnubus_show_private_resource (dev, &ent); } } - +return dev; }/* This is cool. */ -static int __init nubus_get_vidnames (struct nubus_board * board, -const struct nubus_dirent * parent) +static int __init nubus_get_vidnames (struct nubus_board *board, +const struct nubus_dirent *parent) { -struct nubus_dir dir; +struct nubus_dir dir;struct nubus_dirent ent; +/* FIXME: obviously we want to put this in a header file soon */ struct vidmode {u32 size;
@@ -552,14 +540,13 @@ static int __init nubus_get_vidnames(struct nubus_board* board,pr_debug ("%s: parent is 0x%p, dir is 0x%p\n" , __func__, parent->base, dir.base); -while (nubus_readdir (&dir, &ent) !=-1 ) - { +while (nubus_readdir (&dir, &ent) !=-1 ) {struct vidmode mode;u32 size;/* First get the length */ nubus_get_rsrc_mem (&size, &ent,4 ); - +/* Now clobber the whole thing */ if (size >sizeof (mode) -1 ) size =sizeof (mode) -1 ;
@@ -572,13 +559,13 @@ static int __init nubus_get_vidnames(struct nubus_board* board, }/* This is *really* cool. */ -static int __init nubus_get_icon (struct nubus_board * board, -const struct nubus_dirent * ent) +static int __init nubus_get_icon (struct nubus_board *board, +const struct nubus_dirent *ent) {/* Should be 32x32 if my memory serves me correctly */ unsigned char icon[128 ];int x, y; - +nubus_get_rsrc_mem (&icon, ent,128 );pr_info (" icon:\n" );
@@ -588,8 +575,7 @@ static int __init nubus_get_icon(struct nubus_board* board,for (y =0 ; y <32 ; y++) {pr_info (" " );for (x =0 ; x <32 ; x++) { -if (icon[y*4 + x/8 ] - & (0x80 >> (x%8 ))) +if (icon[y *4 + x /8 ] & (0x80 >> (x %8 )))pr_cont ("*" );else pr_cont (" " );
@@ -599,23 +585,22 @@ static int __init nubus_get_icon(struct nubus_board* board,return 0 ; } -static int __init nubus_get_vendorinfo (struct nubus_board * board, -const struct nubus_dirent * parent) +static int __init nubus_get_vendorinfo (struct nubus_board *board, +const struct nubus_dirent *parent) { -struct nubus_dir dir; +struct nubus_dir dir;struct nubus_dirent ent; -static char * vendor_fields[6 ] = {"ID" ,"serial" ,"revision" , -"part" ,"date" ,"unknown field" }; +static char *vendor_fields[6 ] = {"ID" ,"serial" ,"revision" , +"part" ,"date" ,"unknown field" };pr_info (" vendor info:\n" );nubus_get_subdir (parent, &dir);pr_debug ("%s: parent is 0x%p, dir is 0x%p\n" , __func__, parent->base, dir.base); -while (nubus_readdir (&dir, &ent) !=-1 ) - { +while (nubus_readdir (&dir, &ent) !=-1 ) {char name[64 ]; - +/* These are all strings, we think */ nubus_get_rsrc_str (name, &ent,64 );if (ent.type >5 )
@@ -625,18 +610,17 @@ static int __init nubus_get_vendorinfo(struct nubus_board* board,return 0 ; } -static int __init nubus_get_board_resource (struct nubus_board * board,int slot, -const struct nubus_dirent * parent) +static int __init nubus_get_board_resource (struct nubus_board *board,int slot, +const struct nubus_dirent *parent) { -struct nubus_dir dir; +struct nubus_dir dir;struct nubus_dirent ent; - +nubus_get_subdir (parent, &dir);pr_debug ("%s: parent is 0x%p, dir is 0x%p\n" , __func__, parent->base, dir.base); -while (nubus_readdir (&dir, &ent) !=-1 ) - { +while (nubus_readdir (&dir, &ent) !=-1 ) {switch (ent.type) {case NUBUS_RESID_TYPE : {
@@ -677,7 +661,7 @@ static int __init nubus_get_board_resource(struct nubus_board* board, int slot,case NUBUS_RESID_SECONDINIT :pr_info (" secondary init offset: 0x%06x\n" , ent.data);break ; -/* WTF isn't this in the functional resources? */ +/* WTF isn't this in the functional resources? */ case NUBUS_RESID_VIDNAMES :nubus_get_vidnames (board, &ent);break ;
@@ -685,7 +669,7 @@ static int __init nubus_get_board_resource(struct nubus_board* board, int slot,case NUBUS_RESID_VIDMODES :pr_info (" video mode parameter directory offset: 0x%06x\n" , ent.data); -break ; +break ;default :pr_info (" unknown resource %02X, data 0x%06x\n" , ent.type, ent.data);
@@ -695,23 +679,22 @@ static int __init nubus_get_board_resource(struct nubus_board* board, int slot, }/* Add a board (might be many devices) to the list */ -static struct nubus_board *__init nubus_add_board (int slot,int bytelanes) +static struct nubus_board *__init nubus_add_board (int slot,int bytelanes) { -struct nubus_board * board; -struct nubus_board ** boardp; - +struct nubus_board *board; +struct nubus_board **boardp;unsigned char *rp;unsigned long dpat;struct nubus_dir dir;struct nubus_dirent ent;/* Move to the start of the format block */ - rp =nubus_rom_addr (slot); + rp =nubus_rom_addr (slot);nubus_rewind (&rp,FORMAT_BLOCK_SIZE , bytelanes);/* Actually we should probably panic if this fails */ if ((board =kzalloc (sizeof (*board),GFP_ATOMIC )) ==NULL ) -return NULL ; +return NULL ; board->fblock = rp;/* Dump the format block for debugging purposes */
@@ -727,7 +710,7 @@ static struct nubus_board* __init nubus_add_board(int slot, int bytelanes) rp = board->fblock; board->slot = slot; - board->slot_addr = (unsigned long )nubus_slot_addr (slot); + board->slot_addr = (unsigned long )nubus_slot_addr (slot); board->doffset =nubus_get_rom (&rp,4 , bytelanes);/* rom_length is *supposed* to be the total length of the * ROM. In practice it is the "amount of ROM used to compute
@@ -738,16 +721,16 @@ static struct nubus_board* __init nubus_add_board(int slot, int bytelanes) board->rom_length =nubus_get_rom (&rp,4 , bytelanes); board->crc =nubus_get_rom (&rp,4 , bytelanes); board->rev =nubus_get_rom (&rp,1 , bytelanes); - board->format =nubus_get_rom (&rp,1 , bytelanes); + board->format =nubus_get_rom (&rp,1 , bytelanes); board->lanes = bytelanes;/* Directory offset should be small and negative... */ -if (!(board->doffset &0x00FF0000 )) +if (!(board->doffset &0x00FF0000 ))pr_warn ("Dodgy doffset!\n" ); dpat =nubus_get_rom (&rp,4 , bytelanes); -if (dpat !=NUBUS_TEST_PATTERN ) +if (dpat !=NUBUS_TEST_PATTERN )pr_warn ("Wrong test pattern %08lx!\n" , dpat); - +/* * I wonder how the CRC is meant to work - * any takers ?
@@ -760,7 +743,7 @@ static struct nubus_board* __init nubus_add_board(int slot, int bytelanes)nubus_move (&board->directory,nubus_expand32 (board->doffset), board->lanes); -nubus_get_root_dir (board, &dir); +nubus_get_root_dir (board, &dir);/* We're ready to rock */ pr_info ("Slot %X:\n" , slot);
@@ -780,8 +763,9 @@ static struct nubus_board* __init nubus_add_board(int slot, int bytelanes) }while (nubus_readdir (&dir, &ent) !=-1 ) { -struct nubus_dev * dev; -struct nubus_dev ** devp; +struct nubus_dev *dev; +struct nubus_dev **devp; + dev =nubus_get_functional_resource (board, slot, &ent);if (dev ==NULL )continue ;
@@ -789,32 +773,33 @@ static struct nubus_board* __init nubus_add_board(int slot, int bytelanes)/* We zeroed this out above */ if (board->first_dev ==NULL ) board->first_dev = dev; - +/* Put it on the global NuBus device chain. Keep entries in order. */ -for (devp=&nubus_devices; *devp!=NULL ; devp=&((*devp)->next)) +for (devp = &nubus_devices; *devp !=NULL ; + devp = &((*devp)->next))/* spin */ ; *devp = dev; - dev->next =NULL ; + dev->next =NULL ; }/* Put it on the global NuBus board chain. Keep entries in order. */ -for (boardp=&nubus_boards; *boardp!=NULL ; boardp=&((*boardp)->next)) +for (boardp = &nubus_boards; *boardp !=NULL ; + boardp = &((*boardp)->next))/* spin */ ; *boardp = board; board->next =NULL ; - +return board; }void __init nubus_probe_slot (int slot) {unsigned char dp; -unsigned char * rp; +unsigned char *rp;int i; - rp =nubus_rom_addr (slot); -for (i =4 ; i; i--) - { + rp =nubus_rom_addr (slot); +for (i =4 ; i; i--) {int card_present; rp--;
@@ -827,7 +812,7 @@ void __init nubus_probe_slot(int slot)/* The last byte of the format block consists of two nybbles which are "mirror images" of each other. These show us the valid bytelanes */ -if ((((dp>>4 ) ^ dp) &0x0F ) !=0x0F ) +if ((((dp >>4 ) ^ dp) &0x0F ) !=0x0F )continue ;/* Check that this value is actually *on* one of the bytelanes it claims are valid! */
@@ -845,15 +830,14 @@ void __init nubus_scan_bus(void) {int slot; -for (slot =9 ; slot <15 ; slot++) - { +for (slot =9 ; slot <15 ; slot++) {nubus_probe_slot (slot); } }static int __init nubus_init (void ) { -if (!MACH_IS_MAC ) +if (!MACH_IS_MAC )return 0 ;/* Initialize the NuBus interrupts */
@@ -866,7 +850,7 @@ static int __init nubus_init(void)/* And probe */ pr_info ("NuBus: Scanning NuBus slots.\n" ); nubus_devices =NULL ; - nubus_boards =NULL ; + nubus_boards =NULL ;nubus_scan_bus ();nubus_proc_init ();return 0 ;
Signature · 1 line
2.10.2
PATCH 10/10 nubus: Add MVC and VSC video card definitions
In reply to Finn ThainAlso move the NUBUS_DRHW_APPLE_JET definition, for numerical order.
--- include/uapi/linux/nubus.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
include/uapi/linux/nubus.h +3 -1
@@ -113,13 +113,15 @@ enum nubus_drhw {NUBUS_DRHW_SIGMA_CLRMAX =0x0007 ,/* Sigma Design ColorMax */ NUBUS_DRHW_APPLE_SE30 =0x0009 ,/* Apple SE/30 video */ NUBUS_DRHW_APPLE_HRVC =0x0013 ,/* Mac II High-Res Video Card */ +NUBUS_DRHW_APPLE_MVC =0x0014 ,/* Mac II Monochrome Video Card */ NUBUS_DRHW_APPLE_PVC =0x0017 ,/* Mac II Portrait Video Card */ NUBUS_DRHW_APPLE_RBV1 =0x0018 ,/* IIci RBV video */ NUBUS_DRHW_APPLE_MDC =0x0019 ,/* Macintosh Display Card */ +NUBUS_DRHW_APPLE_VSC =0x0020 ,/* Duo MiniDock ViSC framebuffer */ NUBUS_DRHW_APPLE_SONORA =0x0022 ,/* Sonora built-in video */ +NUBUS_DRHW_APPLE_JET =0x0029 ,/* Jet framebuffer (DuoDock) */ NUBUS_DRHW_APPLE_24AC =0x002b ,/* Mac 24AC Video Card */ NUBUS_DRHW_APPLE_VALKYRIE =0x002e , -NUBUS_DRHW_APPLE_JET =0x0029 ,/* Jet framebuffer (DuoDock) */ NUBUS_DRHW_SMAC_GFX =0x0105 ,/* SuperMac GFX */ NUBUS_DRHW_RASTER_CB264 =0x013B ,/* RasterOps ColorBoard 264 */ NUBUS_DRHW_MICRON_XCEED = 0x0146, /* Micron Exceed color */
Signature · 1 line
2.10.2
Geert Uytterhoeven
maintainerHi Finn,
Quoted 4 lines · Finn Thain
This series has various patches from several different people. Two printk modernization patches were originally from Geert Uytterhoeven and three Nubus patches were originally committed to the Linux/mac68k CVS by David Huggins-Daines.
Thanks, most of them look sane enough to apply and still queue for v4.12.
I'm a bit reluctant about the nubus changes (patches 6 and 8), though. Do you think they need more testing?
Thanks!
Quoted 11 lines
Finn Thain (10):
m68k/mac: IOP - Modernize printing of kernel messages m68k/mac: Modernize printing of kernel messages m68k/mac: Adoptplatform_device_register_simple()m68k/mac: Clarify IOP message alloc/free confusion
nubus: Fixnubus_rewinddir(from mac68k CVS)
nubus: Remove slot zero probe (from mac68k CVS)
nubus: Clean up printk calls (from mac68k CVS)
nubus: Fix pointer validation
nubus: Clean up whitespace
nubus: Add MVC and VSC video card definitions
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Quoted 9 lines · Geert Uytterhoeven
Hi Finn,
Quoted 4 lines · Finn Thain
This series has various patches from several different people. Two printk modernization patches were originally from Geert Uytterhoeven and three Nubus patches were originally committed to the Linux/mac68k CVS by David Huggins-Daines.
Quoted 7 lines
Thanks, most of them look sane enough to apply and still queue for v4.12.
I'm a bit reluctant about the nubus changes (patches 6 and 8), though. Do you think they need more testing?
Thanks!
Patch 6 is partly dead code removal. In principle, this patch is a reversion to the old code (pre-v2.3.17). The old code was thoroughly tested in Debian Sarge. I suppose a reviewer might wonder whether we want to keep new code for probing fake slot resources in Apple's on-board ROMs. That would be useful if it could eliminate the macintosh_config struct. But it can't, and we don't want both mechanisms. Hence the reversion in the mac68k CVS.
Patch 8 changes the pointer validation code and although this has been tested on the valid path, you are right that it could use some negative testing. But that would seem to require cards with flawed ROMs. I don't know of any of such cards. So I think that all we can do is more review.
Maybe Michael or Laurent would be willing to review these two patches?
Quoted 17 lines
Quoted 12 lines
Finn Thain (10):
m68k/mac: IOP - Modernize printing of kernel messages m68k/mac: Modernize printing of kernel messages m68k/mac: Adoptplatform_device_register_simple()m68k/mac: Clarify IOP message alloc/free confusion
nubus: Fixnubus_rewinddir(from mac68k CVS)
nubus: Remove slot zero probe (from mac68k CVS)
nubus: Clean up printk calls (from mac68k CVS)
nubus: Fix pointer validation
nubus: Clean up whitespace
nubus: Add MVC and VSC video card definitionsGr{oetje,eeting}s,
Geert
Geert Uytterhoeven
maintainerHi Finn,
Quoted 24 lines · Finn Thain
Quoted 7 lines · Geert Uytterhoeven
Quoted 4 lines · Finn Thain
This series has various patches from several different people. Two printk modernization patches were originally from Geert Uytterhoeven and three Nubus patches were originally committed to the Linux/mac68k CVS by David Huggins-Daines.
Quoted 7 lines
Thanks, most of them look sane enough to apply and still queue for v4.12.
I'm a bit reluctant about the nubus changes (patches 6 and 8), though. Do you think they need more testing?
Thanks!
Patch 6 is partly dead code removal. In principle, this patch is a reversion to the old code (pre-v2.3.17). The old code was thoroughly tested in Debian Sarge. I suppose a reviewer might wonder whether we want to keep new code for probing fake slot resources in Apple's on-board ROMs. That would be useful if it could eliminate the
macintosh_configstruct. But it can't, and we don't want both mechanisms. Hence the reversion in the mac68k CVS.
Quoted 6 lines
Patch 8 changes the pointer validation code and although this has been tested on the valid path, you are right that it could use some negative testing. But that would seem to require cards with flawed ROMs. I don't know of any of such cards. So I think that all we can do is more review.
Maybe Michael or Laurent would be willing to review these two patches?
OK.
I've applied and queued all but patches 6 and 8. This required some small adjustment to e.g. the whitespace patch.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds