/* SPDX-License-Identifier: GPL-2.0-only */1/*2* longhaul.h3* (C) 2003 Dave Jones.4*5* VIA-specific information6*/78union msr_bcr2 {9struct {10unsigned Reseved:19, // 18:011ESOFTBF:1, // 1912Reserved2:3, // 22:2013CLOCKMUL:4, // 26:2314Reserved3:5; // 31:2715} bits;16unsigned long val;17};1819union msr_longhaul {20struct {21unsigned RevisionID:4, // 3:022RevisionKey:4, // 7:423EnableSoftBusRatio:1, // 824EnableSoftVID:1, // 925EnableSoftBSEL:1, // 1026Reserved:3, // 11:1327SoftBusRatio4:1, // 1428VRMRev:1, // 1529SoftBusRatio:4, // 19:1630SoftVID:5, // 24:2031Reserved2:3, // 27:2532SoftBSEL:2, // 29:2833Reserved3:2, // 31:3034MaxMHzBR:4, // 35:3235MaximumVID:5, // 40:3636MaxMHzFSB:2, // 42:4137MaxMHzBR4:1, // 4338Reserved4:4, // 47:4439MinMHzBR:4, // 51:4840MinimumVID:5, // 56:5241MinMHzFSB:2, // 58:5742MinMHzBR4:1, // 5943Reserved5:4; // 63:6044} bits;45unsigned long long val;46};4748/*49* Clock ratio tables. Div/Mod by 10 to get ratio.50* The eblcr values specify the ratio read from the CPU.51* The mults values specify what to write to the CPU.52*/5354/*55* VIA C3 Samuel 1 & Samuel 2 (stepping 0)56*/57static const int samuel1_mults[16] = {58-1, /* 0000 -> RESERVED */5930, /* 0001 -> 3.0x */6040, /* 0010 -> 4.0x */61-1, /* 0011 -> RESERVED */62-1, /* 0100 -> RESERVED */6335, /* 0101 -> 3.5x */6445, /* 0110 -> 4.5x */6555, /* 0111 -> 5.5x */6660, /* 1000 -> 6.0x */6770, /* 1001 -> 7.0x */6880, /* 1010 -> 8.0x */6950, /* 1011 -> 5.0x */7065, /* 1100 -> 6.5x */7175, /* 1101 -> 7.5x */72-1, /* 1110 -> RESERVED */73-1, /* 1111 -> RESERVED */74};7576static const int samuel1_eblcr[16] = {7750, /* 0000 -> RESERVED */7830, /* 0001 -> 3.0x */7940, /* 0010 -> 4.0x */80-1, /* 0011 -> RESERVED */8155, /* 0100 -> 5.5x */8235, /* 0101 -> 3.5x */8345, /* 0110 -> 4.5x */84-1, /* 0111 -> RESERVED */85-1, /* 1000 -> RESERVED */8670, /* 1001 -> 7.0x */8780, /* 1010 -> 8.0x */8860, /* 1011 -> 6.0x */89-1, /* 1100 -> RESERVED */9075, /* 1101 -> 7.5x */91-1, /* 1110 -> RESERVED */9265, /* 1111 -> 6.5x */93};9495/*96* VIA C3 Samuel2 Stepping 1->1597*/98static const int samuel2_eblcr[16] = {9950, /* 0000 -> 5.0x */10030, /* 0001 -> 3.0x */10140, /* 0010 -> 4.0x */102100, /* 0011 -> 10.0x */10355, /* 0100 -> 5.5x */10435, /* 0101 -> 3.5x */10545, /* 0110 -> 4.5x */106110, /* 0111 -> 11.0x */10790, /* 1000 -> 9.0x */10870, /* 1001 -> 7.0x */10980, /* 1010 -> 8.0x */11060, /* 1011 -> 6.0x */111120, /* 1100 -> 12.0x */11275, /* 1101 -> 7.5x */113130, /* 1110 -> 13.0x */11465, /* 1111 -> 6.5x */115};116117/*118* VIA C3 Ezra119*/120static const int ezra_mults[16] = {121100, /* 0000 -> 10.0x */12230, /* 0001 -> 3.0x */12340, /* 0010 -> 4.0x */12490, /* 0011 -> 9.0x */12595, /* 0100 -> 9.5x */12635, /* 0101 -> 3.5x */12745, /* 0110 -> 4.5x */12855, /* 0111 -> 5.5x */12960, /* 1000 -> 6.0x */13070, /* 1001 -> 7.0x */13180, /* 1010 -> 8.0x */13250, /* 1011 -> 5.0x */13365, /* 1100 -> 6.5x */13475, /* 1101 -> 7.5x */13585, /* 1110 -> 8.5x */136120, /* 1111 -> 12.0x */137};138139static const int ezra_eblcr[16] = {14050, /* 0000 -> 5.0x */14130, /* 0001 -> 3.0x */14240, /* 0010 -> 4.0x */143100, /* 0011 -> 10.0x */14455, /* 0100 -> 5.5x */14535, /* 0101 -> 3.5x */14645, /* 0110 -> 4.5x */14795, /* 0111 -> 9.5x */14890, /* 1000 -> 9.0x */14970, /* 1001 -> 7.0x */15080, /* 1010 -> 8.0x */15160, /* 1011 -> 6.0x */152120, /* 1100 -> 12.0x */15375, /* 1101 -> 7.5x */15485, /* 1110 -> 8.5x */15565, /* 1111 -> 6.5x */156};157158/*159* VIA C3 (Ezra-T) [C5M].160*/161static const int ezrat_mults[32] = {162100, /* 0000 -> 10.0x */16330, /* 0001 -> 3.0x */16440, /* 0010 -> 4.0x */16590, /* 0011 -> 9.0x */16695, /* 0100 -> 9.5x */16735, /* 0101 -> 3.5x */16845, /* 0110 -> 4.5x */16955, /* 0111 -> 5.5x */17060, /* 1000 -> 6.0x */17170, /* 1001 -> 7.0x */17280, /* 1010 -> 8.0x */17350, /* 1011 -> 5.0x */17465, /* 1100 -> 6.5x */17575, /* 1101 -> 7.5x */17685, /* 1110 -> 8.5x */177120, /* 1111 -> 12.0x */178179-1, /* 0000 -> RESERVED (10.0x) */180110, /* 0001 -> 11.0x */181-1, /* 0010 -> 12.0x */182-1, /* 0011 -> RESERVED (9.0x)*/183105, /* 0100 -> 10.5x */184115, /* 0101 -> 11.5x */185125, /* 0110 -> 12.5x */186135, /* 0111 -> 13.5x */187140, /* 1000 -> 14.0x */188150, /* 1001 -> 15.0x */189160, /* 1010 -> 16.0x */190130, /* 1011 -> 13.0x */191145, /* 1100 -> 14.5x */192155, /* 1101 -> 15.5x */193-1, /* 1110 -> RESERVED (13.0x) */194-1, /* 1111 -> RESERVED (12.0x) */195};196197static const int ezrat_eblcr[32] = {19850, /* 0000 -> 5.0x */19930, /* 0001 -> 3.0x */20040, /* 0010 -> 4.0x */201100, /* 0011 -> 10.0x */20255, /* 0100 -> 5.5x */20335, /* 0101 -> 3.5x */20445, /* 0110 -> 4.5x */20595, /* 0111 -> 9.5x */20690, /* 1000 -> 9.0x */20770, /* 1001 -> 7.0x */20880, /* 1010 -> 8.0x */20960, /* 1011 -> 6.0x */210120, /* 1100 -> 12.0x */21175, /* 1101 -> 7.5x */21285, /* 1110 -> 8.5x */21365, /* 1111 -> 6.5x */214215-1, /* 0000 -> RESERVED (9.0x) */216110, /* 0001 -> 11.0x */217120, /* 0010 -> 12.0x */218-1, /* 0011 -> RESERVED (10.0x)*/219135, /* 0100 -> 13.5x */220115, /* 0101 -> 11.5x */221125, /* 0110 -> 12.5x */222105, /* 0111 -> 10.5x */223130, /* 1000 -> 13.0x */224150, /* 1001 -> 15.0x */225160, /* 1010 -> 16.0x */226140, /* 1011 -> 14.0x */227-1, /* 1100 -> RESERVED (12.0x) */228155, /* 1101 -> 15.5x */229-1, /* 1110 -> RESERVED (13.0x) */230145, /* 1111 -> 14.5x */231};232233/*234* VIA C3 Nehemiah */235236static const int nehemiah_mults[32] = {237100, /* 0000 -> 10.0x */238-1, /* 0001 -> 16.0x */23940, /* 0010 -> 4.0x */24090, /* 0011 -> 9.0x */24195, /* 0100 -> 9.5x */242-1, /* 0101 -> RESERVED */24345, /* 0110 -> 4.5x */24455, /* 0111 -> 5.5x */24560, /* 1000 -> 6.0x */24670, /* 1001 -> 7.0x */24780, /* 1010 -> 8.0x */24850, /* 1011 -> 5.0x */24965, /* 1100 -> 6.5x */25075, /* 1101 -> 7.5x */25185, /* 1110 -> 8.5x */252120, /* 1111 -> 12.0x */253-1, /* 0000 -> 10.0x */254110, /* 0001 -> 11.0x */255-1, /* 0010 -> 12.0x */256-1, /* 0011 -> 9.0x */257105, /* 0100 -> 10.5x */258115, /* 0101 -> 11.5x */259125, /* 0110 -> 12.5x */260135, /* 0111 -> 13.5x */261140, /* 1000 -> 14.0x */262150, /* 1001 -> 15.0x */263160, /* 1010 -> 16.0x */264130, /* 1011 -> 13.0x */265145, /* 1100 -> 14.5x */266155, /* 1101 -> 15.5x */267-1, /* 1110 -> RESERVED (13.0x) */268-1, /* 1111 -> 12.0x */269};270271static const int nehemiah_eblcr[32] = {27250, /* 0000 -> 5.0x */273160, /* 0001 -> 16.0x */27440, /* 0010 -> 4.0x */275100, /* 0011 -> 10.0x */27655, /* 0100 -> 5.5x */277-1, /* 0101 -> RESERVED */27845, /* 0110 -> 4.5x */27995, /* 0111 -> 9.5x */28090, /* 1000 -> 9.0x */28170, /* 1001 -> 7.0x */28280, /* 1010 -> 8.0x */28360, /* 1011 -> 6.0x */284120, /* 1100 -> 12.0x */28575, /* 1101 -> 7.5x */28685, /* 1110 -> 8.5x */28765, /* 1111 -> 6.5x */28890, /* 0000 -> 9.0x */289110, /* 0001 -> 11.0x */290120, /* 0010 -> 12.0x */291100, /* 0011 -> 10.0x */292135, /* 0100 -> 13.5x */293115, /* 0101 -> 11.5x */294125, /* 0110 -> 12.5x */295105, /* 0111 -> 10.5x */296130, /* 1000 -> 13.0x */297150, /* 1001 -> 15.0x */298160, /* 1010 -> 16.0x */299140, /* 1011 -> 14.0x */300120, /* 1100 -> 12.0x */301155, /* 1101 -> 15.5x */302-1, /* 1110 -> RESERVED (13.0x) */303145 /* 1111 -> 14.5x */304};305306/*307* Voltage scales. Div/Mod by 1000 to get actual voltage.308* Which scale to use depends on the VRM type in use.309*/310311struct mV_pos {312unsigned short mV;313unsigned short pos;314};315316static const struct mV_pos vrm85_mV[32] = {317{1250, 8}, {1200, 6}, {1150, 4}, {1100, 2},318{1050, 0}, {1800, 30}, {1750, 28}, {1700, 26},319{1650, 24}, {1600, 22}, {1550, 20}, {1500, 18},320{1450, 16}, {1400, 14}, {1350, 12}, {1300, 10},321{1275, 9}, {1225, 7}, {1175, 5}, {1125, 3},322{1075, 1}, {1825, 31}, {1775, 29}, {1725, 27},323{1675, 25}, {1625, 23}, {1575, 21}, {1525, 19},324{1475, 17}, {1425, 15}, {1375, 13}, {1325, 11}325};326327static const unsigned char mV_vrm85[32] = {3280x04, 0x14, 0x03, 0x13, 0x02, 0x12, 0x01, 0x11,3290x00, 0x10, 0x0f, 0x1f, 0x0e, 0x1e, 0x0d, 0x1d,3300x0c, 0x1c, 0x0b, 0x1b, 0x0a, 0x1a, 0x09, 0x19,3310x08, 0x18, 0x07, 0x17, 0x06, 0x16, 0x05, 0x15332};333334static const struct mV_pos mobilevrm_mV[32] = {335{1750, 31}, {1700, 30}, {1650, 29}, {1600, 28},336{1550, 27}, {1500, 26}, {1450, 25}, {1400, 24},337{1350, 23}, {1300, 22}, {1250, 21}, {1200, 20},338{1150, 19}, {1100, 18}, {1050, 17}, {1000, 16},339{975, 15}, {950, 14}, {925, 13}, {900, 12},340{875, 11}, {850, 10}, {825, 9}, {800, 8},341{775, 7}, {750, 6}, {725, 5}, {700, 4},342{675, 3}, {650, 2}, {625, 1}, {600, 0}343};344345static const unsigned char mV_mobilevrm[32] = {3460x1f, 0x1e, 0x1d, 0x1c, 0x1b, 0x1a, 0x19, 0x18,3470x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10,3480x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08,3490x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00350};351352353354