Date: Thu, 16 Mar 2000 10:18:24 -0500 From: Coleman Kane <cokane@one.net> To: stable@freebsd.org Subject: Patch to fix K6-2 MTRR code Message-ID: <20000316101824.A2979@evil.2y.net>
next in thread | raw e-mail | index | archive | help
--R3G7APHDIzY6R/pk Content-Type: multipart/mixed; boundary="82I3+IH0IqGh5yIs" --82I3+IH0IqGh5yIs Content-Type: text/plain; charset=us-ascii Here's a public patch for all of you to test who have FreeBSD and a CXT core K6-2. It fixes the previously broken MTRR code written for the k6-2. Run patch -p0 < k6_mem.c.diff from your /usr/src directory. You will also have to uncomment the k6_mem.c line on or about line 88 in /usr/src/sys/i386/conf/files.i386. --cokane --82I3+IH0IqGh5yIs Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="k6_mem.c.diff" Content-Transfer-Encoding: quoted-printable --- sys/i386/i386/k6_mem.c Wed Mar 15 01:47:44 2000 +++ sys/i386/i386/k6_mem.c Thu Mar 16 10:04:43 2000 @@ -27,6 +27,19 @@ * */ =20 +/* Changed by Coleman Kane, 15 March 2000 + + In function k6_mrmake, the mask created was being "grown" the wrong + way. Basically, the 0th bit was always left set, and the zeros were + being inserted from the top, rather than the canonical bottom of the + uint32. This code: len |=3D 1 << (14 - bit); was changed to: len |=3D 1 + << bit. e.g.: Old code read len of 0x80000 to be 0x1fff, rather than + 0x7ffc. Also, I removed the check for if both the WC and UC were set. + WC being set is basically an extension of UC-ness, so it implies UC. If + they are both set, the spec says the processor defaults to UC, rather + than WC. + +*/ #include <sys/param.h> #include <sys/kernel.h> #include <sys/systm.h> @@ -42,7 +55,7 @@ * 15 having the mask, the 1st bit being "write-combining" and the 0th bit * being "uncacheable". * - * Address Mask WC UC + * Address Mask WC UC * | XXXXXXXXXXXXXXX | XXXXXXXXXXXXXXX | X | X | * * There are two of these in the 64-bit UWCCR. @@ -56,6 +69,9 @@ =20 #define UWCCR 0xc0000085 =20 +/* Listed for K6 models 6-7, k6-2 model 8 stepping 0-7 Write Allocation +#define WHCR 0xc0000082 - Not used yet*/ + #define k6_reg_get(reg, addr, mask, wc, uc) do { \ addr =3D (reg) & 0xfffe0000; \ mask =3D ((reg) & 0x1fffc) >> 2; \ @@ -84,17 +100,29 @@ =20 if (desc->mr_base &~ 0xfffe0000) return EINVAL; - if (desc->mr_len < 131072 || !powerof2(desc->mr_len)) + if (desc->mr_len < 131072 || (!powerof2(desc->mr_len))) return EINVAL; - if (desc->mr_flags &~ (MDF_WRITECOMBINE|MDF_UNCACHEABLE)) - return EOPNOTSUPP; +/* Changed by Coleman Kane 15 Mar 2000 */=09 + /* WC implies UC */ + /*if (desc->mr_flags &~ (MDF_WRITECOMBINE|MDF_UNCACHEABLE)) + return EOPNOTSUPP; */ =20 for (bit =3D ffs(desc->mr_len >> 17) - 1; bit < 15; bit++) - len |=3D 1 << (14 - bit);=20 + len |=3D 1 << bit;=20 +/**********************************/ wc =3D (desc->mr_flags & MDF_WRITECOMBINE) ? 1 : 0; uc =3D (desc->mr_flags & MDF_UNCACHEABLE) ? 1 : 0; - +#if 0 +/* For Debugging Purposes */ + printf("K6MTRR: At %x", desc->mr_base); + printf(" mask %x", len); + printf(" wc %d", wc); + printf(" uc %d\n", uc); +#endif *mtrr =3D k6_reg_make(desc->mr_base, len, wc, uc); +#if 0 + printf("K6MTRR: %x\n", *mtrr); +#endif return 0; } =20 --82I3+IH0IqGh5yIs-- --R3G7APHDIzY6R/pk Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.0 (FreeBSD) Comment: For info see http://www.gnupg.org iD8DBQE40Ps/ERViMObJ880RARWNAJ442mznAWoPJ/4dQS6tpj8212px0wCdFg6R dTnw/8dET+JX2ZXtJAfX138= =t4RW -----END PGP SIGNATURE----- --R3G7APHDIzY6R/pk-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000316101824.A2979>