autoconf.c revision 1.49
11.49Sgwr/*	$NetBSD: autoconf.c,v 1.49 1997/03/26 22:38:50 gwr Exp $	*/
21.25Scgd
31.1Smw/*
41.17Schopps * Copyright (c) 1994 Christian E. Hopps
51.1Smw * All rights reserved.
61.1Smw *
71.1Smw * Redistribution and use in source and binary forms, with or without
81.1Smw * modification, are permitted provided that the following conditions
91.1Smw * are met:
101.1Smw * 1. Redistributions of source code must retain the above copyright
111.1Smw *    notice, this list of conditions and the following disclaimer.
121.1Smw * 2. Redistributions in binary form must reproduce the above copyright
131.1Smw *    notice, this list of conditions and the following disclaimer in the
141.1Smw *    documentation and/or other materials provided with the distribution.
151.1Smw * 3. All advertising materials mentioning features or use of this software
161.1Smw *    must display the following acknowledgement:
171.17Schopps *      This product includes software developed by Christian E. Hopps.
181.17Schopps * 4. The name of the author may not be used to endorse or promote products
191.17Schopps *    derived from this software without specific prior written permission
201.4Smw *
211.17Schopps * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
221.17Schopps * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
231.17Schopps * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
241.17Schopps * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
251.17Schopps * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
261.17Schopps * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
271.17Schopps * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
281.17Schopps * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
291.17Schopps * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
301.17Schopps * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
311.1Smw */
321.9Schopps#include <sys/param.h>
331.9Schopps#include <sys/systm.h>
341.17Schopps#include <sys/reboot.h>
351.9Schopps#include <sys/conf.h>
361.46Sthorpej#include <sys/buf.h>
371.17Schopps#include <sys/device.h>
381.17Schopps#include <sys/disklabel.h>
391.46Sthorpej#include <sys/disk.h>
401.19Schopps#include <machine/cpu.h>
411.17Schopps#include <amiga/amiga/cfdev.h>
421.17Schopps#include <amiga/amiga/device.h>
431.9Schopps#include <amiga/amiga/custom.h>
441.1Smw
451.46Sthorpejvoid findroot __P((struct device **, int *));
461.17Schoppsvoid mbattach __P((struct device *, struct device *, void *));
471.40Scgdint mbprint __P((void *, const char *));
481.45Sveegoint mbmatch __P((struct device *, struct cfdata *, void *));
491.11Schopps
501.17Schoppsint cold;	/* 1 if still booting */
511.17Schopps#include <sys/kernel.h>
521.46Sthorpej
531.46Sthorpejstruct devnametobdevmaj amiga_nam2blk[] = {
541.46Sthorpej	{ "fd",		2 },
551.46Sthorpej	{ "sd",		4 },
561.46Sthorpej	{ "cd",		7 },
571.46Sthorpej#ifdef notyet
581.46Sthorpej	{ "md",		XXX },
591.46Sthorpej#endif
601.46Sthorpej	{ NULL,		0 },
611.46Sthorpej};
621.47Smhitchu_long boot_partition;
631.46Sthorpej
641.1Smw/*
651.17Schopps * called at boot time, configure all devices on system
661.1Smw */
671.11Schoppsvoid
681.1Smwconfigure()
691.1Smw{
701.44Sis	int s;
711.49Sgwr
721.17Schopps	/*
731.17Schopps	 * this is the real thing baby (i.e. not console init)
741.17Schopps	 */
751.17Schopps	amiga_realconfig = 1;
761.36Sis#ifdef DRACO
771.36Sis	if (is_draco()) {
781.36Sis		*draco_intena &= ~DRIRQ_GLOBAL;
791.36Sis	} else
801.36Sis#endif
811.3Smw	custom.intena = INTF_INTEN;
821.44Sis	s = splhigh();
831.1Smw
841.31Scgd	if (config_rootfound("mainbus", "mainbus") == NULL)
851.17Schopps		panic("no mainbus found");
861.36Sis
871.39Sis#ifdef DEBUG_KERNEL_START
881.43Schristos	printf("survived autoconf, going to enable interrupts\n");
891.39Sis#endif
901.11Schopps
911.36Sis#ifdef DRACO
921.36Sis	if (is_draco()) {
931.36Sis		*draco_intena |= DRIRQ_GLOBAL;
941.36Sis		/* softints always enabled */
951.36Sis	} else
961.36Sis#endif
971.36Sis	{
981.36Sis		custom.intena = INTF_SETCLR | INTF_INTEN;
991.28Schopps
1001.36Sis		/* also enable hardware aided software interrupts */
1011.36Sis		custom.intena = INTF_SETCLR | INTF_SOFTINT;
1021.36Sis	}
1031.44Sis	splx(s);
1041.39Sis#ifdef DEBUG_KERNEL_START
1051.43Schristos	printf("survived interrupt enable\n");
1061.39Sis#endif
1071.49Sgwr	cold = 0;
1081.49Sgwr}
1091.49Sgwr
1101.49Sgwrvoid
1111.49Sgwrcpu_rootconf()
1121.49Sgwr{
1131.49Sgwr	struct device *booted_device;
1141.49Sgwr	int booted_partition;
1151.28Schopps
1161.46Sthorpej	findroot(&booted_device, &booted_partition);
1171.39Sis#ifdef DEBUG_KERNEL_START
1181.46Sthorpej	printf("survived findroot()\n");
1191.39Sis#endif
1201.46Sthorpej	setroot(booted_device, booted_partition, amiga_nam2blk);
1211.39Sis#ifdef DEBUG_KERNEL_START
1221.43Schristos	printf("survived setroot()\n");
1231.1Smw#endif
1241.17Schopps}
1251.3Smw
1261.17Schopps/*ARGSUSED*/
1271.17Schoppsint
1281.17Schoppssimple_devprint(auxp, pnp)
1291.17Schopps	void *auxp;
1301.42Smhitch	const char *pnp;
1311.17Schopps{
1321.17Schopps	return(QUIET);
1331.1Smw}
1341.1Smw
1351.17Schoppsint
1361.17Schoppsmatchname(fp, sp)
1371.17Schopps	char *fp, *sp;
1381.17Schopps{
1391.17Schopps	int len;
1401.1Smw
1411.17Schopps	len = strlen(fp);
1421.17Schopps	if (strlen(sp) != len)
1431.17Schopps		return(0);
1441.17Schopps	if (bcmp(fp, sp, len) == 0)
1451.17Schopps		return(1);
1461.17Schopps	return(0);
1471.17Schopps}
1481.1Smw
1491.17Schopps/*
1501.17Schopps * use config_search to find appropriate device, then call that device
1511.17Schopps * directly with NULL device variable storage.  A device can then
1521.17Schopps * always tell the difference betwean the real and console init
1531.17Schopps * by checking for NULL.
1541.17Schopps */
1551.11Schoppsint
1561.17Schoppsamiga_config_found(pcfp, pdp, auxp, pfn)
1571.17Schopps	struct cfdata *pcfp;
1581.17Schopps	struct device *pdp;
1591.17Schopps	void *auxp;
1601.17Schopps	cfprint_t pfn;
1611.1Smw{
1621.17Schopps	struct device temp;
1631.17Schopps	struct cfdata *cf;
1641.17Schopps
1651.17Schopps	if (amiga_realconfig)
1661.31Scgd		return(config_found(pdp, auxp, pfn) != NULL);
1671.17Schopps
1681.17Schopps	if (pdp == NULL)
1691.17Schopps		pdp = &temp;
1701.17Schopps
1711.17Schopps	pdp->dv_cfdata = pcfp;
1721.17Schopps	if ((cf = config_search((cfmatch_t)NULL, pdp, auxp)) != NULL) {
1731.30Sthorpej		cf->cf_attach->ca_attach(pdp, NULL, auxp);
1741.17Schopps		pdp->dv_cfdata = NULL;
1751.17Schopps		return(1);
1761.1Smw	}
1771.17Schopps	pdp->dv_cfdata = NULL;
1781.17Schopps	return(0);
1791.17Schopps}
1801.17Schopps
1811.17Schopps/*
1821.17Schopps * this function needs to get enough configured to do a console
1831.17Schopps * basically this means start attaching the grfxx's that support
1841.17Schopps * the console. Kinda hacky but it works.
1851.17Schopps */
1861.32Sveegovoid
1871.17Schoppsconfig_console()
1881.17Schopps{
1891.17Schopps	struct cfdata *cf;
1901.36Sis
1911.17Schopps	/*
1921.17Schopps	 * we need mainbus' cfdata.
1931.17Schopps	 */
1941.17Schopps	cf = config_rootsearch(NULL, "mainbus", "mainbus");
1951.36Sis	if (cf == NULL) {
1961.17Schopps		panic("no mainbus");
1971.36Sis	}
1981.1Smw	/*
1991.44Sis	 * delay clock calibration.
2001.44Sis	 */
2011.44Sis	amiga_config_found(cf, NULL, "clock", NULL);
2021.44Sis
2031.44Sis	/*
2041.17Schopps	 * internal grf.
2051.1Smw	 */
2061.36Sis#ifdef DRACO
2071.36Sis	if (!(is_draco()))
2081.36Sis#endif
2091.36Sis		amiga_config_found(cf, NULL, "grfcc", NULL);
2101.1Smw	/*
2111.27Schopps	 * zbus knows when its not for real and will
2121.21Schopps	 * only configure the appropriate hardware
2131.1Smw	 */
2141.27Schopps	amiga_config_found(cf, NULL, "zbus", NULL);
2151.1Smw}
2161.1Smw
2171.17Schopps/*
2181.17Schopps * mainbus driver
2191.17Schopps */
2201.30Sthorpejstruct cfattach mainbus_ca = {
2211.30Sthorpej	sizeof(struct device), mbmatch, mbattach
2221.30Sthorpej};
2231.30Sthorpej
2241.30Sthorpejstruct cfdriver mainbus_cd = {
2251.30Sthorpej	NULL, "mainbus", DV_DULL, NULL, 0
2261.17Schopps};
2271.17Schopps
2281.11Schoppsint
2291.45Sveegombmatch(pdp, cfp, auxp)
2301.45Sveego	struct device	*pdp;
2311.45Sveego	struct cfdata	*cfp;
2321.45Sveego	void		*auxp;
2331.1Smw{
2341.30Sthorpej
2351.17Schopps	if (cfp->cf_unit > 0)
2361.1Smw		return(0);
2371.1Smw	/*
2381.17Schopps	 * We are always here
2391.1Smw	 */
2401.1Smw	return(1);
2411.1Smw}
2421.1Smw
2431.1Smw/*
2441.17Schopps * "find" all the things that should be there.
2451.1Smw */
2461.11Schoppsvoid
2471.17Schoppsmbattach(pdp, dp, auxp)
2481.17Schopps	struct device *pdp, *dp;
2491.17Schopps	void *auxp;
2501.1Smw{
2511.43Schristos	printf("\n");
2521.17Schopps	config_found(dp, "clock", simple_devprint);
2531.36Sis#ifdef DRACO
2541.36Sis	if (is_draco()) {
2551.36Sis		config_found(dp, "kbd", simple_devprint);
2561.36Sis		config_found(dp, "drsc", simple_devprint);
2571.44Sis		config_found(dp, "drcom", simple_devprint);
2581.44Sis		config_found(dp, "drcom", simple_devprint);
2591.36Sis		/*
2601.36Sis		 * XXX -- missing here:
2611.36Sis		 * SuperIO chip serial, parallel, floppy
2621.36Sis		 * or maybe just make that into a pseudo
2631.36Sis		 * ISA bus.
2641.36Sis		 */
2651.36Sis	} else
2661.36Sis#endif
2671.36Sis	{
2681.36Sis		config_found(dp, "ser", simple_devprint);
2691.36Sis		config_found(dp, "par", simple_devprint);
2701.36Sis		config_found(dp, "kbd", simple_devprint);
2711.36Sis		config_found(dp, "ms", simple_devprint);
2721.36Sis		config_found(dp, "ms", simple_devprint);
2731.36Sis		config_found(dp, "grfcc", simple_devprint);
2741.36Sis		config_found(dp, "fdc", simple_devprint);
2751.36Sis	}
2761.24Schopps	if (is_a4000() || is_a1200())
2771.23Schopps		config_found(dp, "idesc", simple_devprint);
2781.29Schopps	if (is_a4000())			/* Try to configure A4000T SCSI */
2791.29Schopps		config_found(dp, "afsc", simple_devprint);
2801.27Schopps	config_found(dp, "zbus", simple_devprint);
2811.17Schopps	if (is_a3000())
2821.17Schopps		config_found(dp, "ahsc", simple_devprint);
2831.1Smw}
2841.1Smw
2851.11Schoppsint
2861.17Schoppsmbprint(auxp, pnp)
2871.17Schopps	void *auxp;
2881.40Scgd	const char *pnp;
2891.1Smw{
2901.17Schopps	if (pnp)
2911.43Schristos		printf("%s at %s", (char *)auxp, pnp);
2921.17Schopps	return(UNCONF);
2931.1Smw}
2941.1Smw
2951.46Sthorpej/*
2961.46Sthorpej * The system will assign the "booted device" indicator (and thus
2971.46Sthorpej * rootdev if rootspec is wildcarded) to the first partition 'a'
2981.46Sthorpej * in preference of boot.  However, it does walk unit backwards
2991.46Sthorpej * to remain compatible with the old Amiga method of picking the
3001.46Sthorpej * last root found.
3011.46Sthorpej */
3021.46Sthorpej#include <sys/fcntl.h>		/* XXXX and all that uses it */
3031.46Sthorpej#include <sys/proc.h>		/* XXXX and all that uses it */
3041.17Schopps
3051.46Sthorpej#include "fd.h"
3061.46Sthorpej#include "sd.h"
3071.46Sthorpej#include "cd.h"
3081.1Smw
3091.46Sthorpej#if NFD > 0
3101.46Sthorpejextern  struct cfdriver fd_cd;
3111.46Sthorpej#endif
3121.46Sthorpej#if NSD > 0
3131.46Sthorpejextern  struct cfdriver sd_cd;
3141.46Sthorpej#endif
3151.46Sthorpej#if NCD > 0
3161.46Sthorpejextern  struct cfdriver cd_cd;
3171.46Sthorpej#endif
3181.1Smw
3191.46Sthorpejstruct cfdriver *genericconf[] = {
3201.46Sthorpej#if NFD > 0
3211.46Sthorpej	&fd_cd,
3221.46Sthorpej#endif
3231.46Sthorpej#if NSD > 0
3241.46Sthorpej	&sd_cd,
3251.46Sthorpej#endif
3261.46Sthorpej#if NCD > 0
3271.46Sthorpej	&cd_cd,
3281.46Sthorpej#endif
3291.46Sthorpej	NULL,
3301.1Smw};
3311.1Smw
3321.11Schoppsvoid
3331.46Sthorpejfindroot(devpp, partp)
3341.46Sthorpej	struct device **devpp;
3351.46Sthorpej	int *partp;
3361.1Smw{
3371.46Sthorpej	struct disk *dkp;
3381.46Sthorpej	struct partition *pp;
3391.46Sthorpej	struct device **devs;
3401.46Sthorpej	int i, maj, unit;
3411.46Sthorpej
3421.1Smw	/*
3431.46Sthorpej	 * Default to "not found".
3441.1Smw	 */
3451.46Sthorpej	*devpp = NULL;
3461.46Sthorpej
3471.46Sthorpej	/* always partition 'a' */
3481.46Sthorpej	*partp = 0;
3491.47Smhitch
3501.47Smhitch#if NSD > 0
3511.47Smhitch	/*
3521.47Smhitch	 * If we have the boot partition offset (boot_partition), try
3531.47Smhitch	 * to locate the device corresponding to that partition.
3541.47Smhitch	 */
3551.47Smhitch	if (boot_partition != 0) {
3561.47Smhitch	 	struct bdevsw *bdp;
3571.47Smhitch
3581.47Smhitch		for (unit = 0; unit < sd_cd.cd_ndevs; ++unit) {
3591.47Smhitch			if (sd_cd.cd_devs[unit] == NULL)
3601.47Smhitch				continue;
3611.47Smhitch
3621.47Smhitch			/*
3631.47Smhitch			 * Find the disk corresponding to the current
3641.47Smhitch			 * device.
3651.47Smhitch			 */
3661.47Smhitch			devs = (struct device **)sd_cd.cd_devs;
3671.47Smhitch			if ((dkp = disk_find(devs[unit]->dv_xname)) == NULL)
3681.47Smhitch				continue;
3691.47Smhitch
3701.47Smhitch			if (dkp->dk_driver == NULL ||
3711.47Smhitch			    dkp->dk_driver->d_strategy == NULL)
3721.47Smhitch				continue;
3731.47Smhitch			for (bdp = bdevsw; bdp < (bdevsw + nblkdev); bdp++)
3741.47Smhitch				if (bdp->d_strategy ==
3751.47Smhitch				    dkp->dk_driver->d_strategy)
3761.47Smhitch					break;
3771.47Smhitch			if (bdp->d_open(MAKEDISKDEV(4, unit, 0),
3781.47Smhitch			    FREAD | FNONBLOCK, 0, curproc))
3791.47Smhitch				continue;
3801.47Smhitch			bdp->d_close(MAKEDISKDEV(4, unit, 0),
3811.47Smhitch			    FREAD | FNONBLOCK, 0, curproc);
3821.47Smhitch			/*
3831.47Smhitch			 * XXX - assumes booting only from 'a' partition
3841.47Smhitch			 */
3851.47Smhitch			pp = &dkp->dk_label->d_partitions[0];
3861.47Smhitch			if (pp->p_size == 0 || pp->p_fstype != FS_BSDFFS)
3871.47Smhitch				continue;
3881.47Smhitch			if (pp->p_offset == boot_partition) {
3891.47Smhitch				if (*devpp == NULL) {
3901.47Smhitch					*devpp = devs[unit];
3911.47Smhitch					*partp = 0;	/* XXX */
3921.47Smhitch				} else
3931.47Smhitch					printf("Ambiguous boot device\n");
3941.47Smhitch			}
3951.47Smhitch		}
3961.47Smhitch	}
3971.47Smhitch	if (*devpp != NULL)
3981.47Smhitch		return;		/* we found the boot device */
3991.47Smhitch#endif
4001.46Sthorpej
4011.46Sthorpej	for (i = 0; genericconf[i] != NULL; i++) {
4021.46Sthorpej		for (unit = genericconf[i]->cd_ndevs - 1; unit >= 0; unit--) {
4031.46Sthorpej			if (genericconf[i]->cd_devs[unit] == NULL)
4041.46Sthorpej				continue;
4051.46Sthorpej
4061.46Sthorpej			/*
4071.46Sthorpej			 * Find the disk structure corresponding to the
4081.46Sthorpej			 * current device.
4091.46Sthorpej			 */
4101.46Sthorpej			devs = (struct device **)genericconf[i]->cd_devs;
4111.46Sthorpej			if ((dkp = disk_find(devs[unit]->dv_xname)) == NULL)
4121.46Sthorpej				continue;
4131.46Sthorpej
4141.46Sthorpej			if (dkp->dk_driver == NULL ||
4151.46Sthorpej			    dkp->dk_driver->d_strategy == NULL)
4161.46Sthorpej				continue;
4171.46Sthorpej
4181.46Sthorpej			for (maj = 0; maj < nblkdev; maj++)
4191.46Sthorpej				if (bdevsw[maj].d_strategy ==
4201.46Sthorpej				    dkp->dk_driver->d_strategy)
4211.46Sthorpej					break;
4221.46Sthorpej#ifdef DIAGNOSTIC
4231.46Sthorpej			if (maj >= nblkdev)
4241.46Sthorpej				panic("findroot: impossible");
4251.46Sthorpej#endif
4261.46Sthorpej
4271.46Sthorpej			/* Open disk; forces read of disklabel. */
4281.46Sthorpej			if ((*bdevsw[maj].d_open)(MAKEDISKDEV(maj,
4291.46Sthorpej			    unit, 0), FREAD|FNONBLOCK, 0, &proc0))
4301.46Sthorpej				continue;
4311.48Smhitch			(void)(*bdevsw[maj].d_close)(MAKEDISKDEV(maj,
4321.46Sthorpej			    unit, 0), FREAD|FNONBLOCK, 0, &proc0);
4331.46Sthorpej
4341.46Sthorpej			pp = &dkp->dk_label->d_partitions[0];
4351.46Sthorpej			if (pp->p_size != 0 && pp->p_fstype == FS_BSDFFS) {
4361.46Sthorpej				*devpp = devs[unit];
4371.46Sthorpej				*partp = 0;
4381.46Sthorpej				return;
4391.46Sthorpej			}
4401.1Smw		}
4411.1Smw	}
4421.3Smw}
4431.17Schopps
4441.11Schopps/*
4451.11Schopps * Try to determine, of this machine is an A3000, which has a builtin
4461.11Schopps * realtime clock and scsi controller, so that this hardware is only
4471.11Schopps * included as "configured" if this IS an A3000
4481.11Schopps */
4491.5Smw
4501.5Smwint a3000_flag = 1;		/* patchable */
4511.5Smw#ifdef A4000
4521.5Smwint a4000_flag = 1;		/* patchable - default to A4000 */
4531.5Smw#else
4541.5Smwint a4000_flag = 0;		/* patchable */
4551.5Smw#endif
4561.5Smw
4571.3Smwint
4581.11Schoppsis_a3000()
4591.3Smw{
4601.11Schopps	/* this is a dirty kludge.. but how do you do this RIGHT ? :-) */
4611.22Schopps	extern long boot_fphystart;
4621.11Schopps	short sc;
4631.11Schopps
4641.19Schopps	if ((machineid >> 16) == 3000)
4651.19Schopps		return (1);			/* It's an A3000 */
4661.19Schopps	if (machineid >> 16)
4671.19Schopps		return (0);			/* It's not an A3000 */
4681.19Schopps	/* Machine type is unknown, so try to guess it */
4691.11Schopps	/* where is fastram on the A4000 ?? */
4701.11Schopps	/* if fastram is below 0x07000000, assume it's not an A3000 */
4711.22Schopps	if (boot_fphystart < 0x07000000)
4721.17Schopps		return(0);
4731.11Schopps	/*
4741.11Schopps	 * OK, fastram starts at or above 0x07000000, check specific
4751.11Schopps	 * machines
4761.11Schopps	 */
4771.17Schopps	for (sc = 0; sc < ncfdev; sc++) {
4781.17Schopps		switch (cfdev[sc].rom.manid) {
4791.17Schopps		case 2026:		/* Progressive Peripherals, Inc */
4801.17Schopps			switch (cfdev[sc].rom.prodid) {
4811.17Schopps			case 0:		/* PPI Mercury - A3000 */
4821.17Schopps			case 1:		/* PP&S A3000 '040 */
4831.17Schopps				return(1);
4841.17Schopps			case 150:	/* PPI Zeus - it's an A2000 */
4851.17Schopps			case 105:	/* PP&S A2000 '040 */
4861.17Schopps			case 187:	/* PP&S A500 '040 */
4871.17Schopps				return(0);
4881.11Schopps			}
4891.11Schopps			break;
4901.3Smw
4911.17Schopps		case 2112:			/* IVS */
4921.17Schopps			switch (cfdev[sc].rom.prodid) {
4931.17Schopps			case 242:
4941.17Schopps				return(0);	/* A2000 accelerator? */
4951.11Schopps			}
4961.11Schopps			break;
4971.11Schopps		}
4981.11Schopps	}
4991.17Schopps	return (a3000_flag);		/* XXX let flag tell now */
5001.5Smw}
5011.5Smw
5021.5Smwint
5031.11Schoppsis_a4000()
5041.5Smw{
5051.19Schopps	if ((machineid >> 16) == 4000)
5061.19Schopps		return (1);		/* It's an A4000 */
5071.24Schopps	if ((machineid >> 16) == 1200)
5081.24Schopps		return (0);		/* It's an A1200, so not A4000 */
5091.36Sis#ifdef DRACO
5101.36Sis	if (is_draco())
5111.36Sis		return (0);
5121.36Sis#endif
5131.24Schopps	/* Do I need this any more? */
5141.19Schopps	if ((custom.deniseid & 0xff) == 0xf8)
5151.19Schopps		return (1);
5161.19Schopps#ifdef DEBUG
5171.19Schopps	if (a4000_flag)
5181.43Schristos		printf("Denise ID = %04x\n", (unsigned short)custom.deniseid);
5191.19Schopps#endif
5201.19Schopps	if (machineid >> 16)
5211.19Schopps		return (0);		/* It's not an A4000 */
5221.19Schopps	return (a4000_flag);		/* Machine type not set */
5231.24Schopps}
5241.24Schopps
5251.24Schoppsint
5261.24Schoppsis_a1200()
5271.24Schopps{
5281.24Schopps	if ((machineid >> 16) == 1200)
5291.24Schopps		return (1);		/* It's an A1200 */
5301.24Schopps	return (0);			/* Machine type not set */
5311.1Smw}
5321.36Sis
5331.36Sis#ifdef DRACO
5341.36Sisint
5351.36Sisis_draco()
5361.36Sis{
5371.36Sis	if ((machineid >> 24) == 0x7D)
5381.36Sis		return ((machineid >> 16) & 0xFF);
5391.36Sis	return (0);
5401.36Sis}
5411.36Sis#endif
542