From owner-freebsd-current Mon Jan 24 18: 4:39 2000 Delivered-To: freebsd-current@freebsd.org Received: from lor.watermarkgroup.com (lor.watermarkgroup.com [207.202.73.33]) by hub.freebsd.org (Postfix) with ESMTP id 3BEF11566E; Mon, 24 Jan 2000 18:04:35 -0800 (PST) (envelope-from luoqi@watermarkgroup.com) Received: (from luoqi@localhost) by lor.watermarkgroup.com (8.8.8/8.8.8) id VAA14309; Mon, 24 Jan 2000 21:04:33 -0500 (EST) (envelope-from luoqi) Date: Mon, 24 Jan 2000 21:04:33 -0500 (EST) From: Luoqi Chen Message-Id: <200001250204.VAA14309@lor.watermarkgroup.com> To: kato@ganko.eps.nagoya-u.ac.jp Subject: Re: indirection in bus space Cc: FreeBSD-current@FreeBSD.ORG, FreeBSD-hackers@FreeBSD.ORG, FreeBSD98-hackers@jp.freebsd.org, nyan@jp.freebsd.org Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > Why have two files bus_at386.h and bus_pc98.h? I386_BUS_PIO_IND should be > > able to live with I386_BUS_PIO and I386_BUS_MEMIO happily together. > > Because they are different in the type of bus_space_tag_t from each > other. It is the u_long in PC/AT and the structure in PC-98. For > example, bus_space_read_1()s of them are: > > PC/AT: > bus_space_read_1(...) > { > ... > return (inb(handle + offset)); > ... > } > > PC-98: > bus_space_read_1(...) > { > ... > return (inb(bsh.bsh_iat[offset])); > ... > } > You could set the handle to point to the structure instead: bus_space_read_1(...) { if (tag == I386_BUS_PIO) { return (inb(handle + offset)); } else if (tag == I386_BUS_PIO_IND) { struct bus_space_handle_pc98 *bsh = handle; return (inb(bsh->bsh_iat[offset])); } else if (tag == I386_BUS_MEMIO) { ... } } -lq To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message