/*
* linux/arch/m68k/mac/config.c
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file COPYING in the main directory of this archive
* for more details.
*/
/*
* Miscellaneous linux stuff
*/
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/mm.h>
#include <linux/tty.h>
#include <linux/console.h>
#include <linux/interrupt.h>
/* keyb */
#include <linux/random.h>
#include <linux/delay.h>
/* keyb */
#include <linux/init.h>
#include <linux/vt_kern.h>
#include <linux/platform_device.h>
#include <linux/adb.h>
#include <linux/cuda.h>
#include <linux/pmu.h>
#include <linux/rtc.h>
#include <asm/setup.h>
#include <asm/bootinfo.h>
#include <asm/bootinfo-mac.h>
#include <asm/byteorder.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/pgtable.h>
#include <asm/machdep.h>
#include <asm/macintosh.h>
#include <asm/macints.h>
#include <asm/machw.h>
#include <asm/mac_iop.h>
#include <asm/mac_via.h>
#include <asm/mac_oss.h>
#include <asm/mac_psc.h>
/* Mac bootinfo struct */
struct mac_booter_data mac_bi_data;
/* The phys. video addr. - might be bogus on some machines */
static unsigned long mac_orig_videoaddr;
extern int mac_hwclk(int, struct rtc_time *);
extern void iop_preinit(void);
extern void iop_init(void);
extern void via_init(void);
extern void via_init_clock(irq_handler_t func);
extern void oss_init(void);
extern void psc_init(void);
extern void baboon_init(void);
extern void mac_mksound(unsigned int, unsigned int);
static void mac_get_model(char *str);
static void mac_identify(void);
static void mac_report_hardware(void);
static void __init mac_sched_init(irq_handler_t vector)
{
via_init_clock(vector);
}
/*
* Parse a Macintosh-specific record in the bootinfo
*/
int __init mac_parse_bootinfo(const struct bi_record *record)
{
int unknown = 0;
const void *data = record->data;
switch (be16_to_cpu(record->tag)) {
case BI_MAC_MODEL:
mac_bi_data.id = be32_to_cpup(data);
break;
case BI_MAC_VADDR:
mac_bi_data.videoaddr = be32_to_cpup(data);
break;
case BI_MAC_VDEPTH:
mac_bi_data.videodepth = be32_to_cpup(data);
break;
case BI_MAC_VROW:
mac_bi_data.videorow = be32_to_cpup(data);
break;
case BI_MAC_VDIM:
mac_bi_data.dimensions = be32_to_cpup(data);
break;
case BI_MAC_VLOGICAL:
mac_orig_videoaddr = be32_to_cpup(data);
mac_bi_data.videological =
VIDEOMEMBASE + (mac_orig_videoaddr & ~VIDEOMEMMASK);
break;
case BI_MAC_SCCBASE:
mac_bi_data.sccbase = be32_to_cpup(data);
break;
case BI_MAC_BTIME:
mac_bi_data.boottime = be32_to_cpup(data);
break;
case BI_MAC_GMTBIAS:
mac_bi_data.gmtbias = be32_to_cpup(data);
break;
case BI_MAC_MEMSIZE:
mac_bi_data.memsize = be32_to_cpup(data);
break;
case BI_MAC_CPUID:
mac_bi_data.cpuid = be32_to_cpup(data);
break;
case BI_MAC_ROMBASE:
mac_bi_data.rombase = be32_to_cpup(data);
break;
default:
unknown = 1;
break;
}
return unknown;
}
void __init config_mac(void)
{
if (!MACH_IS_MAC)
pr_err("ERROR: no Mac, but config_mac() called!!\n");
mach_sched_init = mac_sched_init;
mach_init_IRQ = mac_init_IRQ;
mach_get_model = mac_get_model;
mach_hwclk = mac_hwclk;
mach_reset = mac_reset;
mach_halt = mac_poweroff;
mach_power_off = mac_poweroff;
mach_max_dma_address = 0xffffffff;
#if IS_ENABLED(CONFIG_INPUT_M68K_BEEP)
mach_beep = mac_mksound;
#endif
/*
* Determine hardware present
*/
mac_identify();
mac_report_hardware();
/*
* AFAIK only the IIci takes a cache card. The IIfx has onboard
* cache ... someone needs to figure out how to tell if it's on or
* not.
*/
if (macintosh_config->ident == MAC_MODEL_IICI)
mach_l2_flush = via_l2_flush;
}
/*
* Macintosh Table: hardcoded model configuration data.
*
* Much of this was defined by Alan, based on who knows what docs.
* I've added a lot more, and some of that was pure guesswork based
* on hardware pages present on the Mac web site. Possibly wildly
* inaccurate, so look here if a new Mac model won't run. Example: if
* a Mac crashes immediately after the VIA1 registers have been dumped
* to the screen, it probably died attempting to read DirB on a RBV.
* Meaning it should have MAC_VIA_IICI here :-)
*/
struct mac_model *macintosh_config;
EXPORT_SYMBOL(macintosh_config);
static struct mac_model mac_data_table[] = {
/*
* We'll pretend to be a Macintosh II, that's pretty safe.
*/
{
.ident = MAC_MODEL_II,
.name = "Unknown",
.adb_type = MAC_ADB_II,
.via_type = MAC_VIA_II,
.scsi_type = MAC_SCSI_OLD,
.scc_type = MAC_SCC_II,
.expansion_type = MAC_EXP_NUBUS,
.floppy_type = MAC_FLOPPY_UNSUPPORTED, /* IWM */
},
/*
* Original Mac II hardware
*/
{
.ident = MAC_MODEL_II,
.name = "II",
.adb_type = MAC_ADB_II,
.via_type = MAC_VIA_II,
.scsi_type = MAC_SCSI_OLD,
.scc_type = MAC_SCC_II,
.expansion_type = MAC_EXP_NUBUS,
.floppy_type = MAC_FLOPPY_UNSUPPORTED, /* IWM */
}, {