autoconf.c revision 1.88
11.88Saymeric/* $NetBSD: autoconf.c,v 1.88 2003/01/07 00:13:19 aymeric 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.80Saymeric 331.80Saymeric#include <sys/cdefs.h> 341.88Saymeric__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.88 2003/01/07 00:13:19 aymeric Exp $"); 351.80Saymeric 361.9Schopps#include <sys/param.h> 371.9Schopps#include <sys/systm.h> 381.17Schopps#include <sys/reboot.h> 391.9Schopps#include <sys/conf.h> 401.46Sthorpej#include <sys/buf.h> 411.17Schopps#include <sys/device.h> 421.17Schopps#include <sys/disklabel.h> 431.46Sthorpej#include <sys/disk.h> 441.19Schopps#include <machine/cpu.h> 451.17Schopps#include <amiga/amiga/cfdev.h> 461.17Schopps#include <amiga/amiga/device.h> 471.9Schopps#include <amiga/amiga/custom.h> 481.1Smw 491.79Saymericstatic void findroot(void); 501.79Saymericvoid mbattach(struct device *, struct device *, void *); 511.79Saymericint mbprint(void *, const char *); 521.79Saymericint mbmatch(struct device *, struct cfdata *, void *); 531.11Schopps 541.17Schopps#include <sys/kernel.h> 551.46Sthorpej 561.47Smhitchu_long boot_partition; 571.74Smattstruct device *booted_device; 581.74Smattint booted_partition; 591.81Saymeric 601.81Saymericint amiga_realconfig; 611.46Sthorpej 621.1Smw/* 631.17Schopps * called at boot time, configure all devices on system 641.1Smw */ 651.11Schoppsvoid 661.65Sthorpejcpu_configure() 671.1Smw{ 681.44Sis int s; 691.62Sis#ifdef DEBUG_KERNEL_START 701.62Sis int i; 711.62Sis#endif 721.49Sgwr 731.17Schopps /* 741.17Schopps * this is the real thing baby (i.e. not console init) 751.17Schopps */ 761.17Schopps amiga_realconfig = 1; 771.36Sis#ifdef DRACO 781.36Sis if (is_draco()) { 791.36Sis *draco_intena &= ~DRIRQ_GLOBAL; 801.36Sis } else 811.36Sis#endif 821.3Smw custom.intena = INTF_INTEN; 831.44Sis s = splhigh(); 841.1Smw 851.31Scgd if (config_rootfound("mainbus", "mainbus") == NULL) 861.17Schopps panic("no mainbus found"); 871.36Sis 881.39Sis#ifdef DEBUG_KERNEL_START 891.43Schristos printf("survived autoconf, going to enable interrupts\n"); 901.39Sis#endif 911.79Saymeric 921.36Sis#ifdef DRACO 931.36Sis if (is_draco()) { 941.36Sis *draco_intena |= DRIRQ_GLOBAL; 951.36Sis /* softints always enabled */ 961.36Sis } else 971.36Sis#endif 981.36Sis { 991.36Sis custom.intena = INTF_SETCLR | INTF_INTEN; 1001.28Schopps 1011.36Sis /* also enable hardware aided software interrupts */ 1021.36Sis custom.intena = INTF_SETCLR | INTF_SOFTINT; 1031.36Sis } 1041.39Sis#ifdef DEBUG_KERNEL_START 1051.62Sis for (i=splhigh(); i>=s ;i-=0x100) { 1061.62Sis splx(i); 1071.62Sis printf("%d...", (i>>8) & 7); 1081.62Sis } 1091.43Schristos printf("survived interrupt enable\n"); 1101.62Sis#else 1111.62Sis splx(s); 1121.39Sis#endif 1131.63Sthorpej#ifdef DEBUG_KERNEL_START 1141.63Sthorpej printf("survived configure...\n"); 1151.63Sthorpej#endif 1161.49Sgwr} 1171.49Sgwr 1181.49Sgwrvoid 1191.49Sgwrcpu_rootconf() 1201.49Sgwr{ 1211.77Sfrueauf findroot(); 1221.39Sis#ifdef DEBUG_KERNEL_START 1231.46Sthorpej printf("survived findroot()\n"); 1241.39Sis#endif 1251.64Sthorpej setroot(booted_device, booted_partition); 1261.39Sis#ifdef DEBUG_KERNEL_START 1271.43Schristos printf("survived setroot()\n"); 1281.1Smw#endif 1291.17Schopps} 1301.3Smw 1311.17Schopps/*ARGSUSED*/ 1321.17Schoppsint 1331.17Schoppssimple_devprint(auxp, pnp) 1341.17Schopps void *auxp; 1351.42Smhitch const char *pnp; 1361.17Schopps{ 1371.17Schopps return(QUIET); 1381.1Smw} 1391.1Smw 1401.17Schoppsint 1411.17Schoppsmatchname(fp, sp) 1421.17Schopps char *fp, *sp; 1431.17Schopps{ 1441.17Schopps int len; 1451.1Smw 1461.17Schopps len = strlen(fp); 1471.17Schopps if (strlen(sp) != len) 1481.17Schopps return(0); 1491.17Schopps if (bcmp(fp, sp, len) == 0) 1501.17Schopps return(1); 1511.17Schopps return(0); 1521.17Schopps} 1531.1Smw 1541.17Schopps/* 1551.17Schopps * use config_search to find appropriate device, then call that device 1561.79Saymeric * directly with NULL device variable storage. A device can then 1571.79Saymeric * always tell the difference betwean the real and console init 1581.17Schopps * by checking for NULL. 1591.17Schopps */ 1601.11Schoppsint 1611.17Schoppsamiga_config_found(pcfp, pdp, auxp, pfn) 1621.17Schopps struct cfdata *pcfp; 1631.17Schopps struct device *pdp; 1641.17Schopps void *auxp; 1651.17Schopps cfprint_t pfn; 1661.1Smw{ 1671.17Schopps struct device temp; 1681.17Schopps struct cfdata *cf; 1691.86Sthorpej const struct cfattach *ca; 1701.17Schopps 1711.17Schopps if (amiga_realconfig) 1721.31Scgd return(config_found(pdp, auxp, pfn) != NULL); 1731.17Schopps 1741.17Schopps if (pdp == NULL) 1751.17Schopps pdp = &temp; 1761.17Schopps 1771.17Schopps pdp->dv_cfdata = pcfp; 1781.88Saymeric pdp->dv_cfdriver = config_cfdriver_lookup(pcfp->cf_name); 1791.17Schopps if ((cf = config_search((cfmatch_t)NULL, pdp, auxp)) != NULL) { 1801.86Sthorpej ca = config_cfattach_lookup(cf->cf_name, cf->cf_atname); 1811.86Sthorpej if (ca != NULL) { 1821.86Sthorpej (*ca->ca_attach)(pdp, NULL, auxp); 1831.86Sthorpej pdp->dv_cfdata = NULL; 1841.86Sthorpej return(1); 1851.86Sthorpej } 1861.1Smw } 1871.17Schopps pdp->dv_cfdata = NULL; 1881.17Schopps return(0); 1891.17Schopps} 1901.17Schopps 1911.17Schopps/* 1921.17Schopps * this function needs to get enough configured to do a console 1931.79Saymeric * basically this means start attaching the grfxx's that support 1941.17Schopps * the console. Kinda hacky but it works. 1951.17Schopps */ 1961.32Sveegovoid 1971.17Schoppsconfig_console() 1981.79Saymeric{ 1991.17Schopps struct cfdata *cf; 2001.84Sthorpej 2011.84Sthorpej config_init(); 2021.36Sis 2031.17Schopps /* 2041.17Schopps * we need mainbus' cfdata. 2051.17Schopps */ 2061.17Schopps cf = config_rootsearch(NULL, "mainbus", "mainbus"); 2071.36Sis if (cf == NULL) { 2081.17Schopps panic("no mainbus"); 2091.36Sis } 2101.1Smw /* 2111.44Sis * delay clock calibration. 2121.44Sis */ 2131.44Sis amiga_config_found(cf, NULL, "clock", NULL); 2141.44Sis 2151.44Sis /* 2161.17Schopps * internal grf. 2171.1Smw */ 2181.36Sis#ifdef DRACO 2191.36Sis if (!(is_draco())) 2201.36Sis#endif 2211.36Sis amiga_config_found(cf, NULL, "grfcc", NULL); 2221.67Saymeric 2231.1Smw /* 2241.27Schopps * zbus knows when its not for real and will 2251.21Schopps * only configure the appropriate hardware 2261.1Smw */ 2271.27Schopps amiga_config_found(cf, NULL, "zbus", NULL); 2281.1Smw} 2291.1Smw 2301.79Saymeric/* 2311.79Saymeric * mainbus driver 2321.17Schopps */ 2331.85SthorpejCFATTACH_DECL(mainbus, sizeof(struct device), 2341.85Sthorpej mbmatch, mbattach, NULL, NULL); 2351.17Schopps 2361.11Schoppsint 2371.45Sveegombmatch(pdp, cfp, auxp) 2381.45Sveego struct device *pdp; 2391.45Sveego struct cfdata *cfp; 2401.45Sveego void *auxp; 2411.1Smw{ 2421.72Sis#if 0 /* 2431.72Sis * XXX is this right? but we need to be found twice 2441.72Sis * (early console init hack) 2451.72Sis */ 2461.71Skleink static int mainbus_matched = 0; 2471.30Sthorpej 2481.71Skleink /* Allow only one instance. */ 2491.71Skleink if (mainbus_matched) 2501.71Skleink return (0); 2511.71Skleink 2521.71Skleink mainbus_matched = 1; 2531.72Sis#endif 2541.71Skleink return (1); 2551.1Smw} 2561.1Smw 2571.1Smw/* 2581.17Schopps * "find" all the things that should be there. 2591.1Smw */ 2601.11Schoppsvoid 2611.17Schoppsmbattach(pdp, dp, auxp) 2621.17Schopps struct device *pdp, *dp; 2631.17Schopps void *auxp; 2641.1Smw{ 2651.43Schristos printf("\n"); 2661.17Schopps config_found(dp, "clock", simple_devprint); 2671.52Sis if (is_a3000() || is_a4000()) { 2681.52Sis config_found(dp, "a34kbbc", simple_devprint); 2691.58Sis } else 2701.53Sis#ifdef DRACO 2711.58Sis if (!is_draco()) 2721.53Sis#endif 2731.58Sis { 2741.52Sis config_found(dp, "a2kbbc", simple_devprint); 2751.52Sis } 2761.36Sis#ifdef DRACO 2771.36Sis if (is_draco()) { 2781.52Sis config_found(dp, "drbbc", simple_devprint); 2791.36Sis config_found(dp, "kbd", simple_devprint); 2801.36Sis config_found(dp, "drsc", simple_devprint); 2811.55Sis config_found(dp, "drsupio", simple_devprint); 2821.79Saymeric } else 2831.36Sis#endif 2841.36Sis { 2851.36Sis config_found(dp, "ser", simple_devprint); 2861.36Sis config_found(dp, "par", simple_devprint); 2871.36Sis config_found(dp, "kbd", simple_devprint); 2881.36Sis config_found(dp, "ms", simple_devprint); 2891.36Sis config_found(dp, "grfcc", simple_devprint); 2901.78Sis config_found(dp, "amidisplaycc", simple_devprint); 2911.36Sis config_found(dp, "fdc", simple_devprint); 2921.36Sis } 2931.69Smhitch if (is_a4000() || is_a1200()) { 2941.69Smhitch config_found(dp, "wdc", simple_devprint); 2951.23Schopps config_found(dp, "idesc", simple_devprint); 2961.69Smhitch } 2971.29Schopps if (is_a4000()) /* Try to configure A4000T SCSI */ 2981.29Schopps config_found(dp, "afsc", simple_devprint); 2991.17Schopps if (is_a3000()) 3001.17Schopps config_found(dp, "ahsc", simple_devprint); 3011.67Saymeric if (/*is_a600() || */is_a1200()) 3021.67Saymeric config_found(dp, "pccard", simple_devprint); 3031.54Sis#ifdef DRACO 3041.54Sis if (!is_draco()) 3051.54Sis#endif 3061.54Sis config_found(dp, "aucc", simple_devprint); 3071.54Sis 3081.57Sis config_found(dp, "zbus", simple_devprint); 3091.1Smw} 3101.1Smw 3111.11Schoppsint 3121.17Schoppsmbprint(auxp, pnp) 3131.17Schopps void *auxp; 3141.40Scgd const char *pnp; 3151.1Smw{ 3161.17Schopps if (pnp) 3171.87Sthorpej aprint_normal("%s at %s", (char *)auxp, pnp); 3181.17Schopps return(UNCONF); 3191.1Smw} 3201.1Smw 3211.46Sthorpej/* 3221.46Sthorpej * The system will assign the "booted device" indicator (and thus 3231.46Sthorpej * rootdev if rootspec is wildcarded) to the first partition 'a' 3241.46Sthorpej * in preference of boot. However, it does walk unit backwards 3251.46Sthorpej * to remain compatible with the old Amiga method of picking the 3261.46Sthorpej * last root found. 3271.46Sthorpej */ 3281.46Sthorpej#include <sys/fcntl.h> /* XXXX and all that uses it */ 3291.46Sthorpej#include <sys/proc.h> /* XXXX and all that uses it */ 3301.17Schopps 3311.46Sthorpej#include "fd.h" 3321.46Sthorpej#include "sd.h" 3331.46Sthorpej#include "cd.h" 3341.67Saymeric#include "wd.h" 3351.1Smw 3361.46Sthorpej#if NFD > 0 3371.46Sthorpejextern struct cfdriver fd_cd; 3381.82Sgehennaextern const struct bdevsw fd_bdevsw; 3391.46Sthorpej#endif 3401.46Sthorpej#if NSD > 0 3411.69Smhitchextern struct cfdriver sd_cd; 3421.82Sgehennaextern const struct bdevsw sd_bdevsw; 3431.46Sthorpej#endif 3441.46Sthorpej#if NCD > 0 3451.46Sthorpejextern struct cfdriver cd_cd; 3461.82Sgehennaextern const struct bdevsw cd_bdevsw; 3471.46Sthorpej#endif 3481.67Saymeric#if NWD > 0 3491.69Smhitchextern struct cfdriver wd_cd; 3501.82Sgehennaextern const struct bdevsw wd_bdevsw; 3511.67Saymeric#endif 3521.1Smw 3531.46Sthorpejstruct cfdriver *genericconf[] = { 3541.46Sthorpej#if NFD > 0 3551.46Sthorpej &fd_cd, 3561.46Sthorpej#endif 3571.46Sthorpej#if NSD > 0 3581.46Sthorpej &sd_cd, 3591.46Sthorpej#endif 3601.69Smhitch#if NWD > 0 3611.69Smhitch &wd_cd, 3621.69Smhitch#endif 3631.46Sthorpej#if NCD > 0 3641.46Sthorpej &cd_cd, 3651.46Sthorpej#endif 3661.46Sthorpej NULL, 3671.1Smw}; 3681.1Smw 3691.11Schoppsvoid 3701.76Smattfindroot(void) 3711.1Smw{ 3721.46Sthorpej struct disk *dkp; 3731.46Sthorpej struct partition *pp; 3741.46Sthorpej struct device **devs; 3751.46Sthorpej int i, maj, unit; 3761.82Sgehenna const struct bdevsw *bdp; 3771.47Smhitch 3781.47Smhitch#if NSD > 0 3791.47Smhitch /* 3801.47Smhitch * If we have the boot partition offset (boot_partition), try 3811.47Smhitch * to locate the device corresponding to that partition. 3821.47Smhitch */ 3831.56Sis#ifdef DEBUG_KERNEL_START 3841.56Sis printf("Boot partition offset is %ld\n", boot_partition); 3851.56Sis#endif 3861.47Smhitch if (boot_partition != 0) { 3871.54Sis int i; 3881.47Smhitch 3891.47Smhitch for (unit = 0; unit < sd_cd.cd_ndevs; ++unit) { 3901.56Sis#ifdef DEBUG_KERNEL_START 3911.56Sis printf("probing for sd%d\n", unit); 3921.56Sis#endif 3931.47Smhitch if (sd_cd.cd_devs[unit] == NULL) 3941.47Smhitch continue; 3951.47Smhitch 3961.47Smhitch /* 3971.47Smhitch * Find the disk corresponding to the current 3981.47Smhitch * device. 3991.47Smhitch */ 4001.47Smhitch devs = (struct device **)sd_cd.cd_devs; 4011.47Smhitch if ((dkp = disk_find(devs[unit]->dv_xname)) == NULL) 4021.47Smhitch continue; 4031.47Smhitch 4041.47Smhitch if (dkp->dk_driver == NULL || 4051.47Smhitch dkp->dk_driver->d_strategy == NULL) 4061.47Smhitch continue; 4071.82Sgehenna bdp = &sd_bdevsw; 4081.82Sgehenna maj = bdevsw_lookup_major(bdp); 4091.82Sgehenna if ((*bdp->d_open)(MAKEDISKDEV(maj, unit, RAW_PART), 4101.47Smhitch FREAD | FNONBLOCK, 0, curproc)) 4111.47Smhitch continue; 4121.82Sgehenna (*bdp->d_close)(MAKEDISKDEV(maj, unit, RAW_PART), 4131.47Smhitch FREAD | FNONBLOCK, 0, curproc); 4141.47Smhitch pp = &dkp->dk_label->d_partitions[0]; 4151.54Sis for (i = 0; i < dkp->dk_label->d_npartitions; 4161.54Sis i++, pp++) { 4171.56Sis#ifdef DEBUG_KERNEL_START 4181.56Sis printf("sd%d%c type %d offset %d size %d\n", 4191.56Sis unit, i+'a', pp->p_fstype, 4201.56Sis pp->p_offset, pp->p_size); 4211.56Sis#endif 4221.54Sis if (pp->p_size == 0 || 4231.54Sis (pp->p_fstype != FS_BSDFFS && 4241.54Sis pp->p_fstype != FS_SWAP)) 4251.54Sis continue; 4261.54Sis if (pp->p_offset == boot_partition) { 4271.76Smatt if (booted_device == NULL) { 4281.76Smatt booted_device = devs[unit]; 4291.76Smatt booted_partition = i; 4301.54Sis } else 4311.54Sis printf("Ambiguous boot device\n"); 4321.54Sis } 4331.47Smhitch } 4341.47Smhitch } 4351.47Smhitch } 4361.76Smatt if (booted_device != NULL) 4371.47Smhitch return; /* we found the boot device */ 4381.47Smhitch#endif 4391.46Sthorpej 4401.46Sthorpej for (i = 0; genericconf[i] != NULL; i++) { 4411.46Sthorpej for (unit = genericconf[i]->cd_ndevs - 1; unit >= 0; unit--) { 4421.46Sthorpej if (genericconf[i]->cd_devs[unit] == NULL) 4431.46Sthorpej continue; 4441.46Sthorpej 4451.46Sthorpej /* 4461.46Sthorpej * Find the disk structure corresponding to the 4471.46Sthorpej * current device. 4481.46Sthorpej */ 4491.46Sthorpej devs = (struct device **)genericconf[i]->cd_devs; 4501.46Sthorpej if ((dkp = disk_find(devs[unit]->dv_xname)) == NULL) 4511.46Sthorpej continue; 4521.46Sthorpej 4531.46Sthorpej if (dkp->dk_driver == NULL || 4541.46Sthorpej dkp->dk_driver->d_strategy == NULL) 4551.46Sthorpej continue; 4561.46Sthorpej 4571.82Sgehenna#if NFD > 0 4581.82Sgehenna if (fd_bdevsw.d_strategy == dkp->dk_driver->d_strategy) 4591.82Sgehenna bdp = &fd_bdevsw; 4601.82Sgehenna#endif 4611.82Sgehenna#if NSD > 0 4621.82Sgehenna if (sd_bdevsw.d_strategy == dkp->dk_driver->d_strategy) 4631.82Sgehenna bdp = &sd_bdevsw; 4641.82Sgehenna#endif 4651.82Sgehenna#if NWD > 0 4661.82Sgehenna if (wd_bdevsw.d_strategy == dkp->dk_driver->d_strategy) 4671.82Sgehenna bdp = &wd_bdevsw; 4681.82Sgehenna#endif 4691.82Sgehenna#if NCD > 0 4701.82Sgehenna if (cd_bdevsw.d_strategy == dkp->dk_driver->d_strategy) 4711.82Sgehenna bdp = &cd_bdevsw; 4721.82Sgehenna#endif 4731.46Sthorpej#ifdef DIAGNOSTIC 4741.82Sgehenna if (bdp == NULL) 4751.46Sthorpej panic("findroot: impossible"); 4761.46Sthorpej#endif 4771.82Sgehenna maj = bdevsw_lookup_major(bdp); 4781.46Sthorpej 4791.46Sthorpej /* Open disk; forces read of disklabel. */ 4801.82Sgehenna if ((*bdp->d_open)(MAKEDISKDEV(maj, 4811.46Sthorpej unit, 0), FREAD|FNONBLOCK, 0, &proc0)) 4821.46Sthorpej continue; 4831.82Sgehenna (void)(*bdp->d_close)(MAKEDISKDEV(maj, 4841.46Sthorpej unit, 0), FREAD|FNONBLOCK, 0, &proc0); 4851.46Sthorpej 4861.46Sthorpej pp = &dkp->dk_label->d_partitions[0]; 4871.46Sthorpej if (pp->p_size != 0 && pp->p_fstype == FS_BSDFFS) { 4881.76Smatt booted_device = devs[unit]; 4891.76Smatt booted_partition = 0; 4901.46Sthorpej return; 4911.46Sthorpej } 4921.1Smw } 4931.1Smw } 4941.3Smw} 4951.17Schopps 4961.11Schopps/* 4971.11Schopps * Try to determine, of this machine is an A3000, which has a builtin 4981.11Schopps * realtime clock and scsi controller, so that this hardware is only 4991.11Schopps * included as "configured" if this IS an A3000 5001.11Schopps */ 5011.5Smw 5021.5Smwint a3000_flag = 1; /* patchable */ 5031.5Smw#ifdef A4000 5041.5Smwint a4000_flag = 1; /* patchable - default to A4000 */ 5051.5Smw#else 5061.5Smwint a4000_flag = 0; /* patchable */ 5071.5Smw#endif 5081.5Smw 5091.3Smwint 5101.11Schoppsis_a3000() 5111.3Smw{ 5121.11Schopps /* this is a dirty kludge.. but how do you do this RIGHT ? :-) */ 5131.22Schopps extern long boot_fphystart; 5141.11Schopps short sc; 5151.11Schopps 5161.19Schopps if ((machineid >> 16) == 3000) 5171.19Schopps return (1); /* It's an A3000 */ 5181.19Schopps if (machineid >> 16) 5191.19Schopps return (0); /* It's not an A3000 */ 5201.19Schopps /* Machine type is unknown, so try to guess it */ 5211.11Schopps /* where is fastram on the A4000 ?? */ 5221.11Schopps /* if fastram is below 0x07000000, assume it's not an A3000 */ 5231.22Schopps if (boot_fphystart < 0x07000000) 5241.17Schopps return(0); 5251.11Schopps /* 5261.11Schopps * OK, fastram starts at or above 0x07000000, check specific 5271.11Schopps * machines 5281.11Schopps */ 5291.17Schopps for (sc = 0; sc < ncfdev; sc++) { 5301.17Schopps switch (cfdev[sc].rom.manid) { 5311.17Schopps case 2026: /* Progressive Peripherals, Inc */ 5321.17Schopps switch (cfdev[sc].rom.prodid) { 5331.17Schopps case 0: /* PPI Mercury - A3000 */ 5341.17Schopps case 1: /* PP&S A3000 '040 */ 5351.17Schopps return(1); 5361.17Schopps case 150: /* PPI Zeus - it's an A2000 */ 5371.17Schopps case 105: /* PP&S A2000 '040 */ 5381.17Schopps case 187: /* PP&S A500 '040 */ 5391.17Schopps return(0); 5401.11Schopps } 5411.11Schopps break; 5421.3Smw 5431.17Schopps case 2112: /* IVS */ 5441.17Schopps switch (cfdev[sc].rom.prodid) { 5451.17Schopps case 242: 5461.17Schopps return(0); /* A2000 accelerator? */ 5471.11Schopps } 5481.11Schopps break; 5491.11Schopps } 5501.11Schopps } 5511.17Schopps return (a3000_flag); /* XXX let flag tell now */ 5521.5Smw} 5531.5Smw 5541.5Smwint 5551.11Schoppsis_a4000() 5561.5Smw{ 5571.19Schopps if ((machineid >> 16) == 4000) 5581.19Schopps return (1); /* It's an A4000 */ 5591.24Schopps if ((machineid >> 16) == 1200) 5601.24Schopps return (0); /* It's an A1200, so not A4000 */ 5611.36Sis#ifdef DRACO 5621.36Sis if (is_draco()) 5631.36Sis return (0); 5641.36Sis#endif 5651.24Schopps /* Do I need this any more? */ 5661.19Schopps if ((custom.deniseid & 0xff) == 0xf8) 5671.19Schopps return (1); 5681.19Schopps#ifdef DEBUG 5691.19Schopps if (a4000_flag) 5701.43Schristos printf("Denise ID = %04x\n", (unsigned short)custom.deniseid); 5711.19Schopps#endif 5721.19Schopps if (machineid >> 16) 5731.19Schopps return (0); /* It's not an A4000 */ 5741.19Schopps return (a4000_flag); /* Machine type not set */ 5751.24Schopps} 5761.24Schopps 5771.24Schoppsint 5781.24Schoppsis_a1200() 5791.24Schopps{ 5801.24Schopps if ((machineid >> 16) == 1200) 5811.24Schopps return (1); /* It's an A1200 */ 5821.24Schopps return (0); /* Machine type not set */ 5831.1Smw} 584