diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 277acdaee..4734f1bc4 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -14,6 +14,7 @@ on: jobs: build: + name: Build (DEV_BUILD=${{ matrix.dev-build }}, NEW_DYNAREC=${{ matrix.new-dynarec }}, X64=${{ matrix.target-arch.x64 }}) runs-on: windows-latest @@ -25,14 +26,29 @@ jobs: matrix: dev-build: ['y', 'n'] new-dynarec: ['y', 'n'] + target-arch: + - x64: 'n' + msystem: MINGW32 + prefix: mingw-w64-i686 + - x64: 'y' + msystem: MINGW64 + prefix: mingw-w64-x86_64 steps: - uses: msys2/setup-msys2@v2 with: update: true - msystem: MINGW32 - install: 'make mingw-w64-i686-toolchain mingw-w64-i686-openal mingw-w64-i686-freetype mingw-w64-i686-SDL2 mingw-w64-i686-zlib mingw-w64-i686-libpng mingw-w64-i686-libvncserver' + msystem: ${{ matrix.target-arch.msystem }} + install: >- + make + ${{ matrix.target-arch.prefix }}-toolchain + ${{ matrix.target-arch.prefix }}-openal + ${{ matrix.target-arch.prefix }}-freetype + ${{ matrix.target-arch.prefix }}-SDL2 + ${{ matrix.target-arch.prefix }}-zlib + ${{ matrix.target-arch.prefix }}-libpng + ${{ matrix.target-arch.prefix }}-libvncserver - uses: actions/checkout@v2 - name: make - run: make -fwin/makefile.mingw -j DEV_BUILD=${{ matrix.dev-build }} NEW_DYNAREC=${{ matrix.new-dynarec }} VNC=n + run: make -fwin/makefile.mingw -j DEV_BUILD=${{ matrix.dev-build }} NEW_DYNAREC=${{ matrix.new-dynarec }} X64=${{ matrix.target-arch.x64 }} VNC=n working-directory: ./src diff --git a/src/cdrom/cdrom_image_backend.c b/src/cdrom/cdrom_image_backend.c index 96f60ed61..3db993b8a 100644 --- a/src/cdrom/cdrom_image_backend.c +++ b/src/cdrom/cdrom_image_backend.c @@ -425,8 +425,8 @@ int cdi_read_sectors(cd_img_t *cdi, uint8_t *buffer, int raw, uint32_t sector, uint32_t num) { int sector_size, success = 1; - uint8_t buf_len, *buf; - uint32_t i; + uint8_t *buf; + uint32_t buf_len, i; /* TODO: This fails to account for Mode 2. Shouldn't we have a function to get sector size? */ diff --git a/src/chipset/via_pipc.c b/src/chipset/via_pipc.c index f58966e0b..7e4a0835c 100644 --- a/src/chipset/via_pipc.c +++ b/src/chipset/via_pipc.c @@ -202,15 +202,12 @@ pipc_reset_hard(void *priv) switch (dev->local) { case VIA_PIPC_586A: case VIA_PIPC_586B: + case VIA_PIPC_596A: dev->usb_regs[i][0x08] = 0x02; break; - case VIA_PIPC_596A: - dev->usb_regs[i][0x08] = 0x08; - break; - case VIA_PIPC_596B: - dev->usb_regs[i][0x08] = 0x11; + dev->usb_regs[i][0x08] = 0x08; break; case VIA_PIPC_686A: @@ -218,7 +215,7 @@ pipc_reset_hard(void *priv) break; case VIA_PIPC_686B: - dev->usb_regs[i][0x08] = 0x16; + dev->usb_regs[i][0x08] = 0x1a; break; } diff --git a/src/codegen/codegen_ops_fpu.h b/src/codegen/codegen_ops_fpu.h index 481eadb8c..b15d41bff 100644 --- a/src/codegen/codegen_ops_fpu.h +++ b/src/codegen/codegen_ops_fpu.h @@ -146,7 +146,7 @@ static uint32_t ropFSTs(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint3 static uint32_t ropFSTd(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) { x86seg *target_seg; - int host_reg1, host_reg2; + int host_reg1, host_reg2 = 0; FP_ENTER(); op_pc--; diff --git a/src/codegen/codegen_ops_mmx.h b/src/codegen/codegen_ops_mmx.h index 14730cb93..b669567fd 100644 --- a/src/codegen/codegen_ops_mmx.h +++ b/src/codegen/codegen_ops_mmx.h @@ -1,6 +1,6 @@ static uint32_t ropMOVQ_q_mm(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) { - int host_reg1, host_reg2; + int host_reg1, host_reg2 = 0; MMX_ENTER(); diff --git a/src/codegen/codegen_ops_x86-64.h b/src/codegen/codegen_ops_x86-64.h index 452f09937..aa8feb8cc 100644 --- a/src/codegen/codegen_ops_x86-64.h +++ b/src/codegen/codegen_ops_x86-64.h @@ -124,6 +124,33 @@ static inline void load_param_2_64(codeblock_t *block, uint64_t param) #endif addquad(param); } +static inline void load_param_2_reg_64(int reg) +{ + if (reg & 8) + { +#if WIN64 + addbyte(0x4c); /*MOVL EDX,reg*/ + addbyte(0x89); + addbyte(0xc0 | REG_EDX | ((reg & 7) << 3)); +#else + addbyte(0x4c); /*MOVL ESI,reg*/ + addbyte(0x89); + addbyte(0xc0 | REG_ESI | ((reg & 7) << 3)); +#endif + } + else + { +#if WIN64 + addbyte(0x48); /*MOVL EDX,reg*/ + addbyte(0x89); + addbyte(0xc0 | REG_EDX | ((reg & 7) << 3)); +#else + addbyte(0x48); /*MOVL ESI,reg*/ + addbyte(0x89); + addbyte(0xc0 | REG_ESI | ((reg & 7) << 3)); +#endif + } +} static inline void load_param_3_reg_32(int reg) { @@ -270,33 +297,26 @@ static inline void STORE_REG_TARGET_B_RELEASE(int host_reg, int guest_reg) addbyte(0x44); addbyte(0x89); addbyte(0xc0 | ((host_reg & 3) << 3)); - if (host_reg & 0x10) - { - addbyte(0x66); /*AND AX, 0xff00*/ - addbyte(0x25); - addword(0xff00); - } - else - { - addbyte(0x66); /*SHL AX, 8*/ - addbyte(0xc1); - addbyte(0xe0); - addbyte(0x08); - } } - else - { - if (host_reg) - { - addbyte(0x66); /*MOV AX, host_reg*/ - addbyte(0x89); - addbyte(0xc0 | ((host_reg & 3) << 3)); - } - addbyte(0x66); /*SHL AX, 8*/ - addbyte(0xc1); - addbyte(0xe0); - addbyte(0x08); + else if (host_reg & 3) + { + addbyte(0x66); /*MOV AX, host_reg*/ + addbyte(0x89); + addbyte(0xc0 | ((host_reg & 3) << 3)); } + if (host_reg & 0x10) + { + addbyte(0x66); /*AND AX, 0xff00*/ + addbyte(0x25); + addword(0xff00); + } + else + { + addbyte(0x66); /*SHL AX, 8*/ + addbyte(0xc1); + addbyte(0xe0); + addbyte(0x08); + } addbyte(0x66); /*AND dest_reg, 0x00ff*/ addbyte(0x41); addbyte(0x81); @@ -1396,7 +1416,11 @@ static inline void MEM_STORE_ADDR_EA_B(x86seg *seg, int host_reg) addbyte(REG_EDI | (REG_ESI << 3)); } addbyte(0xeb); /*JMP done*/ - addbyte(2+2+3+12+4+6); + if (host_reg & 8) { + addbyte(2+2+3+12+4+6); + } else { + addbyte(2+2+2+12+4+6); + } /*slowpath:*/ addbyte(0x01); /*ADD ECX,EAX*/ addbyte(0xc1); @@ -1488,7 +1512,11 @@ static inline void MEM_STORE_ADDR_EA_W(x86seg *seg, int host_reg) addbyte(REG_EDI | (REG_ESI << 3)); } addbyte(0xeb); /*JMP done*/ - addbyte(2+2+3+12+4+6); + if (host_reg & 8) { + addbyte(2+2+3+12+4+6); + } else { + addbyte(2+2+2+12+4+6); + } /*slowpath:*/ addbyte(0x01); /*ADD ECX,EAX*/ addbyte(0xc1); @@ -1578,7 +1606,11 @@ static inline void MEM_STORE_ADDR_EA_L(x86seg *seg, int host_reg) addbyte(REG_EDI | (REG_ESI << 3)); } addbyte(0xeb); /*JMP done*/ - addbyte(2+2+3+12+4+6); + if (host_reg & 8) { + addbyte(2+2+3+12+4+6); + } else { + addbyte(2+2+2+12+4+6); + } /*slowpath:*/ addbyte(0x01); /*ADD ECX,EAX*/ addbyte(0xc1); @@ -6032,12 +6064,16 @@ static inline void MEM_STORE_ADDR_EA_B_NO_ABRT(x86seg *seg, int host_reg) addbyte(REG_EDI | (REG_ESI << 3)); } addbyte(0xeb); /*JMP done*/ - addbyte(2+2+3+12); + if (host_reg & 8) { + addbyte(2+2+3+12); + } else { + addbyte(2+2+2+12); + } /*slowpath:*/ load_param_2_reg_32(host_reg); - addbyte(0x01); /*ADD ECX,EAX*/ - addbyte(0xc1); - load_param_1_reg_32(REG_ECX); + addbyte(0x01); /*ADD EBX,EAX*/ + addbyte(0xc3); + load_param_1_reg_32(REG_EBX); call_long((uintptr_t)writemembl); /*done:*/ } @@ -6117,12 +6153,16 @@ static inline void MEM_STORE_ADDR_EA_W_NO_ABRT(x86seg *seg, int host_reg) addbyte(REG_EDI | (REG_ESI << 3)); } addbyte(0xeb); /*JMP done*/ - addbyte(2+2+3+12); + if (host_reg & 8) { + addbyte(2+2+3+12); + } else { + addbyte(2+2+2+12); + } /*slowpath:*/ load_param_2_reg_32(host_reg); - addbyte(0x01); /*ADD ECX,EAX*/ - addbyte(0xc1); - load_param_1_reg_32(REG_ECX); + addbyte(0x01); /*ADD EBX,EAX*/ + addbyte(0xc3); + load_param_1_reg_32(REG_EBX); call_long((uintptr_t)writememwl); /*done:*/ } @@ -6200,12 +6240,16 @@ static inline void MEM_STORE_ADDR_EA_L_NO_ABRT(x86seg *seg, int host_reg) addbyte(REG_EDI | (REG_ESI << 3)); } addbyte(0xeb); /*JMP done*/ - addbyte(2+2+3+12); + if (host_reg & 8) { + addbyte(2+2+3+12); + } else { + addbyte(2+2+2+12); + } /*slowpath:*/ load_param_2_reg_32(host_reg); - addbyte(0x01); /*ADD ECX,EAX*/ - addbyte(0xc1); - load_param_1_reg_32(REG_ECX); + addbyte(0x01); /*ADD EBX,EAX*/ + addbyte(0xc3); + load_param_1_reg_32(REG_EBX); call_long((uintptr_t)writememll); /*done:*/ } diff --git a/src/codegen/codegen_ops_xchg.h b/src/codegen/codegen_ops_xchg.h index 597d26e1b..76cb9e437 100644 --- a/src/codegen/codegen_ops_xchg.h +++ b/src/codegen/codegen_ops_xchg.h @@ -44,9 +44,6 @@ OP_XCHG_EAX_(EBP) static uint32_t ropXCHG_b(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) { -/* #ifdef __amd64__ - return 0; -#else */ int src_reg, dst_reg, temp_reg; if ((fetchdat & 0xc0) != 0xc0) @@ -59,7 +56,6 @@ static uint32_t ropXCHG_b(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uin STORE_REG_TARGET_B_RELEASE(temp_reg, fetchdat & 7); return op_pc + 1; -/* #endif */ } static uint32_t ropXCHG_w(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) { diff --git a/src/config.c b/src/config.c index a2aa1b19d..f4026f4a3 100644 --- a/src/config.c +++ b/src/config.c @@ -1,4 +1,4 @@ -/* +/* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent @@ -541,6 +541,7 @@ load_machine(void) if (machine >= machine_count()) machine = machine_count() - 1; + cpu_override = config_get_int(cat, "cpu_override", 0); cpu_f = NULL; p = config_get_string(cat, "cpu_family", NULL); if (p) { @@ -627,7 +628,6 @@ load_machine(void) } } cpu_s = (CPU *) &cpu_f->cpus[cpu]; - cpu_override = config_get_int(cat, "cpu_override", 0); cpu_waitstates = config_get_int(cat, "cpu_waitstates", 0); @@ -715,7 +715,20 @@ load_input_devices(void) else mouse_type = 0; - joystick_type = config_get_int(cat, "joystick_type", JOYSTICK_TYPE_NONE); + p = config_get_string(cat, "joystick_type", NULL); + if (p != NULL) { + joystick_type = joystick_get_from_internal_name(p); + if (!joystick_type) { + /* Try to read an integer for backwards compatibility with old configs */ + c = config_get_int(cat, "joystick_type", 8); + if ((c >= 0) && (c < 8)) + /* "None" was type 8 instead of 0 previously, shift the number accordingly */ + joystick_type = c + 1; + else + joystick_type = 0; + } + } else + joystick_type = 0; for (c=0; c -1)) { @@ -1975,7 +1989,7 @@ save_input_devices(void) config_set_string(cat, "mouse_type", mouse_get_internal_name(mouse_type)); - if (joystick_type == JOYSTICK_TYPE_NONE) { + if (!joystick_type) { config_delete_var(cat, "joystick_type"); for (c = 0; c < 16; c++) { @@ -1996,7 +2010,7 @@ save_input_devices(void) } } } else { - config_set_int(cat, "joystick_type", joystick_type); + config_set_string(cat, "joystick_type", joystick_get_internal_name(joystick_type)); for (c = 0; c < joystick_get_max_joysticks(joystick_type); c++) { sprintf(tmp2, "joystick_%i_nr", c); diff --git a/src/cpu/808x.c b/src/cpu/808x.c index bb579f473..c14a2b604 100644 --- a/src/cpu/808x.c +++ b/src/cpu/808x.c @@ -462,9 +462,9 @@ static void writemem(uint32_t s, uint16_t v) { if (opcode & 1) - return writememw(s, cpu_state.eaaddr, v); + writememw(s, cpu_state.eaaddr, v); else - return writememb(s, cpu_state.eaaddr, (uint8_t) (v & 0xff)); + writememb(s, cpu_state.eaaddr, (uint8_t) (v & 0xff)); } diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 5cb6f2c31..fe5e1f1ae 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -370,32 +370,47 @@ cpu_is_eligible(const cpu_family_t *cpu_family, int cpu, int machine) if (machine_s->cpu_max_voltage && (cpu_s->voltage > (machine_s->cpu_max_voltage + 100))) /* maximum voltage with 0.1V tolerance */ return 0; - /* Account for CPUs that use a different internal multiplier than specified by jumpers. */ + /* Account for CPUs which use a different internal multiplier than specified by jumpers. */ double multi = cpu_s->multi; if (cpu_s->cpu_flags & CPU_FIXED_MULTIPLIER) { - multi = machine_s->cpu_min_multi; + return 1; /* don't care about multiplier compatibility on fixed multiplier CPUs */ } else if (cpu_family->package & CPU_PKG_SOCKET5_7) { - if (multi == 1.75) /* K5 */ + if ((multi == 1.5) && (cpu_s->cpu_type & CPU_5K86) && (machine_s->cpu_min_multi > 1.5)) /* K5 5k86 */ + multi = 2.0; + else if (multi == 1.75) /* K5 5k86 */ multi = 2.5; - else if ((multi == 2.0) && (cpu_s->cpu_type & CPU_5K86)) /* K5 */ - multi = 3.0; - else if ((multi == 2.0) && (cpu_s->cpu_type & (CPU_K6_2P | CPU_K6_3P))) /* K6-2+ / K6-3+ */ - multi = 2.5; - else if (multi == (7.0 / 3.0)) /* WinChip 2A */ + else if (multi == 2.0) { + if (cpu_s->cpu_type & CPU_5K86) /* K5 5k86 */ + multi = 3.0; + else if (cpu_s->cpu_type & (CPU_K6_2P | CPU_K6_3P)) /* K6-2+ / K6-3+ */ + multi = 2.5; + else if ((cpu_s->cpu_type & (CPU_WINCHIP | CPU_WINCHIP2)) && (machine_s->cpu_min_multi > 2.0)) /* WinChip (2) */ + multi = 2.5; + } + else if (multi == (7.0 / 3.0)) /* WinChip 2A - 2.33x */ multi = 5.0; - else if (multi == (8.0 / 3.0)) /* WinChip 2A */ + else if (multi == (8.0 / 3.0)) /* WinChip 2A - 2.66x */ multi = 5.5; else if ((multi == 3.0) && (cpu_s->cpu_type & (CPU_Cx6x86 | CPU_Cx6x86L))) /* 6x86(L) */ multi = 1.5; - else if (multi == (10.0 / 3.0)) /* WinChip 2A */ + else if (multi == (10.0 / 3.0)) /* WinChip 2A - 3.33x */ multi = 2.0; - else if (multi == 3.5) /* standard set by the Pentium MMX */ + else if ((multi == 3.5) && (machine_s->cpu_min_multi < 3.5)) /* standard set by the Pentium MMX */ multi = 1.5; - else if ((multi == 4.0) && (cpu_s->cpu_type & (CPU_WINCHIP | CPU_WINCHIP2))) /* WinChip (2) */ - multi = 1.5; - else if ((multi == 4.0) && (cpu_s->cpu_type & (CPU_Cx6x86 | CPU_Cx6x86L))) /* 6x86(L) */ - multi = 3.0; - else if (multi == 6.0) /* K6-2 */ + else if (multi == 4.0) { + if (cpu_s->cpu_type & (CPU_WINCHIP | CPU_WINCHIP2)) { /* WinChip (2) */ + if (machine_s->cpu_min_multi >= 1.5) + multi = 1.5; + else if (machine_s->cpu_min_multi >= 3.5) + multi = 3.5; + else if (machine_s->cpu_min_multi >= 4.5) + multi = 4.5; + } else if (cpu_s->cpu_type & (CPU_Cx6x86 | CPU_Cx6x86L)) /* 6x86(L) */ + multi = 3.0; + } + else if ((multi == 5.0) && (cpu_s->cpu_type & (CPU_WINCHIP | CPU_WINCHIP2)) && (machine_s->cpu_min_multi > 5.0)) /* WinChip (2) */ + multi = 5.5; + else if ((multi == 6.0) && (machine_s->cpu_max_multi < 6.0)) /* K6-2(+) / K6-3(+) */ multi = 2.0; } diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index 73f9524ad..f21c4822f 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -240,35 +240,22 @@ typedef struct { uint64_t fcr2, fcr3; } msr_t; -typedef union { - uint32_t l; - uint16_t w; -} cr0_t; - - typedef struct { x86reg regs[8]; uint8_t tag[8]; - int8_t ssegs, ismmx, - abrt, pad; - - uint16_t npxs, npxc, flags, eflags, - old_npxc, new_npxc; - - uint16_t MM_w4[8]; - - int _cycles, - flags_op, TOP; - - uint32_t flags_res, - flags_op1, flags_op2, - pc, oldpc, eaaddr, op32; - - cr0_t CR0; - x86seg *ea_seg; + uint32_t eaaddr; + + int flags_op; + uint32_t flags_res, + flags_op1, flags_op2; + + uint32_t pc, + oldpc, op32; + + int TOP; union { struct { @@ -279,10 +266,21 @@ typedef struct { int32_t rm_mod_reg_data; } rm_data; + int8_t ssegs, ismmx, + abrt, pad; + + int _cycles; + + uint16_t npxs, npxc; + double ST[8]; + uint16_t MM_w4[8]; + MMX_REG MM[8]; + uint16_t old_npxc, new_npxc; + #ifdef USE_NEW_DYNAREC uint32_t old_fp_control, new_fp_control; #if defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined _M_IX86 @@ -295,6 +293,13 @@ typedef struct { x86seg seg_cs, seg_ds, seg_es, seg_ss, seg_fs, seg_gs; + + union { + uint32_t l; + uint16_t w; + } CR0; + + uint16_t flags, eflags; } cpu_state_t; /*The cpu_state.flags below must match in both cpu_cur_status and block->status for a block diff --git a/src/cpu/cpu_table.c b/src/cpu/cpu_table.c index ae4c3d60c..4d26dcaa2 100644 --- a/src/cpu/cpu_table.c +++ b/src/cpu/cpu_table.c @@ -1611,40 +1611,40 @@ static const cpu_legacy_table_t cpus_Cyrix3[] = { {NULL, 0, 0} }; -static const cpu_legacy_table_t *cputables_8088[] = {cpus_8088}; -static const cpu_legacy_table_t *cputables_pcjr[] = {cpus_pcjr}; -static const cpu_legacy_table_t *cputables_europc[] = {cpus_europc}; -static const cpu_legacy_table_t *cputables_pc1512[] = {cpus_pc1512}; -static const cpu_legacy_table_t *cputables_8086[] = {cpus_8086}; -static const cpu_legacy_table_t *cputables_286[] = {cpus_286}; -static const cpu_legacy_table_t *cputables_ibmat[] = {cpus_ibmat}; -static const cpu_legacy_table_t *cputables_ps1_m2011[] = {cpus_ps1_m2011}; -static const cpu_legacy_table_t *cputables_ps2_m30_286_IBM486SLC[] = {cpus_ps2_m30_286, cpus_IBM486SLC}; -static const cpu_legacy_table_t *cputables_ibmxt286[] = {cpus_ibmxt286}; -static const cpu_legacy_table_t *cputables_i386SX_Am386SX_486SLC[] = {cpus_i386SX, cpus_Am386SX, cpus_486SLC}; -static const cpu_legacy_table_t *cputables_ALiM6117[] = {cpus_ALiM6117}; -static const cpu_legacy_table_t *cputables_i386SX_Am386SX_486SLC_IBM486SLC[] = {cpus_i386SX, cpus_Am386SX, cpus_486SLC, cpus_IBM486SLC}; -static const cpu_legacy_table_t *cputables_i386DX_Am386DX_486DLC[] = {cpus_i386DX, cpus_Am386DX, cpus_486DLC}; -static const cpu_legacy_table_t *cputables_i386DX_Am386DX_486DLC_IBM486BL[] = {cpus_i386DX, cpus_Am386DX, cpus_486DLC, cpus_IBM486BL}; -static const cpu_legacy_table_t *cputables_i486_Am486_Cx486[] = {cpus_i486, cpus_Am486, cpus_Cx486}; -static const cpu_legacy_table_t *cputables_i486S1_Am486S1_Cx486S1[] = {cpus_i486S1, cpus_Am486S1, cpus_Cx486S1}; -static const cpu_legacy_table_t *cputables_IBM486SLC[] = {cpus_IBM486SLC}; -static const cpu_legacy_table_t *cputables_i486_PC330[] = {cpus_i486_PC330}; -static const cpu_legacy_table_t *cputables_STPCDX[] = {cpus_STPCDX}; -static const cpu_legacy_table_t *cputables_STPCDX2[] = {cpus_STPCDX2}; -static const cpu_legacy_table_t *cputables_Pentium5V[] = {cpus_Pentium5V}; -static const cpu_legacy_table_t *cputables_PentiumS5_WinChip_K5[] = {cpus_PentiumS5, cpus_WinChip, cpus_K5}; -static const cpu_legacy_table_t *cputables_Pentium3V_WinChip_K5_6x863V[] = {cpus_Pentium3V, cpus_WinChip, cpus_K5, cpus_6x863V}; -static const cpu_legacy_table_t *cputables_Pentium3V_K5[] = {cpus_Pentium3V, cpus_K5}; -static const cpu_legacy_table_t *cputables_Pentium_WinChip_K56_6x86[] = {cpus_Pentium, cpus_WinChip, cpus_K56, cpus_6x86}; -static const cpu_legacy_table_t *cputables_Pentium_WinChip_SS7_K56_SS7_6x86SS7[] = {cpus_Pentium, cpus_WinChip_SS7, cpus_K56_SS7, cpus_6x86SS7}; -static const cpu_legacy_table_t *cputables_PentiumPro[] = {cpus_PentiumPro}; -static const cpu_legacy_table_t *cputables_PentiumII66[] = {cpus_PentiumII66}; -static const cpu_legacy_table_t *cputables_PentiumII_Celeron_Cyrix3[] = {cpus_PentiumII, cpus_Celeron, cpus_Cyrix3}; -static const cpu_legacy_table_t *cputables_Xeon[] = {cpus_Xeon}; -static const cpu_legacy_table_t *cputables_Celeron_Cyrix3[] = {cpus_Celeron, cpus_Cyrix3}; -static const cpu_legacy_table_t *cputables_Celeron[] = {cpus_Celeron}; -static const cpu_legacy_table_t *cputables_PentiumIID_Celeron[] = {cpus_PentiumIID, cpus_Celeron}; +static const cpu_legacy_table_t *cputables_8088[4] = {cpus_8088}; +static const cpu_legacy_table_t *cputables_pcjr[4] = {cpus_pcjr}; +static const cpu_legacy_table_t *cputables_europc[4] = {cpus_europc}; +static const cpu_legacy_table_t *cputables_pc1512[4] = {cpus_pc1512}; +static const cpu_legacy_table_t *cputables_8086[4] = {cpus_8086}; +static const cpu_legacy_table_t *cputables_286[4] = {cpus_286}; +static const cpu_legacy_table_t *cputables_ibmat[4] = {cpus_ibmat}; +static const cpu_legacy_table_t *cputables_ps1_m2011[4] = {cpus_ps1_m2011}; +static const cpu_legacy_table_t *cputables_ps2_m30_286_IBM486SLC[4] = {cpus_ps2_m30_286, cpus_IBM486SLC}; +static const cpu_legacy_table_t *cputables_ibmxt286[4] = {cpus_ibmxt286}; +static const cpu_legacy_table_t *cputables_i386SX_Am386SX_486SLC[4] = {cpus_i386SX, cpus_Am386SX, cpus_486SLC}; +static const cpu_legacy_table_t *cputables_ALiM6117[4] = {cpus_ALiM6117}; +static const cpu_legacy_table_t *cputables_i386SX_Am386SX_486SLC_IBM486SLC[4] = {cpus_i386SX, cpus_Am386SX, cpus_486SLC, cpus_IBM486SLC}; +static const cpu_legacy_table_t *cputables_i386DX_Am386DX_486DLC[4] = {cpus_i386DX, cpus_Am386DX, cpus_486DLC}; +static const cpu_legacy_table_t *cputables_i386DX_Am386DX_486DLC_IBM486BL[4] = {cpus_i386DX, cpus_Am386DX, cpus_486DLC, cpus_IBM486BL}; +static const cpu_legacy_table_t *cputables_i486_Am486_Cx486[4] = {cpus_i486, cpus_Am486, cpus_Cx486}; +static const cpu_legacy_table_t *cputables_i486S1_Am486S1_Cx486S1[4] = {cpus_i486S1, cpus_Am486S1, cpus_Cx486S1}; +static const cpu_legacy_table_t *cputables_IBM486SLC[4] = {cpus_IBM486SLC}; +static const cpu_legacy_table_t *cputables_i486_PC330[4] = {cpus_i486_PC330}; +static const cpu_legacy_table_t *cputables_STPCDX[4] = {cpus_STPCDX}; +static const cpu_legacy_table_t *cputables_STPCDX2[4] = {cpus_STPCDX2}; +static const cpu_legacy_table_t *cputables_Pentium5V[4] = {cpus_Pentium5V}; +static const cpu_legacy_table_t *cputables_PentiumS5_WinChip_K5[4] = {cpus_PentiumS5, cpus_WinChip, cpus_K5}; +static const cpu_legacy_table_t *cputables_Pentium3V_WinChip_K5_6x863V[4] = {cpus_Pentium3V, cpus_WinChip, cpus_K5, cpus_6x863V}; +static const cpu_legacy_table_t *cputables_Pentium3V_K5[4] = {cpus_Pentium3V, cpus_K5}; +static const cpu_legacy_table_t *cputables_Pentium_WinChip_K56_6x86[4] = {cpus_Pentium, cpus_WinChip, cpus_K56, cpus_6x86}; +static const cpu_legacy_table_t *cputables_Pentium_WinChip_SS7_K56_SS7_6x86SS7[4] = {cpus_Pentium, cpus_WinChip_SS7, cpus_K56_SS7, cpus_6x86SS7}; +static const cpu_legacy_table_t *cputables_PentiumPro[4] = {cpus_PentiumPro}; +static const cpu_legacy_table_t *cputables_PentiumII66[4] = {cpus_PentiumII66}; +static const cpu_legacy_table_t *cputables_PentiumII_Celeron_Cyrix3[4] = {cpus_PentiumII, cpus_Celeron, cpus_Cyrix3}; +static const cpu_legacy_table_t *cputables_Xeon[4] = {cpus_Xeon}; +static const cpu_legacy_table_t *cputables_Celeron_Cyrix3[4] = {cpus_Celeron, cpus_Cyrix3}; +static const cpu_legacy_table_t *cputables_Celeron[4] = {cpus_Celeron}; +static const cpu_legacy_table_t *cputables_PentiumIID_Celeron[4] = {cpus_PentiumIID, cpus_Celeron}; const cpu_legacy_machine_t cpu_legacy_table[] = { {"ibmpc", cputables_8088}, diff --git a/src/device/clock_ics9xxx.c b/src/device/clock_ics9xxx.c index f68ea95ee..37e534e2f 100644 --- a/src/device/clock_ics9xxx.c +++ b/src/device/clock_ics9xxx.c @@ -25,47 +25,46 @@ #include <86box/device.h> #include <86box/i2c.h> #include "cpu.h" +#include <86box/clock.h> -#define ICS9xxx_DEVICE(model_enum) }, [model_enum] = {.model = model_enum, .name = #model_enum, +#ifdef ENABLE_ICS9xxx_LOG +int ics9xxx_do_log = ENABLE_ICS9xxx_LOG; + + +static void +ics9xxx_log(const char *fmt, ...) +{ + va_list ap; + + if (ics9xxx_do_log) { + va_start(ap, fmt); + pclog_ex(fmt, ap); + va_end(ap); + } +} +#define ICS9xxx_MODEL(model) [model] = {.name = #model, +#else +#define ics9xxx_log(fmt, ...) +#define ICS9xxx_MODEL(model) [model] = { +#endif +#define ICS9xxx_MODEL_END() }, +#define agp_div ram_mult /* temporarily saves space while neither field matters */ -enum { - ICS9xxx_xx, - ICS9150_08, - ICS9248_39, - ICS9248_81, - ICS9248_98, - ICS9248_101, - ICS9250_08, - ICS9250_10, - ICS9250_13, - ICS9250_14, - ICS9250_16, - ICS9250_18, - ICS9250_19, - ICS9250_23, - ICS9250_25, - ICS9250_26, - ICS9250_27, - ICS9250_28, - ICS9250_29, - ICS9250_30, - ICS9250_32, - ICS9250_38, - ICS9250_50, - ICS9xxx_MAX -}; typedef struct { - uint16_t bus; - double ram_mult; - uint8_t pci_div; + uint16_t bus: 15; + uint8_t ram_mult: 2; /* change to full float when this becomes useful */ + uint8_t pci_div: 3; } ics9xxx_frequency_t; typedef struct { +#if defined(ENABLE_ICS9xxx_LOG) || defined(ENABLE_ICS9xxx_DETECT) + const char *name; /* populated by macro */ +#endif uint8_t max_reg: 3; /* largest register index */ - uint8_t regs[8]; /* default registers */ + uint8_t regs[7]; /* default registers */ struct { /* for each hardware frequency select bit [FS0:FS4]: */ uint8_t normal_reg: 3; /* which register (or -1) for non-inverted input (FSn) */ uint8_t normal_bit: 3; /* which bit (0-7) for non-inverted input (FSn) */ @@ -79,26 +78,34 @@ typedef struct { } hw_select; uint8_t frequencies_ref; /* which other model to use the frequency table from (or 0) */ - ics9xxx_frequency_t frequencies[32]; /* frequency table, if not using another model's table */ + ics9xxx_frequency_t *frequencies; /* frequency table, if not using another model's table */ +} ics9xxx_model_t; - /* remaining fields are "don't care" for the table */ - uint8_t model; /* populated by macro */ - const char *name; /* populated by macro */ - ics9xxx_frequency_t *frequencies_ptr; /* populated at runtime */ - int8_t addr_register; - uint8_t relevant_regs; +typedef struct { + uint8_t model_idx; + ics9xxx_model_t *model; + device_t *dyn_device; + + ics9xxx_frequency_t *frequencies_ptr; + uint8_t regs[7]; + int8_t addr_register: 4; + uint8_t relevant_regs: 7; uint8_t bus_match: 5; } ics9xxx_t; -static const ics9xxx_t ics9xxx_devices[] = { - [ICS9xxx_xx] = {0 - ICS9xxx_DEVICE(ICS9150_08) +static const ics9xxx_model_t ics9xxx_models[] = { +#ifdef ENABLE_ICS9xxx_DETECT + ICS9xxx_MODEL(ICS9xxx_xx) + .max_reg = 6 + ICS9xxx_MODEL_END() +#endif + ICS9xxx_MODEL(ICS9150_08) .max_reg = 5, .regs = {0x00, 0xff, 0xff, 0xff, 0x6f, 0xbf}, .fs_regs = {{0, 4, 4, 7}, {0, 5, 4, 4}, {0, 6, 5, 6}, {0, 7, 4, 1}, {-1, -1, -1, -1}}, .hw_select = {0, 3}, - .frequencies = { + .frequencies = (ics9xxx_frequency_t[]) { {.bus = 5000, .pci_div = 2}, {.bus = 7500, .pci_div = 2}, {.bus = 8333, .pci_div = 2}, @@ -107,36 +114,23 @@ static const ics9xxx_t ics9xxx_devices[] = { {.bus = 11200, .pci_div = 3}, {.bus = 13333, .pci_div = 4}, {.bus = 10020, .pci_div = 3}, + {0} } - ICS9xxx_DEVICE(ICS9248_39) + ICS9xxx_MODEL_END() +#if 0 + ICS9xxx_MODEL(ICS9248_39) .max_reg = 5, .regs = {0x00, 0x7f, 0xff, 0xbf, 0xf5, 0xff}, .fs_regs = {{0, 4, 3, 6}, {0, 5, 4, 3}, {0, 6, 1, 7}, {0, 7, 4, 1}, {-1, -1, -1, -1}}, .hw_select = {0, 3}, - .frequencies = { - {.bus = 12400, .pci_div = 3}, - {.bus = 7500, .pci_div = 2}, - {.bus = 8333, .pci_div = 2}, - {.bus = 6680, .pci_div = 2}, - {.bus = 10300, .pci_div = 3}, - {.bus = 11200, .pci_div = 3}, - {.bus = 13300, .pci_div = 3}, - {.bus = 10030, .pci_div = 3}, - {.bus = 12000, .pci_div = 3}, - {.bus = 11500, .pci_div = 3}, - {.bus = 11000, .pci_div = 3}, - {.bus = 10500, .pci_div = 3}, - {.bus = 14000, .pci_div = 4}, - {.bus = 15000, .pci_div = 4}, - {.bus = 12400, .pci_div = 4}, - {.bus = 13300, .pci_div = 4} - } - ICS9xxx_DEVICE(ICS9248_81) + .frequencies_ref = ICS9250_08 + ICS9xxx_MODEL_END() + ICS9xxx_MODEL(ICS9248_81) .max_reg = 5, .regs = {0x82, 0xfe, 0x7f, 0xff, 0xff, 0xb7}, .fs_regs = {{0, 4, 1, 0}, {0, 5, 2, 7}, {0, 6, 5, 6}, {0, 2, 5, 3}, {-1, -1, -1, -1}}, .hw_select = {0, 3}, - .frequencies = { + .frequencies = (ics9xxx_frequency_t[]) { {.bus = 9000, .ram_mult = 1, .pci_div = 3}, {.bus = 6670, .ram_mult = 1.5, .pci_div = 2}, {.bus = 9500, .ram_mult = 2.0/3.0, .pci_div = 3}, @@ -153,13 +147,40 @@ static const ics9xxx_t ics9xxx_devices[] = { {.bus = 11200, .ram_mult = 1, .pci_div = 3}, {.bus = 12400, .ram_mult = 1, .pci_div = 4}, {.bus = 13330, .ram_mult = 1, .pci_div = 4}, + {0} } - ICS9xxx_DEVICE(ICS9248_98) + ICS9xxx_MODEL_END() + ICS9xxx_MODEL(ICS9248_95) + .max_reg = 5, + .regs = {0x82, 0xff, 0xff, 0xff, 0xd5, 0xff}, + .fs_regs = {{0, 4, -1, -1}, {0, 5, 4, 3}, {0, 6, -1, -1}, {0, 2, 4, 1}, {-1, -1, -1, -1}}, + .hw_select = {0, 3}, + .frequencies = (ics9xxx_frequency_t[]) { + {.bus = 6667, .pci_div = 2}, + {.bus = 10000, .pci_div = 3}, + {.bus = 10030, .pci_div = 3}, + {.bus = 13333, .pci_div = 4}, + {.bus = 10500, .pci_div = 3}, + {.bus = 13337, .pci_div = 4}, + {.bus = 13700, .pci_div = 4}, + {.bus = 7500, .pci_div = 2}, + {.bus = 10000, .pci_div = 3}, + {.bus = 9500, .pci_div = 2}, + {.bus = 9700, .pci_div = 3}, + {.bus = 13333, .pci_div = 4}, + {.bus = 9000, .pci_div = 3}, + {.bus = 9622, .pci_div = 3}, + {.bus = 6681, .pci_div = 2}, + {.bus = 9150, .pci_div = 3}, + {0} + } + ICS9xxx_MODEL_END() + ICS9xxx_MODEL(ICS9248_98) .max_reg = 6, .regs = {0x00, 0x7f, 0xff, 0xbf, 0xf5, 0xff, 0x06}, .fs_regs = {{0, 4, 3, 6}, {0, 5, 4, 3}, {0, 6, 1, 7}, {0, 7, 4, 1}, {0, 2, -1, -1}}, .hw_select = {0, 3}, - .frequencies = { + .frequencies = (ics9xxx_frequency_t[]) { {.bus = 8000, .pci_div = 2}, {.bus = 7500, .pci_div = 2}, {.bus = 8331, .pci_div = 2}, @@ -191,13 +212,16 @@ static const ics9xxx_t ics9xxx_devices[] = { {.bus = 14598, .pci_div = 4}, {.bus = 14398, .pci_div = 4}, {.bus = 14199, .pci_div = 4}, - {.bus = 13801, .pci_div = 4} + {.bus = 13801, .pci_div = 4}, + {0} } - ICS9xxx_DEVICE(ICS9248_101) + ICS9xxx_MODEL_END() + ICS9xxx_MODEL(ICS9248_101) .max_reg = 5, .regs = {0x82, 0xff, 0xff, 0xff, 0xf5, 0xff}, .fs_regs = {{0, 4, -1, -1}, {0, 5, 4, 3}, {0, 6, -1, -1}, {0, 2, 4, 1}, {-1, -1, -1, -1}}, - .frequencies = { + .hw_select = {0, 3}, + .frequencies = (ics9xxx_frequency_t[]) { {.bus = 12400, .pci_div = 3}, {.bus = 12000, .pci_div = 3}, {.bus = 11499, .pci_div = 3}, @@ -213,20 +237,320 @@ static const ics9xxx_t ics9xxx_devices[] = { {.bus = 9000, .pci_div = 3}, {.bus = 9622, .pci_div = 3}, {.bus = 6682, .pci_div = 2}, - {.bus = 9150, .pci_div = 3} + {.bus = 9150, .pci_div = 3}, + {0} } - ICS9xxx_DEVICE(ICS9250_08) + ICS9xxx_MODEL_END() + ICS9xxx_MODEL(ICS9248_103) + .max_reg = 5, + .regs = {0x82, 0xff, 0xff, 0xff, 0xf5, 0xff}, + .fs_regs = {{0, 4, -1, -1}, {0, 5, 4, 3}, {0, 6, -1, -1}, {0, 2, 4, 1}, {-1, -1, -1, -1}}, + .hw_select = {0, 3}, + .frequencies_ref = ICS9248_101 + ICS9xxx_MODEL_END() + ICS9xxx_MODEL(ICS9248_107) + .max_reg = 6, + .regs = {0x02, 0xff, 0xff, 0xec, 0xde, 0xff, 0x06}, + .fs_regs = {{0, 4, 4, 5}, {0, 5, 3, 4}, {0, 6, 3, 0}, {0, 7, 3, 1}, {0, 2, 4, 0}}, + .hw_select = {0, 3}, + .frequencies = (ics9xxx_frequency_t[]) { + {.bus = 10300, .pci_div = 3}, + {.bus = 10000, .pci_div = 3}, + {.bus = 10045, .pci_div = 3}, + {.bus = 10090, .pci_div = 3}, + {.bus = 10710, .pci_div = 2}, + {.bus = 10900, .pci_div = 3}, + {.bus = 11200, .pci_div = 3}, + {.bus = 11400, .pci_div = 4}, + {.bus = 11600, .pci_div = 4}, + {.bus = 11800, .pci_div = 4}, + {.bus = 13330, .pci_div = 3}, + {.bus = 12000, .pci_div = 4}, + {.bus = 12200, .pci_div = 4}, + {.bus = 12500, .pci_div = 4}, + {.bus = 5000, .pci_div = 2}, + {.bus = 6670, .pci_div = 4}, + {.bus = 13330, .pci_div = 3}, + {.bus = 13390, .pci_div = 3}, + {.bus = 13800, .pci_div = 4}, + {.bus = 14200, .pci_div = 4}, + {.bus = 14600, .pci_div = 4}, + {.bus = 15000, .pci_div = 4}, + {.bus = 15300, .pci_div = 4}, + {.bus = 15600, .pci_div = 4}, + {.bus = 15910, .pci_div = 3}, + {.bus = 16200, .pci_div = 4}, + {.bus = 16670, .pci_div = 4}, + {.bus = 16800, .pci_div = 4}, + {.bus = 17100, .pci_div = 4}, + {.bus = 17400, .pci_div = 4}, + {.bus = 17700, .pci_div = 4}, + {.bus = 18000, .pci_div = 4}, + {0} + } + ICS9xxx_MODEL_END() + ICS9xxx_MODEL(ICS9248_112) + .max_reg = 6, + .regs = {0x02, 0x1f, 0xff, 0xff, 0xfb, 0xff, 0x06}, + .fs_regs = {{0, 4, 1, 6}, {0, 5, 4, 2}, {0, 6, 1, 5}, {0, 7, 1, 7}, {0, 2, -1, -1}}, + .hw_select = {0, 3}, + .frequencies = (ics9xxx_frequency_t[]) { + {.bus = 6680, .ram_mult = 1.5, .pci_div = 2}, + {.bus = 6800, .ram_mult = 1.5, .pci_div = 2}, + {.bus = 10030, .ram_mult = 1, .pci_div = 3}, + {.bus = 10300, .ram_mult = 1, .pci_div = 3}, + {.bus = 13372, .ram_mult = 0.75, .pci_div = 4}, + {.bus = 14500, .ram_mult = 0.75, .pci_div = 4}, + {.bus = 13372, .ram_mult = 0.75, .pci_div = 4}, + {.bus = 13733, .ram_mult = 0.75, .pci_div = 4}, + {.bus = 14000, .ram_mult = 0.75, .pci_div = 4}, + {.bus = 14000, .ram_mult = 1, .pci_div = 2}, + {.bus = 11800, .ram_mult = 1, .pci_div = 3}, + {.bus = 12400, .ram_mult = 1, .pci_div = 3}, + {.bus = 13369, .ram_mult = 1, .pci_div = 2}, + {.bus = 13700, .ram_mult = 1, .pci_div = 2}, + {.bus = 15000, .ram_mult = 0.75, .pci_div = 4}, + {.bus = 7250, .ram_mult = 1.5, .pci_div = 2}, + {.bus = 7500, .ram_mult = 1.5, .pci_div = 2}, + {.bus = 8300, .ram_mult = 1, .pci_div = 6}, + {.bus = 11000, .ram_mult = 1, .pci_div = 2}, + {.bus = 12000, .ram_mult = 1, .pci_div = 3}, + {.bus = 12500, .ram_mult = 1, .pci_div = 2}, + {.bus = 6925, .ram_mult = 1.5, .pci_div = 1}, + {.bus = 7000, .ram_mult = 1.5, .pci_div = 2}, + {.bus = 7667, .ram_mult = 1.5, .pci_div = 2}, + {.bus = 14500, .ram_mult = 1, .pci_div = 3}, + {.bus = 6650, .ram_mult = 1.5, .pci_div = 2}, + {.bus = 15000, .ram_mult = 1, .pci_div = 3}, + {.bus = 9975, .ram_mult = 1, .pci_div = 3}, + {.bus = 15500, .ram_mult = 1, .pci_div = 2}, + {.bus = 16650, .ram_mult = 1, .pci_div = 3}, + {.bus = 15333, .ram_mult = 0.75, .pci_div = 4}, + {.bus = 13300, .ram_mult = 0.75, .pci_div = 4}, + {0} + } + ICS9xxx_MODEL_END() + ICS9xxx_MODEL(ICS9248_138) + .max_reg = 6, + .regs = {0x02, 0x3f, 0x7f, 0x6f, 0xff, 0xff, 0x06}, + .fs_regs = {{0, 4, 2, 7}, {0, 5, 1, 6}, {0, 6, 1, 7}, {0, 7, 3, 4}, {0, 2, 3, 7}}, + .hw_select = {0, 3}, + .frequencies = (ics9xxx_frequency_t[]) { + {.bus = 6667, .ram_mult = 1.5, .pci_div = 2}, + {.bus = 6687, .ram_mult = 1.5, .pci_div = 2}, + {.bus = 6867, .ram_mult = 1.5, .pci_div = 2}, + {.bus = 7134, .ram_mult = 1.5, .pci_div = 2}, + {.bus = 10000, .ram_mult = 1, .pci_div = 3}, + {.bus = 10030, .ram_mult = 1, .pci_div = 3}, + {.bus = 10300, .ram_mult = 1, .pci_div = 3}, + {.bus = 10700, .ram_mult = 1, .pci_div = 2}, + {.bus = 13333, .ram_mult = 1, .pci_div = 4}, + {.bus = 13372, .ram_mult = 1, .pci_div = 4}, + {.bus = 13733, .ram_mult = 1, .pci_div = 4}, + {.bus = 12000, .ram_mult = 1, .pci_div = 4}, + {.bus = 13333, .ram_mult = 0.75, .pci_div = 4}, + {.bus = 13372, .ram_mult = 0.75, .pci_div = 4}, + {.bus = 13733, .ram_mult = 0.75, .pci_div = 4}, + {.bus = 12000, .ram_mult = 0.75, .pci_div = 4}, + {.bus = 13600, .ram_mult = 1, .pci_div = 4}, + {.bus = 14000, .ram_mult = 1, .pci_div = 4}, + {.bus = 14266, .ram_mult = 1, .pci_div = 3}, + {.bus = 14533, .ram_mult = 1, .pci_div = 4}, + {.bus = 13600, .ram_mult = 0.75, .pci_div = 4}, + {.bus = 14000, .ram_mult = 0.75, .pci_div = 4}, + {.bus = 14266, .ram_mult = 0.75, .pci_div = 3}, + {.bus = 14533, .ram_mult = 0.75, .pci_div = 4}, + {.bus = 14666, .ram_mult = 1, .pci_div = 3}, + {.bus = 15333, .ram_mult = 1, .pci_div = 4}, + {.bus = 16000, .ram_mult = 1, .pci_div = 4}, + {.bus = 16667, .ram_mult = 1, .pci_div = 3}, + {.bus = 14666, .ram_mult = 0.75, .pci_div = 3}, + {.bus = 16000, .ram_mult = 0.75, .pci_div = 4}, + {.bus = 16667, .ram_mult = 0.75, .pci_div = 3}, + {.bus = 20000, .ram_mult = 1, .pci_div = 6}, + {0} + } + ICS9xxx_MODEL_END() + ICS9xxx_MODEL(ICS9248_141) + .max_reg = 6, + .regs = {0x02, 0x6b, 0x7f, 0xff, 0xff, 0xe7, 0x06}, + .fs_regs = {{0, 4, 2, 7}, {0, 5, 5, 3}, {0, 6, 1, 7}, {0, 7, 1, 4}, {0, 2, -1, -1}}, + .hw_select = {0, 3}, + .frequencies = (ics9xxx_frequency_t[]) { + {.bus = 9000, .pci_div = 3}, + {.bus = 9500, .pci_div = 2}, + {.bus = 10100, .pci_div = 2}, + {.bus = 10200, .pci_div = 3}, + {.bus = 10090, .pci_div = 3}, + {.bus = 10300, .pci_div = 3}, + {.bus = 10500, .pci_div = 3}, + {.bus = 10000, .pci_div = 3}, + {.bus = 10700, .pci_div = 2}, + {.bus = 10900, .pci_div = 3}, + {.bus = 11000, .pci_div = 2}, + {.bus = 11100, .pci_div = 3}, + {.bus = 11300, .pci_div = 2}, + {.bus = 11500, .pci_div = 3}, + {.bus = 11700, .pci_div = 3}, + {.bus = 13330, .pci_div = 3}, + {.bus = 12000, .pci_div = 3}, + {.bus = 12500, .pci_div = 4}, + {.bus = 13000, .pci_div = 4}, + {.bus = 13372, .pci_div = 4}, + {.bus = 13500, .pci_div = 4}, + {.bus = 13700, .pci_div = 4}, + {.bus = 13900, .pci_div = 4}, + {.bus = 10000, .pci_div = 3}, + {.bus = 14000, .pci_div = 4}, + {.bus = 14300, .pci_div = 4}, + {.bus = 14500, .pci_div = 4}, + {.bus = 14800, .pci_div = 4}, + {.bus = 15000, .pci_div = 4}, + {.bus = 15500, .pci_div = 4}, + {.bus = 16666, .pci_div = 3}, + {.bus = 13333, .pci_div = 4}, + {0} + } + ICS9xxx_MODEL_END() + ICS9xxx_MODEL(ICS9248_143) + .max_reg = 5, + .regs = {0x82, 0xff, 0xff, 0xff, 0xd5, 0xff}, + .fs_regs = {{0, 4, -1, -1}, {0, 5, 4, 3}, {0, 6, -1, -1}, {0, 2, 4, 1}, {-1, -1, -1, -1}}, + .frequencies = (ics9xxx_frequency_t[]) { + {.bus = 6667, .pci_div = 2}, + {.bus = 10000, .pci_div = 3}, + {.bus = 10030, .pci_div = 3}, + {.bus = 13333, .pci_div = 4}, + {.bus = 10500, .pci_div = 3}, + {.bus = 13337, .pci_div = 4}, + {.bus = 13700, .pci_div = 4}, + {.bus = 7500, .pci_div = 2}, + {.bus = 10000, .pci_div = 3}, + {.bus = 9500, .pci_div = 2}, + {.bus = 9700, .pci_div = 3}, + {.bus = 13333, .pci_div = 4}, + {.bus = 9000, .pci_div = 3}, + {.bus = 9622, .pci_div = 3}, + {.bus = 6681, .pci_div = 2}, + {.bus = 9150, .pci_div = 3}, + {0} + } + ICS9xxx_MODEL_END() + ICS9xxx_MODEL(ICS9248_151) + .max_reg = 6, + .regs = {0x80, 0x4f, 0xff, 0x3f, 0xff, 0xff, 0x06}, + .fs_regs = {{0, 4, -1, -1}, {0, 5, -1, -1}, {0, 6, 3, 7}, {0, 1, 1, 4}, {0, 2, 1, 5}}, + .hw_select = {0, 3}, + .frequencies = (ics9xxx_frequency_t[]) { + {.bus = 20000, .pci_div = 5, .agp_div = 2.5}, + {.bus = 19000, .pci_div = 5, .agp_div = 2.5}, + {.bus = 18000, .pci_div = 5, .agp_div = 2.5}, + {.bus = 17000, .pci_div = 5, .agp_div = 2.5}, + {.bus = 16600, .pci_div = 5, .agp_div = 2.5}, + {.bus = 16000, .pci_div = 5, .agp_div = 2.5}, + {.bus = 15000, .pci_div = 4, .agp_div = 2}, + {.bus = 14500, .pci_div = 4, .agp_div = 2}, + {.bus = 14000, .pci_div = 4, .agp_div = 2}, + {.bus = 13600, .pci_div = 4, .agp_div = 2}, + {.bus = 13000, .pci_div = 4, .agp_div = 2}, + {.bus = 12400, .pci_div = 4, .agp_div = 2}, + {.bus = 6667, .pci_div = 1, .agp_div = 1}, + {.bus = 10000, .pci_div = 3, .agp_div = 1.5}, + {.bus = 11800, .pci_div = 3, .agp_div = 1.5}, + {.bus = 13333, .pci_div = 3, .agp_div = 2}, + {.bus = 6680, .pci_div = 2, .agp_div = 1}, + {.bus = 10020, .pci_div = 3, .agp_div = 1.5}, + {.bus = 11500, .pci_div = 3, .agp_div = 1.5}, + {.bus = 13340, .pci_div = 4, .agp_div = 2}, + {.bus = 6680, .pci_div = 2, .agp_div = 1}, + {.bus = 10020, .pci_div = 3, .agp_div = 1.5}, + {.bus = 11000, .pci_div = 2, .agp_div = 1.5}, + {.bus = 13340, .pci_div = 4, .agp_div = 2}, + {.bus = 10500, .pci_div = 3, .agp_div = 1.5}, + {.bus = 9000, .pci_div = 3, .agp_div = 1.5}, + {.bus = 8500, .pci_div = 3, .agp_div = 1.5}, + {.bus = 7800, .pci_div = 2, .agp_div = 1}, + {.bus = 6667, .pci_div = 1, .agp_div = 1}, + {.bus = 10000, .pci_div = 3, .agp_div = 1.5}, + {.bus = 7500, .pci_div = 2, .agp_div = 1}, + {.bus = 13333, .pci_div = 3, .agp_div = 2}, + {0} + } + ICS9xxx_MODEL_END() + ICS9xxx_MODEL(ICS9248_192) + .max_reg = 6, + .regs = {0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + .fs_regs = {{0, 4, -1, -1}, {0, 5, 4, 3}, {0, 6, -1, -1}, {0, 7, -1, -1}, {0, 2, -1, -1}}, + .hw_select = {0, 3}, + .frequencies = (ics9xxx_frequency_t[]) { + {.bus = 6000, .pci_div = 2}, + {.bus = 6000, .pci_div = 2}, + {.bus = 6000, .pci_div = 2}, + {.bus = 6000, .pci_div = 2}, + {.bus = 6659, .pci_div = 2}, + {.bus = 6659, .pci_div = 2}, + {.bus = 6659, .pci_div = 2}, + {.bus = 6659, .pci_div = 2}, + {.bus = 6731, .pci_div = 2}, + {.bus = 6864, .pci_div = 2}, + {.bus = 6995, .pci_div = 2}, + {.bus = 7259, .pci_div = 2}, + {.bus = 6150, .pci_div = 2}, + {.bus = 6300, .pci_div = 2}, + {.bus = 6400, .pci_div = 2}, + {.bus = 6500, .pci_div = 2}, + {.bus = 6000, .pci_div = 2}, + {.bus = 6659, .pci_div = 2}, + {.bus = 5000, .pci_div = 2}, + {.bus = 4800, .pci_div = 2}, + {.bus = 5880, .pci_div = 2}, + {.bus = 5760, .pci_div = 2}, + {.bus = 5640, .pci_div = 2}, + {.bus = 5400, .pci_div = 2}, + {.bus = 6000, .pci_div = 2}, + {.bus = 6000, .pci_div = 2}, + {.bus = 6000, .pci_div = 2}, + {.bus = 6000, .pci_div = 2}, + {.bus = 6659, .pci_div = 2}, + {.bus = 6659, .pci_div = 2}, + {.bus = 6659, .pci_div = 2}, + {.bus = 6659, .pci_div = 2}, + {0} + } + ICS9xxx_MODEL_END() +#endif + ICS9xxx_MODEL(ICS9250_08) .max_reg = 5, .regs = {0x00, 0xff, 0xff, 0xff, 0x6d, 0xbf}, .fs_regs = {{0, 4, 4, 7}, {0, 5, 4, 4}, {0, 6, 5, 6}, {0, 7, 4, 1}, {-1, -1, -1, -1}}, .hw_select = {0, 3}, - .frequencies_ref = ICS9248_39 - ICS9xxx_DEVICE(ICS9250_10) + .frequencies = (ics9xxx_frequency_t[]) { + {.bus = 12400, .pci_div = 3}, + {.bus = 7500, .pci_div = 2}, + {.bus = 8333, .pci_div = 2}, + {.bus = 6680, .pci_div = 2}, + {.bus = 10300, .pci_div = 3}, + {.bus = 11200, .pci_div = 3}, + {.bus = 13300, .pci_div = 3}, + {.bus = 10030, .pci_div = 3}, + {.bus = 12000, .pci_div = 3}, + {.bus = 11500, .pci_div = 3}, + {.bus = 11000, .pci_div = 3}, + {.bus = 10500, .pci_div = 3}, + {.bus = 14000, .pci_div = 4}, + {.bus = 15000, .pci_div = 4}, + {.bus = 12400, .pci_div = 4}, + {.bus = 13300, .pci_div = 4}, + {0} + } + ICS9xxx_MODEL_END() +#if 0 + ICS9xxx_MODEL(ICS9250_10) .max_reg = 5, .regs = {0x1f, 0xff, 0xfe, 0x00, 0x00, 0x06}, .fs_regs = {{5, 0, -1, -1}, {5, 3, -1, -1}, {5, 4, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}}, .hw_select = {-1, -1}, - .frequencies = { + .frequencies = (ics9xxx_frequency_t[]) { {.bus = 6667, .ram_mult = 1.5, .pci_div = 2}, {.bus = 7067, .ram_mult = 1.5, .pci_div = 2}, {.bus = 7466, .ram_mult = 1.5, .pci_div = 2}, @@ -242,14 +566,16 @@ static const ics9xxx_t ics9xxx_devices[] = { {.bus = 9525, .ram_mult = 1, .pci_div = 3}, {.bus = 10300, .ram_mult = 1, .pci_div = 3}, {.bus = 10900, .ram_mult = 1, .pci_div = 3}, - {.bus = 13300, .ram_mult = 1, .pci_div = 3} + {.bus = 13300, .ram_mult = 1, .pci_div = 3}, + {0} } - ICS9xxx_DEVICE(ICS9250_13) + ICS9xxx_MODEL_END() + ICS9xxx_MODEL(ICS9250_13) .max_reg = 5, .regs = {0x82, 0xcf, 0x7f, 0xff, 0xff, 0xf7}, .fs_regs = {{0, 4, 1, 4}, {0, 5, 5, 7}, {0, 6, 1, 5}, {0, 2, 2, 7}, {-1, -1, -1, -1}}, .hw_select = {0, 3}, - .frequencies = { + .frequencies = (ics9xxx_frequency_t[]) { {.bus = 9000, .ram_mult = 1, .pci_div = 2}, {.bus = 8901, .ram_mult = 1, .pci_div = 2}, {.bus = 8800, .ram_mult = 1, .pci_div = 2}, @@ -265,14 +591,16 @@ static const ics9xxx_t ics9xxx_devices[] = { {.bus = 7800, .ram_mult = 1, .pci_div = 2}, {.bus = 7500, .ram_mult = 1, .pci_div = 2}, {.bus = 7199, .ram_mult = 1, .pci_div = 2}, - {.bus = 6682, .ram_mult = 1, .pci_div = 2} + {.bus = 6682, .ram_mult = 1, .pci_div = 2}, + {0} } - ICS9xxx_DEVICE(ICS9250_14) + ICS9xxx_MODEL_END() + ICS9xxx_MODEL(ICS9250_14) .max_reg = 5, .regs = {0x02, 0x1f, 0xff, 0xff, 0xeb, 0xff}, .fs_regs = {{0, 4, 1, 6}, {0, 5, 4, 2}, {0, 6, 1, 5}, {0, 7, 1, 7}, {0, 2, 4, 4}}, .hw_select = {0, 3}, - .frequencies = { + .frequencies = (ics9xxx_frequency_t[]) { {.bus = 6781, .ram_mult = 1.5, .pci_div = 2}, {.bus = 7000, .ram_mult = 1.5, .pci_div = 2}, {.bus = 7201, .ram_mult = 1.5, .pci_div = 2}, @@ -304,14 +632,16 @@ static const ics9xxx_t ics9xxx_devices[] = { {.bus = 12375, .ram_mult = 1, .pci_div = 3}, {.bus = 13274, .ram_mult = 1, .pci_div = 3}, {.bus = 13975, .ram_mult = 1, .pci_div = 3}, - {.bus = 14969, .ram_mult = 1, .pci_div = 3} + {.bus = 14969, .ram_mult = 1, .pci_div = 3}, + {0} } - ICS9xxx_DEVICE(ICS9250_16) + ICS9xxx_MODEL_END() + ICS9xxx_MODEL(ICS9250_16) .max_reg = 5, .regs = {0x1f, 0xff, 0xff, 0x00, 0x00, 0x06}, .fs_regs = {{5, 0, -1, -1}, {5, 3, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}}, .hw_select = {-1, -1}, - .frequencies = { + .frequencies = (ics9xxx_frequency_t[]) { {.bus = 6667, .ram_mult = 1.5, .pci_div = 2}, {.bus = 7000, .ram_mult = 1.5, .pci_div = 2}, {.bus = 7267, .ram_mult = 1.5, .pci_div = 2}, @@ -327,14 +657,17 @@ static const ics9xxx_t ics9xxx_devices[] = { {.bus = 13334, .ram_mult = 0.75, .pci_div = 4}, {.bus = 15000, .ram_mult = 1, .pci_div = 4}, {.bus = 14000, .ram_mult = 1, .pci_div = 4}, - {.bus = 13299, .ram_mult = 1, .pci_div = 4} + {.bus = 13299, .ram_mult = 1, .pci_div = 4}, + {0} } - ICS9xxx_DEVICE(ICS9250_18) + ICS9xxx_MODEL_END() +#endif + ICS9xxx_MODEL(ICS9250_18) .max_reg = 5, .regs = {0x02, 0xff, 0xff, 0xff, 0x6d, 0xbf}, .fs_regs = {{0, 4, 4, 7}, {0, 5, 4, 4}, {0, 6, 5, 6}, {0, 7, 4, 1}, {-1, -1, -1, -1}}, .hw_select = {0, 3}, - .frequencies = { + .frequencies = (ics9xxx_frequency_t[]) { {.bus = 8000, .pci_div = 2}, {.bus = 7500, .pci_div = 2}, {.bus = 8331, .pci_div = 2}, @@ -366,20 +699,24 @@ static const ics9xxx_t ics9xxx_devices[] = { {.bus = 14598, .pci_div = 4}, {.bus = 14398, .pci_div = 4}, {.bus = 14199, .pci_div = 4}, - {.bus = 13801, .pci_div = 4} + {.bus = 13801, .pci_div = 4}, + {0} } - ICS9xxx_DEVICE(ICS9250_19) + ICS9xxx_MODEL_END() +#if 0 + ICS9xxx_MODEL(ICS9250_19) .max_reg = 5, .regs = {0x02, 0xff, 0xff, 0xff, 0x6d, 0xbf}, .fs_regs = {{0, 4, 4, 7}, {0, 5, 4, 4}, {0, 6, 5, 6}, {0, 7, 4, 1}, {-1, -1, -1, -1}}, .hw_select = {0, 3}, .frequencies_ref = ICS9250_08 - ICS9xxx_DEVICE(ICS9250_23) + ICS9xxx_MODEL_END() + ICS9xxx_MODEL(ICS9250_23) .max_reg = 5, .regs = {0x02, 0x1f, 0xff, 0xff, 0xeb, 0xff}, .fs_regs = {{0, 4, 1, 6}, {0, 5, 4, 2}, {0, 6, 1, 5}, {0, 7, 1, 7}, {0, 2, 4, 4}}, .hw_select = {0, 3}, - .frequencies = { + .frequencies = (ics9xxx_frequency_t[]) { {.bus = 6900, .ram_mult = 1.5, .pci_div = 2}, {.bus = 7000, .ram_mult = 1.5, .pci_div = 2}, {.bus = 7100, .ram_mult = 1.5, .pci_div = 2}, @@ -411,14 +748,16 @@ static const ics9xxx_t ics9xxx_devices[] = { {.bus = 14667, .ram_mult = 0.75, .pci_div = 4}, {.bus = 14933, .ram_mult = 0.75, .pci_div = 4}, {.bus = 15330, .ram_mult = 0.75, .pci_div = 4}, - {.bus = 16667, .ram_mult = 0.75, .pci_div = 4} + {.bus = 16667, .ram_mult = 0.75, .pci_div = 4}, + {0} } - ICS9xxx_DEVICE(ICS9250_25) + ICS9xxx_MODEL_END() + ICS9xxx_MODEL(ICS9250_25) .max_reg = 6, .regs = {0x02, 0x1f, 0xff, 0xff, 0xeb, 0xff, 0x06}, .fs_regs = {{0, 4, 1, 6}, {0, 5, 4, 2}, {0, 6, 1, 5}, {0, 7, 1, 7}, {0, 2, 4, 4}}, .hw_select = {0, 3}, - .frequencies = { + .frequencies = (ics9xxx_frequency_t[]) { {.bus = 5500, .ram_mult = 1.5, .pci_div = 2}, {.bus = 6000, .ram_mult = 1.5, .pci_div = 2}, {.bus = 6680, .ram_mult = 1.5, .pci_div = 2}, @@ -450,20 +789,23 @@ static const ics9xxx_t ics9xxx_devices[] = { {.bus = 14000, .ram_mult = 0.75, .pci_div = 4}, {.bus = 14500, .ram_mult = 0.75, .pci_div = 4}, {.bus = 15000, .ram_mult = 0.75, .pci_div = 4}, - {.bus = 15333, .ram_mult = 0.75, .pci_div = 4} + {.bus = 15333, .ram_mult = 0.75, .pci_div = 4}, + {0} } - ICS9xxx_DEVICE(ICS9250_26) + ICS9xxx_MODEL_END() + ICS9xxx_MODEL(ICS9250_26) .max_reg = 5, .regs = {0x1e, 0xff, 0xff, 0x00, 0x00, 0x06}, .fs_regs = {{5, 0, -1, -1}, {5, 3, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}}, .hw_select = {-1, -1}, .frequencies_ref = ICS9250_16 - ICS9xxx_DEVICE(ICS9250_27) + ICS9xxx_MODEL_END() + ICS9xxx_MODEL(ICS9250_27) .max_reg = 5, .regs = {0x0f, 0xff, 0xfe, 0x00, 0x00, 0x00}, .fs_regs = {{-1, -1, -1, -1}, {-1, -1, -1, -1}, {3, 0, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}}, .hw_select = {-1, -1}, - .frequencies = { + .frequencies = (ics9xxx_frequency_t[]) { {.bus = 6666, .ram_mult = 1.5, .pci_div = 2}, {.bus = 13332, .ram_mult = 1, .pci_div = 4}, {.bus = 10000, .ram_mult = 1, .pci_div = 3}, @@ -471,26 +813,30 @@ static const ics9xxx_t ics9xxx_devices[] = { {.bus = 6666, .ram_mult = 1.5, .pci_div = 2}, {.bus = 13332, .ram_mult = 1, .pci_div = 4}, {.bus = 10000, .ram_mult = 1, .pci_div = 3}, - {.bus = 13332, .ram_mult = 1, .pci_div = 4} + {.bus = 13332, .ram_mult = 1, .pci_div = 4}, + {0} } - ICS9xxx_DEVICE(ICS9250_28) + ICS9xxx_MODEL_END() + ICS9xxx_MODEL(ICS9250_28) .max_reg = 4, .regs = {0x1e, 0xff, 0xfe, 0x00, 0x00}, .fs_regs = {{-1, -1, -1, -1}, {-1, -1, -1, -1}, {3, 0, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}}, .hw_select = {-1, -1}, .frequencies_ref = ICS9250_27 - ICS9xxx_DEVICE(ICS9250_29) + ICS9xxx_MODEL_END() + ICS9xxx_MODEL(ICS9250_29) .max_reg = 5, .regs = {0x16, 0xff, 0xfe, 0x00, 0x00, 0x00}, .fs_regs = {{-1, -1, -1, -1}, {-1, -1, -1, -1}, {3, 0, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}}, .hw_select = {-1, -1}, .frequencies_ref = ICS9250_27 - ICS9xxx_DEVICE(ICS9250_30) + ICS9xxx_MODEL_END() + ICS9xxx_MODEL(ICS9250_30) .max_reg = 6, .regs = {0x02, 0x0f, 0xff, 0xff, 0xeb, 0xff, 0x06}, .fs_regs = {{0, 4, 1, 6}, {0, 5, 4, 2}, {0, 6, 1, 5}, {0, 7, 1, 7}, {0, 2, 4, 4}}, .hw_select = {0, 3}, - .frequencies = { + .frequencies = (ics9xxx_frequency_t[]) { {.bus = 6667, .ram_mult = 1.5, .pci_div = 2}, {.bus = 6000, .ram_mult = 1.5, .pci_div = 2}, {.bus = 6680, .ram_mult = 1.5, .pci_div = 2}, @@ -522,18 +868,21 @@ static const ics9xxx_t ics9xxx_devices[] = { {.bus = 14000, .ram_mult = 0.75, .pci_div = 4}, {.bus = 14500, .ram_mult = 0.75, .pci_div = 4}, {.bus = 15000, .ram_mult = 0.75, .pci_div = 4}, - {.bus = 16000, .ram_mult = 0.75, .pci_div = 4} + {.bus = 16000, .ram_mult = 0.75, .pci_div = 4}, + {0} } - ICS9xxx_DEVICE(ICS9250_32) + ICS9xxx_MODEL_END() + ICS9xxx_MODEL(ICS9250_32) .max_reg = 4, .regs = {0x07, 0xff, 0xff, 0x00, 0x00}, .fs_regs = {{-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}} - ICS9xxx_DEVICE(ICS9250_38) + ICS9xxx_MODEL_END() + ICS9xxx_MODEL(ICS9250_38) .max_reg = 6, .regs = {0x18, 0x07, 0xfe, 0xc7, 0xfc, 0x00, 0x80}, .fs_regs = {{0, 0, -1, -1}, {0, 1, -1, -1}, {0, 2, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}}, .normal_bits_fixed = 1, - .frequencies = { + .frequencies = (ics9xxx_frequency_t[]) { {.bus = 6666, .ram_mult = 1, .pci_div = 1}, {.bus = 10000, .ram_mult = 2.0/3.0, .pci_div = 3}, {.bus = 20000, .ram_mult = 1.0/3.0, .pci_div = 6}, @@ -541,47 +890,32 @@ static const ics9xxx_t ics9xxx_devices[] = { {.bus = 6666, .ram_mult = 1, .pci_div = 1}, {.bus = 10000, .ram_mult = 2.0/3.0, .pci_div = 3}, {.bus = 20000, .ram_mult = 1.0/3.0, .pci_div = 6}, - {.bus = 13333, .ram_mult = 0.5, .pci_div = 2} + {.bus = 13333, .ram_mult = 0.5, .pci_div = 2}, + {0} } - ICS9xxx_DEVICE(ICS9250_50) + ICS9xxx_MODEL_END() + ICS9xxx_MODEL(ICS9250_50) .max_reg = 6, .regs = {0x02, 0x6f, 0xff, 0xff, 0xef, 0xff, 0x06}, .fs_regs = {{-1, -1, 1, 6}, {-1, -1, 4, 2}, {-1, -1, 1, 5}, {0, 7, 1, 7}, {0, 2, 4, 4}}, .hw_select = {0, 3}, - .frequencies = { - [0] = {.bus = 6667, .ram_mult = 1.5, .pci_div = 2}, - [8] = {.bus = 10000, .ram_mult = 1, .pci_div = 3}, - [16] = {.bus = 13333, .ram_mult = 1, .pci_div = 4}, - [24] = {.bus = 13333, .ram_mult = 0.75, .pci_div = 4} + .frequencies = (ics9xxx_frequency_t[]) { + [0 ... 7] = {.bus = 6667, .ram_mult = 1.5, .pci_div = 2}, + [8 ... 15] = {.bus = 10000, .ram_mult = 1, .pci_div = 3}, + [16 ... 23] = {.bus = 13333, .ram_mult = 1, .pci_div = 4}, + [24 ... 31] = {.bus = 13333, .ram_mult = 0.75, .pci_div = 4}, + {0} } - } + ICS9xxx_MODEL_END() +#endif }; -#ifdef ENABLE_ICS9xxx_LOG -int ics9xxx_do_log = ENABLE_ICS9xxx_LOG; - - -static void -ics9xxx_log(const char *fmt, ...) -{ - va_list ap; - - if (ics9xxx_do_log) { - va_start(ap, fmt); - pclog_ex(fmt, ap); - va_end(ap); - } -} -#else -#define ics9xxx_log(fmt, ...) -#endif - - +/* Don't enable the detection device here. Enable it further up near logging. */ #ifdef ENABLE_ICS9xxx_DETECT static uint16_t detect_bus = 0; static uint8_t detect_reg = 0; -static uint8_t discarded[sizeof(ics9xxx_devices) / sizeof(ics9xxx_devices[0])] = {0}; +static uint8_t discarded[ICS9xxx_MAX] = {0}; static void @@ -590,7 +924,7 @@ ics9xxx_detect_reset(void *priv) pclog("Please enter the frequency set in the BIOS (7500 for 75.00 MHz)\nAnswer 0 if unsure or set to auto, I'll ask again next reset.\n"); scanf("%hu", &detect_bus); if ((detect_bus > 0) && (detect_bus < 1000)) - detect_bus *= 100; + detect_bus *= 100; pclog("Frequency interpreted as %d\n", detect_bus); } @@ -599,58 +933,57 @@ static void ics9xxx_detect(ics9xxx_t *dev) { if (!detect_bus) { - pclog("Frequency not entered on this reset, ignoring change.\n"); - return; + pclog("Frequency not entered on this reset, ignoring change.\n"); + return; } if ((detect_reg == 0) && (dev->regs[detect_reg] >= 0xfe)) { - pclog("Register %d set to %02X, probably not it, trying %d instead\n", detect_reg, dev->regs[detect_reg], 3); - detect_reg = 3; - dev->relevant_regs = 1 << detect_reg; - return; + pclog("Register %d set to %02X, probably not it, trying %d instead\n", detect_reg, dev->regs[detect_reg], 3); + detect_reg = 3; + dev->relevant_regs = 1 << detect_reg; + return; } if (!(dev->regs[detect_reg] & 0x40)) pclog("Bit 3 of register %d is clear, probably in hardware select mode!\n", detect_reg); - uint8_t matches = 0, val, bitmask; + uint8_t i = 0, matches = 0, val, bitmask; ics9xxx_frequency_t *frequencies_ptr; uint32_t delta; for (uint8_t j = 0; j < ICS9xxx_MAX; j++) { - if (discarded[j]) - continue; - discarded[j] = 1; + if (discarded[j]) + continue; + discarded[j] = 1; - frequencies_ptr = (ics9xxx_frequency_t *) ics9xxx_devices[ics9xxx_devices[j].frequencies_ref ? ics9xxx_devices[j].frequencies_ref : j].frequencies; + frequencies_ptr = (ics9xxx_frequency_t *) ics9xxx_models[ics9xxx_models[j].frequencies_ref ? ics9xxx_models[j].frequencies_ref : j].frequencies; if (!frequencies_ptr) continue; - for (uint8_t i = 0; i < (sizeof(ics9xxx_devices[j].frequencies) / sizeof(ics9xxx_devices[j].frequencies[0])); i++) { - if (!frequencies_ptr[i].bus) - continue; - + while (frequencies_ptr[i].bus) { delta = ABS((int32_t) (detect_bus - frequencies_ptr[i].bus)); if (delta <= 100) { val = bitmask = 0; - for (uint8_t k = 0; k < sizeof(ics9xxx_devices[j].fs_regs) / sizeof(ics9xxx_devices[j].fs_regs[0]); k++) { - if (ics9xxx_devices[j].fs_regs[k].normal_reg == detect_reg) { + for (uint8_t k = 0; k < sizeof(ics9xxx_models[j].fs_regs) / sizeof(ics9xxx_models[j].fs_regs[0]); k++) { + if (ics9xxx_models[j].fs_regs[k].normal_reg == detect_reg) { bitmask |= 1 << k; - val |= (1 << k) * !!(dev->regs[detect_reg] & (1 << ics9xxx_devices[j].fs_regs[k].normal_bit)); + val |= (1 << k) * !!(dev->regs[detect_reg] & (1 << ics9xxx_models[j].fs_regs[k].normal_bit)); } } if (bitmask && (val == (i & bitmask))) { matches++; discarded[j] = 0; - pclog("> Potential match for %s (frequency %d index %d)\n", ics9xxx_devices[j].name, frequencies_ptr[i].bus, val); + pclog("> Potential match for %s (frequency %d index %d)\n", ics9xxx_models[j].name, frequencies_ptr[i].bus, val); } } + + i++; } } pclog("Found a total of %d matches for register %d value %02X and bus frequency %d\n", matches, detect_reg, dev->regs[detect_reg], detect_bus); if (matches == 0) { - pclog("Resetting list of discarded models since there were no matches.\n"); - memset(discarded, 0, sizeof(discarded)); + pclog("Resetting list of discarded models since there were no matches.\n"); + memset(discarded, 0, sizeof(discarded)); } } #endif @@ -677,15 +1010,25 @@ ics9xxx_read(void *bus, uint8_t addr, void *priv) if (dev->addr_register < 0) { dev->addr_register = -1; - ret = dev->max_reg + 1; - } else if ((dev->model == ICS9250_50) && (dev->addr_register == 0)) + ret = dev->model->max_reg + 1; + } +#if 0 + else if ((dev->model_idx == ICS9250_50) && (dev->addr_register == 0)) ret = dev->regs[dev->addr_register] & 0x0b; /* -50 reads back revision ID instead */ +#endif else ret = dev->regs[dev->addr_register]; - ics9xxx_log("ICS9xxx: read(%02X) = %02X\n", dev->addr_register, ret); - if (++dev->addr_register > dev->max_reg) +#ifdef ENABLE_ICS9xxx_LOG + if (dev->addr_register < 0) + ics9xxx_log("ICS9xxx: read(%s) = %02X\n", (dev->addr_register == -1) ? "blocklen" : "command", ret); + else + ics9xxx_log("ICS9xxx: read(%x) = %02X\n", dev->addr_register, ret); +#endif + if (dev->addr_register >= dev->model->max_reg) dev->addr_register = 0; /* roll-over */ + else + dev->addr_register++; return ret; } @@ -695,21 +1038,21 @@ static void ics9xxx_set(ics9xxx_t *dev, uint8_t val) { /* Get the active mode, which determines what to add to the static frequency bits we were passed. */ - uint8_t hw_select = (dev->hw_select.normal_reg < 7) && !(dev->regs[dev->hw_select.normal_reg] & (1 << dev->hw_select.normal_bit)); + uint8_t hw_select = (dev->model->hw_select.normal_reg < 7) && !(dev->regs[dev->model->hw_select.normal_reg] & (1 << dev->model->hw_select.normal_bit)); if (hw_select) { /* Hardware select mode: add strapped frequency bits. */ val |= dev->bus_match; } else { /* Programmable mode: add register-defined frequency bits. */ - for (uint8_t i = 0; i < sizeof(dev->fs_regs) / sizeof(dev->fs_regs[0]); i++) { - if ((dev->fs_regs[i].normal_reg < 7) && (dev->regs[dev->fs_regs[i].normal_reg] & (1 << dev->fs_regs[i].normal_bit))) + for (uint8_t i = 0; i < sizeof(dev->model->fs_regs) / sizeof(dev->model->fs_regs[0]); i++) { + if ((dev->model->fs_regs[i].normal_reg < 7) && (dev->regs[dev->model->fs_regs[i].normal_reg] & (1 << dev->model->fs_regs[i].normal_bit))) val |= 1 << i; } } #ifdef ENABLE_ICS9xxx_LOG - uint16_t bus = ics9xxx_devices[dev->model].frequencies[val].bus; - ics9xxx_log("ICS9xxx: set(%d) = hw=%d bus=%d ram=%d pci=%d\n", val, hw_select, bus, bus * ics9xxx_devices[dev->model].frequencies[val].ram_mult, bus / ics9xxx_devices[dev->model].frequencies[val].pci_div); + uint16_t bus = dev->frequencies_ptr[val].bus; + ics9xxx_log("ICS9xxx: set(%d) = hw=%d bus=%d ram=%d pci=%d\n", val, hw_select, bus, bus * dev->frequencies_ptr[val].ram_mult, bus / dev->frequencies_ptr[val].pci_div); #endif } @@ -719,7 +1062,12 @@ ics9xxx_write(void *bus, uint8_t addr, uint8_t data, void *priv) { ics9xxx_t *dev = (ics9xxx_t *) priv; - ics9xxx_log("ICS9xxx: write(%02X, %02X)\n", dev->addr_register, data); +#ifdef ENABLE_ICS9xxx_LOG + if (dev->addr_register < 0) + ics9xxx_log("ICS9xxx: write(%s, %02X)\n", (dev->addr_register == -1) ? "blocklen" : "command", data); + else + ics9xxx_log("ICS9xxx: write(%x, %02X)\n", dev->addr_register, data); +#endif if (dev->addr_register >= 0) { /* Preserve fixed bits. */ @@ -727,51 +1075,53 @@ ics9xxx_write(void *bus, uint8_t addr, uint8_t data, void *priv) if (dev->model != ICS9xxx_xx) #endif { - for (uint8_t i = 0; i < sizeof(dev->fs_regs) / sizeof(dev->fs_regs[0]); i++) { - if (dev->normal_bits_fixed && (dev->fs_regs[i].normal_reg == dev->addr_register)) - data = (dev->regs[dev->addr_register] & (1 << dev->fs_regs[i].normal_bit)) | (data & ~(1 << dev->fs_regs[i].normal_bit)); - if (dev->fs_regs[i].inv_reg == dev->addr_register) - data = (dev->regs[dev->addr_register] & (1 << dev->fs_regs[i].inv_bit)) | (data & ~(1 << dev->fs_regs[i].inv_bit)); + for (uint8_t i = 0; i < sizeof(dev->model->fs_regs) / sizeof(dev->model->fs_regs[0]); i++) { + if (dev->model->normal_bits_fixed && (dev->model->fs_regs[i].normal_reg == dev->addr_register)) + data = (dev->regs[dev->addr_register] & (1 << dev->model->fs_regs[i].normal_bit)) | (data & ~(1 << dev->model->fs_regs[i].normal_bit)); + if (dev->model->fs_regs[i].inv_reg == dev->addr_register) + data = (dev->regs[dev->addr_register] & (1 << dev->model->fs_regs[i].inv_bit)) | (data & ~(1 << dev->model->fs_regs[i].inv_bit)); } } +#if 0 switch (dev->addr_register) { case 0: - if (dev->model == ICS9250_38) + if (dev->model_idx == ICS9250_38) data = (dev->regs[dev->addr_register] & ~0xe8) | (data & 0xe8); break; case 1: - if (dev->model == ICS9250_38) + if (dev->model_idx == ICS9250_38) data = (dev->regs[dev->addr_register] & ~0xfe) | (data & 0xfe); break; case 3: - if (dev->model == ICS9250_32) + if (dev->model_idx == ICS9250_32) data ^= 0x70; break; case 4: - if (dev->model == ICS9250_38) + if (dev->model_idx == ICS9250_38) data = (dev->regs[dev->addr_register] & ~0xfc) | (data & 0xfc); break; case 6: - if (dev->model == ICS9250_38) /* read-only */ + if (dev->model_idx == ICS9250_38) /* read-only */ data = dev->regs[dev->addr_register]; break; } +#endif dev->regs[dev->addr_register] = data; /* Update frequency if a relevant register was written to. */ if (dev->relevant_regs & (1 << dev->addr_register)) { - switch (dev->model) { + switch (dev->model_idx) { #ifdef ENABLE_ICS9xxx_DETECT case ICS9xxx_xx: ics9xxx_detect(dev); break; #endif - +#if 0 case ICS9250_10: ics9xxx_set(dev, (cpu_busspeed >= 100000000) * 0x08); break; @@ -786,7 +1136,7 @@ ics9xxx_write(void *bus, uint8_t addr, uint8_t data, void *priv) case ICS9250_29: ics9xxx_set(dev, ((cpu_busspeed == 100000000) * 0x02) | ((cpu_busspeed > 100000000) * 0x01)); break; - +#endif default: ics9xxx_set(dev, 0x00); break; @@ -794,8 +1144,10 @@ ics9xxx_write(void *bus, uint8_t addr, uint8_t data, void *priv) } } - if (++dev->addr_register > dev->max_reg) + if (dev->addr_register >= dev->model->max_reg) dev->addr_register = 0; /* roll-over */ + else + dev->addr_register++; return 1; } @@ -806,21 +1158,26 @@ ics9xxx_find_bus_match(ics9xxx_t *dev, uint32_t bus, uint8_t preset_mask, uint8_ uint8_t best_match = 0; uint32_t delta, best_delta = -1; - if (dev->model == ICS9xxx_xx) - return 0; +#ifdef ENABLE_ICS9xxx_DETECT + if (dev->model_idx == ICS9xxx_xx) + return 0; +#endif - for (uint8_t i = 0; i < (sizeof(dev->frequencies) / sizeof(dev->frequencies[0])); i++) { - if (((i & preset_mask) != preset) || !dev->frequencies_ptr[i].bus) - continue; - - delta = ABS((int32_t) (bus - (dev->frequencies_ptr[i].bus * 10000))); - if (delta < best_delta) { - best_match = i; - best_delta = delta; + bus /= 10000; + uint8_t i = 0; + while (dev->frequencies_ptr[i].bus) { + if ((i & preset_mask) == preset) { + delta = ABS((int32_t) (bus - dev->frequencies_ptr[i].bus)); + if (delta < best_delta) { + best_match = i; + best_delta = delta; + } } + + i++; } - ics9xxx_log("ICS9xxx: find_match(%02X, %d) = match=%d bus=%d\n", dev->model, bus, best_match, dev->frequencies_ptr[best_match].bus); + ics9xxx_log("ICS9xxx: find_match(%s, %d) = match=%d bus=%d\n", dev->model->name, bus, best_match, dev->frequencies_ptr[best_match].bus); return best_match; } @@ -830,58 +1187,66 @@ static void * ics9xxx_init(const device_t *info) { ics9xxx_t *dev = (ics9xxx_t *) malloc(sizeof(ics9xxx_t)); - memcpy(dev, &ics9xxx_devices[info->local], sizeof(ics9xxx_t)); + memset(dev, 0, sizeof(ics9xxx_t)); - ics9xxx_log("ICS9xxx: init(%s)\n", ics9xxx_devices[info->local].name); + dev->model_idx = info->local; + dev->model = (ics9xxx_model_t *) &ics9xxx_models[dev->model_idx]; + dev->dyn_device = (device_t *) info; + memcpy(&dev->regs, &dev->model->regs, dev->model->max_reg + 1); + + ics9xxx_log("ICS9xxx: init(%s)\n", dev->model->name); uint8_t i; #ifdef ENABLE_ICS9xxx_DETECT - if (dev->model == ICS9xxx_xx) { /* detection device */ - dev->max_reg = 6; - dev->relevant_regs = 1 << 0; /* register 0 matters the most on the detection device */ - - for (i = 0; i < ICS9xxx_MAX; i++) { - for (uint8_t j = 0; j < ICS9xxx_MAX; j++) { - if ((i != j) && !memcmp(&ics9xxx_devices[i], &ics9xxx_devices[j], sizeof(ics9xxx_devices[i]))) - pclog("Optimization warning: %s and %s have duplicate tables\n", ics9xxx_devices[i].name, ics9xxx_devices[j].name); - } + for (i = 0; i < ICS9xxx_MAX; i++) { + if (ics9xxx_models[i].frequencies_ref || !ics9xxx_models[i].name) + continue; + for (uint8_t j = 0; j < i; j++) { + if (ics9xxx_models[j].frequencies_ref || !ics9xxx_models[j].name) + continue; + if (!memcmp(&ics9xxx_models[i].frequencies, &ics9xxx_models[j].frequencies, sizeof(ics9xxx_models[i].frequencies))) + pclog("Optimization warning: %s and %s have duplicate tables\n", ics9xxx_models[j].name, ics9xxx_models[i].name); } + } + + if (dev->model_idx == ICS9xxx_xx) { /* detection device */ + dev->relevant_regs = 1 << 0; /* register 0 matters the most on the detection device */ ics9xxx_detect_reset(dev); } else #endif { /* regular device */ - dev->frequencies_ptr = (ics9xxx_frequency_t *) ics9xxx_devices[dev->frequencies_ref ? dev->frequencies_ref : dev->model].frequencies; + dev->frequencies_ptr = (ics9xxx_frequency_t *) (dev->model->frequencies_ref ? ics9xxx_models[dev->model->frequencies_ref].frequencies : dev->model->frequencies); if (!dev->frequencies_ptr) fatal("ICS9xxx: NULL frequency table\n"); /* Determine which frequency bits cannot be strapped (register only). */ uint8_t register_only_bits = 0x00; - for (i = 0; i < sizeof(dev->fs_regs) / sizeof(dev->fs_regs[0]); i++) { - if (!dev->normal_bits_fixed && (dev->fs_regs[i].normal_reg < 7)) /* mark a normal, programmable bit as relevant */ - dev->relevant_regs |= 1 << dev->fs_regs[i].normal_reg; - if ((dev->fs_regs[i].normal_reg == 7) && (dev->fs_regs[i].inv_reg == 7)) /* mark as register only */ + for (i = 0; i < sizeof(dev->model->fs_regs) / sizeof(dev->model->fs_regs[0]); i++) { + if (!dev->model->normal_bits_fixed && (dev->model->fs_regs[i].normal_reg < 7)) /* mark a normal, programmable bit as relevant */ + dev->relevant_regs |= 1 << dev->model->fs_regs[i].normal_reg; + if ((dev->model->fs_regs[i].normal_reg == 7) && (dev->model->fs_regs[i].inv_reg == 7)) /* mark as register only */ register_only_bits |= 1 << i; } /* Mark the hardware select bit's register as relevant, if there's one. */ - if (dev->hw_select.normal_reg < 7) - dev->relevant_regs |= 1 << dev->hw_select.normal_reg; + if (dev->model->hw_select.normal_reg < 7) + dev->relevant_regs |= 1 << dev->model->hw_select.normal_reg; /* Find bus speed match and set default register bits accordingly. */ dev->bus_match = ics9xxx_find_bus_match(dev, cpu_busspeed, register_only_bits, 0x00); - for (i = 0; i < sizeof(dev->fs_regs) / sizeof(dev->fs_regs[0]); i++) { - if (dev->fs_regs[i].normal_reg < 7) { + for (i = 0; i < sizeof(dev->model->fs_regs) / sizeof(dev->model->fs_regs[0]); i++) { + if (dev->model->fs_regs[i].normal_reg < 7) { if (dev->bus_match & (1 << i)) - dev->regs[dev->fs_regs[i].normal_reg] |= 1 << dev->fs_regs[i].normal_bit; + dev->regs[dev->model->fs_regs[i].normal_reg] |= 1 << dev->model->fs_regs[i].normal_bit; else - dev->regs[dev->fs_regs[i].normal_reg] &= ~(1 << dev->fs_regs[i].normal_bit); + dev->regs[dev->model->fs_regs[i].normal_reg] &= ~(1 << dev->model->fs_regs[i].normal_bit); } - if (dev->fs_regs[i].inv_reg < 7) { + if (dev->model->fs_regs[i].inv_reg < 7) { if (dev->bus_match & (1 << i)) - dev->regs[dev->fs_regs[i].inv_reg] &= ~(1 << dev->fs_regs[i].inv_bit); + dev->regs[dev->model->fs_regs[i].inv_reg] &= ~(1 << dev->model->fs_regs[i].inv_bit); else - dev->regs[dev->fs_regs[i].inv_reg] |= 1 << dev->fs_regs[i].inv_bit; + dev->regs[dev->model->fs_regs[i].inv_reg] |= 1 << dev->model->fs_regs[i].inv_bit; } } } @@ -901,237 +1266,28 @@ ics9xxx_close(void *priv) i2c_removehandler(i2c_smbus, 0x69, 1, ics9xxx_start, ics9xxx_read, ics9xxx_write, NULL, dev); + free(dev->dyn_device); free(dev); } +device_t * +ics9xxx_get(uint8_t model) +{ + device_t *dev = (device_t *) malloc(sizeof(device_t)); + memset(dev, 0, sizeof(device_t)); + + dev->name = "ICS9xxx-xx Clock Generator"; + dev->local = model; #ifdef ENABLE_ICS9xxx_DETECT -const device_t ics9xxx_detect_device = { - "ICS9xxx-xx Clock Generator", - DEVICE_PCI, - ICS9xxx_xx, - ics9xxx_init, ics9xxx_close, ics9xxx_detect_reset, - { NULL }, NULL, NULL, - NULL -}; + if (model == ICS9xxx_xx) { + dev->flags = DEVICE_PCI; + dev->reset = ics9xxx_detect_reset; + } else #endif + dev->flags = DEVICE_ISA; + dev->init = ics9xxx_init; + dev->close = ics9xxx_close; - -const device_t ics9150_08_device = { - "ICS9150-08 Clock Generator", - DEVICE_ISA, - ICS9150_08, - ics9xxx_init, ics9xxx_close, NULL, - { NULL }, NULL, NULL, - NULL -}; - - -const device_t ics9248_39_device = { - "ICS9248-39 Clock Generator", - DEVICE_ISA, - ICS9248_39, - ics9xxx_init, ics9xxx_close, NULL, - { NULL }, NULL, NULL, - NULL -}; - - -const device_t ics9248_81_device = { - "ICS9248-81 Clock Generator", - DEVICE_ISA, - ICS9248_81, - ics9xxx_init, ics9xxx_close, NULL, - { NULL }, NULL, NULL, - NULL -}; - - -const device_t ics9248_98_device = { - "ICS9248-98 Clock Generator", - DEVICE_ISA, - ICS9248_98, - ics9xxx_init, ics9xxx_close, NULL, - { NULL }, NULL, NULL, - NULL -}; - - -const device_t ics9248_101_device = { - "ICS9248-101 Clock Generator", - DEVICE_ISA, - ICS9248_101, - ics9xxx_init, ics9xxx_close, NULL, - { NULL }, NULL, NULL, - NULL -}; - - -const device_t ics9250_08_device = { - "ICS9250-08 Clock Generator", - DEVICE_ISA, - ICS9250_08, - ics9xxx_init, ics9xxx_close, NULL, - { NULL }, NULL, NULL, - NULL -}; - - -const device_t ics9250_10_device = { - "ICS9250-10 Clock Generator", - DEVICE_ISA, - ICS9250_10, - ics9xxx_init, ics9xxx_close, NULL, - { NULL }, NULL, NULL, - NULL -}; - - -const device_t ics9250_13_device = { - "ICS9250-13 Clock Generator", - DEVICE_ISA, - ICS9250_13, - ics9xxx_init, ics9xxx_close, NULL, - { NULL }, NULL, NULL, - NULL -}; - - -const device_t ics9250_14_device = { - "ICS9250-14 Clock Generator", - DEVICE_ISA, - ICS9250_14, - ics9xxx_init, ics9xxx_close, NULL, - { NULL }, NULL, NULL, - NULL -}; - - -const device_t ics9250_16_device = { - "ICS9250-16 Clock Generator", - DEVICE_ISA, - ICS9250_16, - ics9xxx_init, ics9xxx_close, NULL, - { NULL }, NULL, NULL, - NULL -}; - - -const device_t ics9250_18_device = { - "ICS9250-18 Clock Generator", - DEVICE_ISA, - ICS9250_18, - ics9xxx_init, ics9xxx_close, NULL, - { NULL }, NULL, NULL, - NULL -}; - - -const device_t ics9250_19_device = { - "ICS9250-19 Clock Generator", - DEVICE_ISA, - ICS9250_19, - ics9xxx_init, ics9xxx_close, NULL, - { NULL }, NULL, NULL, - NULL -}; - - -const device_t ics9250_23_device = { - "ICS9250-23 Clock Generator", - DEVICE_ISA, - ICS9250_23, - ics9xxx_init, ics9xxx_close, NULL, - { NULL }, NULL, NULL, - NULL -}; - - -const device_t ics9250_25_device = { - "ICS9250-25 Clock Generator", - DEVICE_ISA, - ICS9250_25, - ics9xxx_init, ics9xxx_close, NULL, - { NULL }, NULL, NULL, - NULL -}; - - -const device_t ics9250_26_device = { - "ICS9250-26 Clock Generator", - DEVICE_ISA, - ICS9250_26, - ics9xxx_init, ics9xxx_close, NULL, - { NULL }, NULL, NULL, - NULL -}; - - -const device_t ics9250_27_device = { - "ICS9250-27 Clock Generator", - DEVICE_ISA, - ICS9250_27, - ics9xxx_init, ics9xxx_close, NULL, - { NULL }, NULL, NULL, - NULL -}; - - -const device_t ics9250_28_device = { - "ICS9250-28 Clock Generator", - DEVICE_ISA, - ICS9250_28, - ics9xxx_init, ics9xxx_close, NULL, - { NULL }, NULL, NULL, - NULL -}; - - -const device_t ics9250_29_device = { - "ICS9250-29 Clock Generator", - DEVICE_ISA, - ICS9250_29, - ics9xxx_init, ics9xxx_close, NULL, - { NULL }, NULL, NULL, - NULL -}; - - -const device_t ics9250_30_device = { - "ICS9250-30 Clock Generator", - DEVICE_ISA, - ICS9250_30, - ics9xxx_init, ics9xxx_close, NULL, - { NULL }, NULL, NULL, - NULL -}; - - -const device_t ics9250_32_device = { - "ICS9250-32 Clock Generator", - DEVICE_ISA, - ICS9250_32, - ics9xxx_init, ics9xxx_close, NULL, - { NULL }, NULL, NULL, - NULL -}; - - -const device_t ics9250_38_device = { - "ICS9250-38 Clock Generator", - DEVICE_ISA, - ICS9250_38, - ics9xxx_init, ics9xxx_close, NULL, - { NULL }, NULL, NULL, - NULL -}; - - -const device_t ics9250_50_device = { - "ICS9250-50 Clock Generator", - DEVICE_ISA, - ICS9250_50, - ics9xxx_init, ics9xxx_close, NULL, - { NULL }, NULL, NULL, - NULL -}; + return dev; +} diff --git a/src/device/i2c.c b/src/device/i2c.c index c17f3487c..ac0e5ee83 100644 --- a/src/device/i2c.c +++ b/src/device/i2c.c @@ -213,20 +213,6 @@ i2c_handler(int set, void *bus_handle, uint8_t base, int size, } -uint8_t -i2c_has_device(void *bus_handle, uint8_t addr) -{ - i2c_bus_t *bus = (i2c_bus_t *) bus_handle; - - if (!bus) - return 0; - - i2c_log("I2C: has_device(%s, %02X) = %d\n", bus->name, addr, !!bus->devices[addr]); - - return(!!bus->devices[addr]); -} - - uint8_t i2c_start(void *bus_handle, uint8_t addr, uint8_t read) { @@ -247,7 +233,7 @@ i2c_start(void *bus_handle, uint8_t addr, uint8_t read) } } - i2c_log("I2C: start(%s, %02X)\n", bus->name, addr); + i2c_log("I2C %s: start(%02X) = %d\n", bus->name, addr, ret); return(ret); } @@ -274,7 +260,7 @@ i2c_read(void *bus_handle, uint8_t addr) } } - i2c_log("I2C: read(%s, %02X) = %02X\n", bus->name, addr, ret); + i2c_log("I2C %s: read(%02X) = %02X\n", bus->name, addr, ret); return(ret); } @@ -300,7 +286,7 @@ i2c_write(void *bus_handle, uint8_t addr, uint8_t data) } } - i2c_log("I2C: write(%s, %02X, %02X) = %d\n", bus->name, addr, data, ret); + i2c_log("I2C %s: write(%02X, %02X) = %d\n", bus->name, addr, data, ret); return(ret); } @@ -325,5 +311,5 @@ i2c_stop(void *bus_handle, uint8_t addr) } } - i2c_log("I2C: stop(%s, %02X)\n", bus->name, addr); + i2c_log("I2C %s: stop(%02X)\n", bus->name, addr); } diff --git a/src/device/i2c_gpio.c b/src/device/i2c_gpio.c index 8d219b67d..e3902baaa 100644 --- a/src/device/i2c_gpio.c +++ b/src/device/i2c_gpio.c @@ -95,11 +95,15 @@ i2c_gpio_set(void *dev_handle, uint8_t scl, uint8_t sda) i2c_gpio_log(2, "I2C GPIO %s: Start condition\n", dev->bus_name); dev->started = 1; dev->pos = 0; + dev->slave_addr = 0xff; dev->slave_read = 2; /* start with address transfer */ dev->slave_sda = 1; } else if (!dev->prev_sda && sda) { i2c_gpio_log(2, "I2C GPIO %s: Stop condition\n", dev->bus_name); dev->started = 0; + if (dev->slave_addr != 0xff) + i2c_stop(dev->i2c, dev->slave_addr); + dev->slave_addr = 0xff; dev->slave_sda = 1; } } else if (!dev->prev_scl && scl && dev->started) { @@ -125,7 +129,7 @@ i2c_gpio_set(void *dev_handle, uint8_t scl, uint8_t sda) dev->slave_read = dev->byte & 1; /* slave ACKs? */ - dev->slave_sda = !(i2c_has_device(dev->i2c, dev->slave_addr) && i2c_start(dev->i2c, dev->slave_addr, dev->slave_read)); + dev->slave_sda = !i2c_start(dev->i2c, dev->slave_addr, dev->slave_read); i2c_gpio_log(2, "I2C GPIO %s: Slave %02X %s %sACK\n", dev->bus_name, dev->slave_addr, dev->slave_read ? "read" : "write", dev->slave_sda ? "N" : ""); if (!dev->slave_sda && dev->slave_read) /* read first byte on an ACKed read transfer */ diff --git a/src/device/smbus_piix4.c b/src/device/smbus_piix4.c index 9a544832c..e9156bf62 100644 --- a/src/device/smbus_piix4.c +++ b/src/device/smbus_piix4.c @@ -131,7 +131,7 @@ smbus_piix4_write(uint16_t addr, uint8_t val, void *priv) smbus_piix4_log("SMBus PIIX4: addr=%02X read=%d protocol=%X cmd=%02X data0=%02X data1=%02X\n", smbus_addr, read, cmd, dev->cmd, dev->data0, dev->data1); /* Raise DEV_ERR if no device is at this address, or if the device returned NAK when starting the transfer. */ - if (!i2c_has_device(i2c_smbus, smbus_addr) || !i2c_start(i2c_smbus, smbus_addr, read)) { + if (!i2c_start(i2c_smbus, smbus_addr, read)) { dev->next_stat = 0x04; break; } diff --git a/src/game/gameport.c b/src/game/gameport.c index 883af2388..a5ece27dd 100644 --- a/src/game/gameport.c +++ b/src/game/gameport.c @@ -68,11 +68,11 @@ typedef struct _gameport_ { } gameport_t; -int joystick_type; +int joystick_type = 0; static const joystick_if_t joystick_none = { - "No joystick", + "None", NULL, NULL, NULL, @@ -85,17 +85,20 @@ static const joystick_if_t joystick_none = { }; -static const joystick_if_t *joystick_list[] = { - &joystick_standard, - &joystick_standard_4button, - &joystick_standard_6button, - &joystick_standard_8button, - &joystick_4axis_4button, - &joystick_ch_flightstick_pro, - &joystick_sw_pad, - &joystick_tm_fcs, - &joystick_none, - NULL +static const struct { + const char *internal_name; + const joystick_if_t *joystick; +} joysticks[] = { + { "none", &joystick_none }, + { "standard_2button", &joystick_standard }, + { "standard_4button", &joystick_standard_4button }, + { "standard_6button", &joystick_standard_6button }, + { "standard_8button", &joystick_standard_8button }, + { "4axis_4button", &joystick_4axis_4button }, + { "ch_flighstick_pro", &joystick_ch_flightstick_pro }, + { "sidewinder_pad", &joystick_sw_pad }, + { "thrustmaster_fcs", &joystick_tm_fcs }, + { "", NULL } }; static gameport_t *gameport_global = NULL; @@ -103,58 +106,81 @@ static gameport_t *gameport_global = NULL; char * joystick_get_name(int js) { - if (! joystick_list[js]) + if (! joysticks[js].joystick) return(NULL); - return((char *)joystick_list[js]->name); + return((char *)joysticks[js].joystick->name); +} + + +char * +joystick_get_internal_name(int js) +{ + return((char *) joysticks[js].internal_name); +} + + +int +joystick_get_from_internal_name(char *s) +{ + int c = 0; + + while (strlen((char *) joysticks[c].internal_name)) + { + if (!strcmp((char *) joysticks[c].internal_name, s)) + return c; + c++; + } + + return 0; } int joystick_get_max_joysticks(int js) { - return(joystick_list[js]->max_joysticks); + return(joysticks[js].joystick->max_joysticks); } int joystick_get_axis_count(int js) { - return(joystick_list[js]->axis_count); + return(joysticks[js].joystick->axis_count); } int joystick_get_button_count(int js) { - return(joystick_list[js]->button_count); + return(joysticks[js].joystick->button_count); } int joystick_get_pov_count(int js) { - return(joystick_list[js]->pov_count); + return(joysticks[js].joystick->pov_count); } char * joystick_get_axis_name(int js, int id) { - return((char *)joystick_list[js]->axis_names[id]); + return((char *)joysticks[js].joystick->axis_names[id]); } char * joystick_get_button_name(int js, int id) { - return((char *)joystick_list[js]->button_names[id]); + return((char *)joysticks[js].joystick->button_names[id]); } char * joystick_get_pov_name(int js, int id) { - return (char *)joystick_list[js]->pov_names[id]; + return (char *)joysticks[js].joystick->pov_names[id]; } @@ -239,7 +265,7 @@ init_common(void) timer_add(&p->axis[2].timer, timer_over, &p->axis[2], 0); timer_add(&p->axis[3].timer, timer_over, &p->axis[3], 0); - p->joystick = joystick_list[joystick_type]; + p->joystick = joysticks[joystick_type].joystick; p->joystick_dat = p->joystick->init(); gameport_global = p; @@ -255,7 +281,7 @@ gameport_update_joystick_type(void) if (p != NULL) { p->joystick->close(p->joystick_dat); - p->joystick = joystick_list[joystick_type]; + p->joystick = joysticks[joystick_type].joystick; p->joystick_dat = p->joystick->init(); } } @@ -266,7 +292,7 @@ gameport_init(const device_t *info) { gameport_t *p = NULL; - if (joystick_type == JOYSTICK_TYPE_NONE) { + if (!joystick_type) { p = NULL; return(p); } @@ -285,7 +311,7 @@ gameport_201_init(const device_t *info) { gameport_t *p; - if (joystick_type == JOYSTICK_TYPE_NONE) { + if (!joystick_type) { p = NULL; return(p); } diff --git a/src/include/86box/clock.h b/src/include/86box/clock.h index 5ba7d508b..003b58b1a 100644 --- a/src/include/86box/clock.h +++ b/src/include/86box/clock.h @@ -18,28 +18,51 @@ # define EMU_CLOCK_H /* clock_ics9xxx.c */ -extern const device_t ics9xxx_detect_device; -extern const device_t ics9150_08_device; -extern const device_t ics9248_39_device; -extern const device_t ics9248_81_device; -extern const device_t ics9248_98_device; -extern const device_t ics9248_101_device; -extern const device_t ics9250_08_device; -extern const device_t ics9250_10_device; -extern const device_t ics9250_13_device; -extern const device_t ics9250_14_device; -extern const device_t ics9250_16_device; -extern const device_t ics9250_18_device; -extern const device_t ics9250_19_device; -extern const device_t ics9250_23_device; -extern const device_t ics9250_25_device; -extern const device_t ics9250_26_device; -extern const device_t ics9250_27_device; -extern const device_t ics9250_28_device; -extern const device_t ics9250_29_device; -extern const device_t ics9250_30_device; -extern const device_t ics9250_32_device; -extern const device_t ics9250_38_device; -extern const device_t ics9250_50_device; +enum { + ICS9xxx_xx, + ICS9150_08, +#if 0 + ICS9248_39, + ICS9248_81, + ICS9248_95, + ICS9248_98, + ICS9248_101, + ICS9248_103, + ICS9248_107, + ICS9248_112, + ICS9248_138, + ICS9248_141, + ICS9248_143, + ICS9248_151, + ICS9248_192, +#endif + ICS9250_08, +#if 0 + ICS9250_10, + ICS9250_13, + ICS9250_14, + ICS9250_16, +#endif + ICS9250_18, +#if 0 + ICS9250_19, + ICS9250_23, + ICS9250_25, + ICS9250_26, + ICS9250_27, + ICS9250_28, + ICS9250_29, + ICS9250_30, + ICS9250_32, + ICS9250_38, + ICS9250_50, +#endif + ICS9xxx_MAX +}; + + +/* clock_ics9xxx.c */ +extern device_t *ics9xxx_get(uint8_t model); + #endif /*EMU_CLOCK_H*/ diff --git a/src/include/86box/gameport.h b/src/include/86box/gameport.h index a91a26232..105b6cd62 100644 --- a/src/include/86box/gameport.h +++ b/src/include/86box/gameport.h @@ -48,7 +48,6 @@ #define SLIDER 0x20000000 #define AXIS_NOT_PRESENT -99999 -#define JOYSTICK_TYPE_NONE 8 #define JOYSTICK_PRESENT(n) (joystick_state[n].plat_joystick_nr != 0) @@ -140,6 +139,8 @@ extern void joystick_close(void); extern void joystick_process(void); extern char *joystick_get_name(int js); +extern char *joystick_get_internal_name(int js); +extern int joystick_get_from_internal_name(char *s); extern int joystick_get_max_joysticks(int js); extern int joystick_get_axis_count(int js); extern int joystick_get_button_count(int js); diff --git a/src/include/86box/i2c.h b/src/include/86box/i2c.h index 58ef23bd1..b47754d64 100644 --- a/src/include/86box/i2c.h +++ b/src/include/86box/i2c.h @@ -48,7 +48,6 @@ extern void i2c_handler(int set, void *bus_handle, uint8_t base, int size, void (*stop)(void *bus, uint8_t addr, void *priv), void *priv); -extern uint8_t i2c_has_device(void *bus_handle, uint8_t addr); extern uint8_t i2c_start(void *bus_handle, uint8_t addr, uint8_t read); extern uint8_t i2c_read(void *bus_handle, uint8_t addr); extern uint8_t i2c_write(void *bus_handle, uint8_t addr, uint8_t data); diff --git a/src/include/86box/vid_svga.h b/src/include/86box/vid_svga.h index ca7ae4c21..9fbe4c7fe 100644 --- a/src/include/86box/vid_svga.h +++ b/src/include/86box/vid_svga.h @@ -124,7 +124,7 @@ typedef struct svga_t int override; void *p; - uint8_t crtc[128], gdcreg[64], attrregs[32], seqregs[64], + uint8_t crtc[256], gdcreg[64], attrregs[32], seqregs[256], egapal[16], *vram, *changedvram; diff --git a/src/machine/m_amstrad.c b/src/machine/m_amstrad.c index 87de506ef..ec0bff6ec 100644 --- a/src/machine/m_amstrad.c +++ b/src/machine/m_amstrad.c @@ -2507,7 +2507,7 @@ machine_amstrad_init(const machine_t *model, int type) mouse_set_poll(ms_poll, ams); } - if (joystick_type != JOYSTICK_TYPE_NONE) + if (joystick_type) device_add(&gameport_device); } diff --git a/src/machine/m_at.c b/src/machine/m_at.c index 53e0b4367..be5bc974e 100644 --- a/src/machine/m_at.c +++ b/src/machine/m_at.c @@ -74,7 +74,7 @@ machine_at_common_init_ex(const machine_t *model, int type) else if (type == 0) device_add(&at_nvr_device); - if (joystick_type != JOYSTICK_TYPE_NONE) + if (joystick_type) device_add(&gameport_device); } diff --git a/src/machine/m_at_slot1.c b/src/machine/m_at_slot1.c index ff96c7dcc..f4fe466ac 100644 --- a/src/machine/m_at_slot1.c +++ b/src/machine/m_at_slot1.c @@ -215,7 +215,7 @@ machine_at_p2bls_init(const machine_t *model) device_add(&piix4e_device); device_add(&keyboard_ps2_ami_pci_device); device_add(&w83977ef_device); - device_add(&ics9150_08_device); + device_add(ics9xxx_get(ICS9150_08)); device_add(&sst_flash_39sf020_device); spd_register(SPD_TYPE_SDRAM, 0xF, 256); device_add(&w83781d_device); /* fans: Chassis, CPU, Power; temperatures: MB, unused, CPU */ @@ -253,7 +253,7 @@ machine_at_p3bf_init(const machine_t *model) device_add(&piix4e_device); device_add(&keyboard_ps2_ami_pci_device); device_add(&w83977ef_device); - device_add(&ics9250_08_device); + device_add(ics9xxx_get(ICS9250_08)); device_add(&sst_flash_39sf020_device); spd_register(SPD_TYPE_SDRAM, 0xF, 256); device_add(&as99127f_device); /* fans: Chassis, CPU, Power; temperatures: MB, JTPWR, CPU */ @@ -577,7 +577,7 @@ machine_at_p3v4x_init(const machine_t *model) device_add(&via_vt82c596b_device); device_add(&w83977ef_device); device_add(&keyboard_ps2_ami_pci_device); - device_add(&ics9250_18_device); + device_add(ics9xxx_get(ICS9250_18)); device_add(&sst_flash_39sf020_device); spd_register(SPD_TYPE_SDRAM, 0xF, 512); device_add(&as99127f_device); /* fans: Chassis, CPU, Power; temperatures: MB, JTPWR, CPU */ diff --git a/src/machine/m_at_socket370.c b/src/machine/m_at_socket370.c index 45809515f..d378c0108 100644 --- a/src/machine/m_at_socket370.c +++ b/src/machine/m_at_socket370.c @@ -163,7 +163,7 @@ machine_at_cubx_init(const machine_t *model) device_add(&piix4e_device); device_add(&keyboard_ps2_ami_pci_device); device_add(&w83977ef_device); - device_add(&ics9250_08_device); + device_add(ics9xxx_get(ICS9250_08)); device_add(&sst_flash_39sf020_device); spd_register(SPD_TYPE_SDRAM, 0xF, 256); device_add(&as99127f_device); /* fans: Chassis, CPU, Power; temperatures: MB, JTPWR, CPU */ @@ -397,7 +397,7 @@ machine_at_cuv4xls_init(const machine_t *model) device_add(&via_vt82c686b_device); device_add(&via_vt82c686_sio_device); device_add(&keyboard_ps2_ami_pci_device); - device_add(&ics9250_18_device); + device_add(ics9xxx_get(ICS9250_18)); device_add(&sst_flash_39sf020_device); spd_register(SPD_TYPE_SDRAM, 0xF, 512); device_add(&as99127f_device); /* fans: Chassis, CPU, Power; temperatures: MB, JTPWR, CPU */ @@ -431,7 +431,7 @@ machine_at_6via90ap_init(const machine_t *model) device_add(&via_vt82c686b_device); device_add(&via_vt82c686_sio_device); device_add(&keyboard_ps2_ami_pci_device); - device_add(&ics9250_18_device); + device_add(ics9xxx_get(ICS9250_18)); device_add(&sst_flash_39sf020_device); spd_register(SPD_TYPE_SDRAM, 0x7, 512); device_add(&via_vt82c686_hwm_device); /* fans: CPU1, CPU2; temperatures: CPU, System, unused */ diff --git a/src/machine/m_europc.c b/src/machine/m_europc.c index f901f51a7..f98b4174c 100644 --- a/src/machine/m_europc.c +++ b/src/machine/m_europc.c @@ -615,7 +615,7 @@ europc_boot(const device_t *info) mouse_bus_set_irq(sys->mouse, 2); /* Configure the port for (Bus Mouse Compatible) Mouse. */ b |= 0x01; - } else if (joystick_type != JOYSTICK_TYPE_NONE) + } else if (joystick_type) b |= 0x02; /* enable port as joysticks */ sys->nvr.regs[MRTC_CONF_C] = b; diff --git a/src/machine/m_ps1.c b/src/machine/m_ps1.c index 539448c2e..ccad28139 100644 --- a/src/machine/m_ps1.c +++ b/src/machine/m_ps1.c @@ -517,7 +517,7 @@ ps1_common_init(const machine_t *model) device_add(&keyboard_ps2_ps1_device); /* Audio uses ports 200h and 202-207h, so only initialize gameport on 201h. */ - if (joystick_type != JOYSTICK_TYPE_NONE) + if (joystick_type) device_add(&gameport_201_device); } diff --git a/src/machine/m_tandy.c b/src/machine/m_tandy.c index f38f60767..470cd099c 100644 --- a/src/machine/m_tandy.c +++ b/src/machine/m_tandy.c @@ -1535,7 +1535,7 @@ machine_tandy1k_init(const machine_t *model, int type) break; } - if (joystick_type != JOYSTICK_TYPE_NONE) + if (joystick_type) device_add(&gameport_device); eep_data_out = 0x0000; diff --git a/src/machine/m_xt.c b/src/machine/m_xt.c index 310a5fa37..e94c7bc28 100644 --- a/src/machine/m_xt.c +++ b/src/machine/m_xt.c @@ -29,7 +29,7 @@ machine_xt_common_init(const machine_t *model) device_add(&fdc_xt_device); nmi_init(); - if (joystick_type != JOYSTICK_TYPE_NONE) + if (joystick_type) device_add(&gameport_device); } diff --git a/src/machine/m_xt_compaq.c b/src/machine/m_xt_compaq.c index da41a4a41..765c626b2 100644 --- a/src/machine/m_xt_compaq.c +++ b/src/machine/m_xt_compaq.c @@ -56,7 +56,7 @@ machine_xt_compaq_deskpro_init(const machine_t *model) if (fdc_type == FDC_INTERNAL) device_add(&fdc_xt_device); nmi_init(); - if (joystick_type != JOYSTICK_TYPE_NONE) + if (joystick_type) device_add(&gameport_device); lpt1_remove(); @@ -85,7 +85,7 @@ machine_xt_compaq_portable_init(const machine_t *model) if (fdc_type == FDC_INTERNAL) device_add(&fdc_xt_device); nmi_init(); - if (joystick_type != JOYSTICK_TYPE_NONE) + if (joystick_type) device_add(&gameport_device); lpt1_remove(); diff --git a/src/machine/m_xt_laserxt.c b/src/machine/m_xt_laserxt.c index d0b0fdf81..20c0e21ff 100644 --- a/src/machine/m_xt_laserxt.c +++ b/src/machine/m_xt_laserxt.c @@ -171,7 +171,7 @@ machine_xt_lxt3_init(const machine_t *model) device_add(&keyboard_xt_lxt3_device); device_add(&fdc_xt_device); nmi_init(); - if (joystick_type != JOYSTICK_TYPE_NONE) + if (joystick_type) device_add(&gameport_device); laserxt_init(1); diff --git a/src/machine/m_xt_olivetti.c b/src/machine/m_xt_olivetti.c index 4e2184371..a52588ce0 100644 --- a/src/machine/m_xt_olivetti.c +++ b/src/machine/m_xt_olivetti.c @@ -717,7 +717,7 @@ machine_xt_olim24_init(const machine_t *model) /* FIXME: make sure this is correct?? */ device_add(&at_nvr_device); - if (joystick_type != JOYSTICK_TYPE_NONE) + if (joystick_type) device_add(&gameport_device); nmi_init(); @@ -760,7 +760,7 @@ machine_xt_olim240_init(const machine_t *model) if (fdc_type == FDC_INTERNAL) device_add(&fdc_xt_device); - if (joystick_type != JOYSTICK_TYPE_NONE) + if (joystick_type) device_add(&gameport_device); nmi_init(); @@ -833,7 +833,7 @@ machine_xt_olim15_init(const machine_t *model) if (fdc_type == FDC_INTERNAL) device_add(&fdc_xt_device); - if (joystick_type != JOYSTICK_TYPE_NONE) + if (joystick_type) device_add(&gameport_device); nmi_init(); diff --git a/src/machine/m_xt_xi8088.c b/src/machine/m_xt_xi8088.c index 6944d1b3a..39fe5e2cf 100644 --- a/src/machine/m_xt_xi8088.c +++ b/src/machine/m_xt_xi8088.c @@ -177,7 +177,7 @@ machine_xt_xi8088_init(const machine_t *model) nmi_init(); device_add(&ibmat_nvr_device); pic2_init(); - if (joystick_type != JOYSTICK_TYPE_NONE) + if (joystick_type) device_add(&gameport_device); return ret; diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 905793b09..c852b0057 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -63,10 +63,12 @@ const machine_t machines[] = { { "[8088] IBM XT (1986)", "ibmxt86", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 256, 640, 64, 0, machine_xt86_init, NULL }, { "[8088] American XT Computer", "americxt", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 64, 640, 64, 0, machine_xt_americxt_init, NULL }, { "[8088] AMI XT clone", "amixt", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 64, 640, 64, 0, machine_xt_amixt_init, NULL }, - { "[8088] Compaq Portable", "portable", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC | MACHINE_VIDEO, 128, 640, 128, 0, machine_xt_compaq_portable_init, NULL }, + { "[8088] Compaq Portable", "portable", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 128, 640, 128, 0, machine_xt_compaq_portable_init, NULL }, { "[8088] DTK XT clone", "dtk", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 64, 640, 64, 0, machine_xt_dtk_init, NULL }, { "[8088] Generic XT clone", "genxt", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 64, 640, 64, 0, machine_genxt_init, NULL }, { "[8088] Juko XT clone", "jukopc", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 64, 640, 64, 0, machine_xt_jukopc_init, NULL }, + { "[8088] NCR PC4i", "ncr_pc4i", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 256, 640, 256, 0, machine_xt_ncrpc4i_init, NULL }, + { "[8088] Olivetti M19", "olivetti_m19", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC | MACHINE_VIDEO_FIXED, 256, 640, 256, 0, machine_xt_olim19_init, NULL }, { "[8088] OpenXT", "open_xt", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 64, 640, 64, 0, machine_xt_open_xt_init, NULL }, { "[8088] Phoenix XT clone", "pxxt", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 64, 640, 64, 0, machine_xt_pxxt_init, NULL }, { "[8088] Schneider EuroPC", "europc", MACHINE_TYPE_8088, CPU_PKG_8088_EUROPC, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC | MACHINE_XTA | MACHINE_MOUSE, 512, 640, 128, 15, machine_europc_init, NULL }, @@ -79,23 +81,19 @@ const machine_t machines[] = { { "[8088] Xi8088", "xi8088", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT | MACHINE_BUS_PS2, 64, 1024, 128, 127, machine_xt_xi8088_init, xi8088_get_device }, { "[8088] Zenith Data SupersPort", "zdsupers", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 128, 640, 128, 0, machine_xt_zenith_init, NULL }, - { "[8088] Olivetti M19", "olivetti_m19", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC | MACHINE_VIDEO_FIXED, 256, 640, 256, 0, machine_xt_olim19_init, NULL }, - { "[8088] NCR PC4i", "ncr_pc4i", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 256, 640, 256, 0, machine_xt_ncrpc4i_init, NULL }, - /* 8086 Machines */ { "[8086] Amstrad PC1512", "pc1512", MACHINE_TYPE_8086, CPU_PKG_8086, 0, 8000000, 8000000, 0, 0, 0, 0, MACHINE_PC | MACHINE_VIDEO_FIXED | MACHINE_MOUSE, 512, 640, 128, 63, machine_pc1512_init, pc1512_get_device }, - { "[8086] Amstrad PC1640", "pc1640", MACHINE_TYPE_8086, CPU_PKG_8086, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC | MACHINE_VIDEO | MACHINE_MOUSE, 640, 640, 0, 63, machine_pc1640_init, pc1640_get_device }, - { "[8086] Amstrad PC2086", "pc2086", MACHINE_TYPE_8086, CPU_PKG_8086, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC | MACHINE_VIDEO_FIXED | MACHINE_MOUSE, 640, 640, 0, 63, machine_pc2086_init, pc2086_get_device }, - { "[8086] Amstrad PC3086", "pc3086", MACHINE_TYPE_8086, CPU_PKG_8086, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC | MACHINE_VIDEO_FIXED | MACHINE_MOUSE, 640, 640, 0, 63, machine_pc3086_init, pc3086_get_device }, + { "[8086] Amstrad PC1640", "pc1640", MACHINE_TYPE_8086, CPU_PKG_8086, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC | MACHINE_VIDEO | MACHINE_MOUSE, 640, 640, 640, 63, machine_pc1640_init, pc1640_get_device }, + { "[8086] Amstrad PC2086", "pc2086", MACHINE_TYPE_8086, CPU_PKG_8086, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC | MACHINE_VIDEO_FIXED | MACHINE_MOUSE, 640, 640, 640, 63, machine_pc2086_init, pc2086_get_device }, + { "[8086] Amstrad PC3086", "pc3086", MACHINE_TYPE_8086, CPU_PKG_8086, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC | MACHINE_VIDEO_FIXED | MACHINE_MOUSE, 640, 640, 640, 63, machine_pc3086_init, pc3086_get_device }, { "[8086] Amstrad PC20(0)", "pc200", MACHINE_TYPE_8086, CPU_PKG_8086, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC | MACHINE_VIDEO | MACHINE_MOUSE | MACHINE_NONMI, 512, 640, 128, 63, machine_pc200_init, pc200_get_device }, { "[8086] Amstrad PPC512/640", "ppc512", MACHINE_TYPE_8086, CPU_PKG_8086, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC | MACHINE_VIDEO | MACHINE_MOUSE | MACHINE_NONMI, 512, 640, 128, 63, machine_ppc512_init, ppc512_get_device }, - { "[8086] Compaq Deskpro", "deskpro", MACHINE_TYPE_8086, CPU_PKG_8086, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 128, 640, 128, 0, machine_xt_compaq_deskpro_init, NULL }, - { "[8086] Olivetti M21/24/24SP", "olivetti_m24", MACHINE_TYPE_8086, CPU_PKG_8086, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC | MACHINE_VIDEO | MACHINE_MOUSE, 128, 640, 128, 0, machine_xt_olim24_init, m24_get_device }, + { "[8086] Compaq Deskpro", "deskpro", MACHINE_TYPE_8086, CPU_PKG_8086, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 128, 640, 128, 0, machine_xt_compaq_deskpro_init, NULL }, + { "[8086] Olivetti M21/24/24SP", "olivetti_m24", MACHINE_TYPE_8086, CPU_PKG_8086, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC | MACHINE_VIDEO | MACHINE_MOUSE, 128, 640, 128, 0, machine_xt_olim24_init, m24_get_device }, + { "[8086] Olivetti M240", "olivetti_m240", MACHINE_TYPE_8086, CPU_PKG_8086, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 128, 640, 128, 0, machine_xt_olim240_init, NULL }, { "[8086] Schetmash Iskra-3104", "iskra3104", MACHINE_TYPE_8086, CPU_PKG_8086, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 128, 640, 128, 0, machine_xt_iskra3104_init, NULL }, { "[8086] Tandy 1000 SL/2", "tandy1000sl2", MACHINE_TYPE_8086, CPU_PKG_8086, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC | MACHINE_VIDEO_FIXED, 512, 768, 128, 0, machine_tandy1000sl2_init, tandy1k_sl_get_device }, { "[8086] Toshiba T1200", "t1200", MACHINE_TYPE_8086, CPU_PKG_8086, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC | MACHINE_VIDEO, 1024, 2048,1024, 63, machine_xt_t1200_init, t1200_get_device }, - - { "[8086] Olivetti M240", "olivetti_m240", MACHINE_TYPE_8086, CPU_PKG_8086, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 128, 640, 128, 0, machine_xt_olim240_init, NULL }, #if defined(DEV_BRANCH) && defined(USE_LASERXT) { "[8086] VTech Laser XT3", "lxt3", MACHINE_TYPE_8086, CPU_PKG_8086, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 256, 640, 256, 0, machine_xt_lxt3_init, NULL }, @@ -243,7 +241,7 @@ const machine_t machines[] = { { "[i430LX] Packard Bell PB520R", "pb520r", MACHINE_TYPE_SOCKET4, CPU_PKG_SOCKET4, 0, 60000000, 66666667, 0, 0, MACHINE_MULTIPLIER_FIXED, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL | MACHINE_VIDEO, 8192, 139264, 2048, 127, machine_at_pb520r_init, at_pb520r_get_device }, /* OPTi 596/597 */ - { "[OPTi 597] AMI Excalibur VLB", "excalibur", MACHINE_TYPE_SOCKET4, CPU_PKG_SOCKET4, 0, 60000000, 66666667, 0, 0, 1.0, 1.0, MACHINE_VLB | MACHINE_IDE, 2048, 65536, 2048, 127, machine_at_excalibur_init, NULL }, + { "[OPTi 597] AMI Excalibur VLB", "excalibur", MACHINE_TYPE_SOCKET4, CPU_PKG_SOCKET4, 0, 60000000, 66666667, 0, 0, MACHINE_MULTIPLIER_FIXED, MACHINE_VLB | MACHINE_IDE, 2048, 65536, 2048, 127, machine_at_excalibur_init, NULL }, /* Socket 5 machines */ /* 430NX */ @@ -276,7 +274,7 @@ const machine_t machines[] = { { "[i430HX] Biostar MB-8500TUC", "8500tuc", MACHINE_TYPE_SOCKET7_3V, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3380, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 524288, 8192, 127, machine_at_8500tuc_init, NULL }, { "[i430HX] SuperMicro Super P55T2S", "p55t2s", MACHINE_TYPE_SOCKET7_3V, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3300, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 786432, 8192, 127, machine_at_p55t2s_init, NULL }, - { "[i430HX] Acer V35N", "acerv35n", MACHINE_TYPE_SOCKET7, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 2800, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 196608, 8192, 127, machine_at_acerv35n_init, NULL }, + { "[i430HX] Acer V35N", "acerv35n", MACHINE_TYPE_SOCKET7, CPU_PKG_SOCKET5_7, CPU_Cx6x86MX, 50000000, 66666667, 2800, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 196608, 8192, 127, machine_at_acerv35n_init, NULL }, { "[i430HX] ASUS P/I-P55T2P4", "p55t2p4", MACHINE_TYPE_SOCKET7, CPU_PKG_SOCKET5_7, 0, 50000000, 83333333, 2500, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 262144, 8192, 127, machine_at_p55t2p4_init, NULL }, { "[i430HX] Micronics M7S-Hi", "m7shi", MACHINE_TYPE_SOCKET7, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 2800, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 131072, 8192, 511, machine_at_m7shi_init, NULL }, { "[i430HX] Intel TC430HX", "tc430hx", MACHINE_TYPE_SOCKET7, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 2800, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 131072, 8192, 255, machine_at_tc430hx_init, NULL }, diff --git a/src/mem/i2c_eeprom.c b/src/mem/i2c_eeprom.c index 62615db34..dceac93a5 100644 --- a/src/mem/i2c_eeprom.c +++ b/src/mem/i2c_eeprom.c @@ -110,6 +110,17 @@ i2c_eeprom_write(void *bus, uint8_t addr, uint8_t data, void *priv) } +static void +i2c_eeprom_stop(void *bus, uint8_t addr, void *priv) +{ + i2c_eeprom_t *dev = (i2c_eeprom_t *) priv; + + i2c_eeprom_log("I2C EEPROM %s %02X: stop()\n", i2c_getbusname(dev->i2c), dev->addr); + + dev->addr_pos = 0; +} + + uint8_t log2i(uint32_t i) { @@ -142,7 +153,7 @@ i2c_eeprom_init(void *i2c, uint8_t addr, uint8_t *data, uint32_t size, uint8_t w dev->addr_len = (size >= 4096) ? 16 : 8; /* use 16-bit addresses on 24C32 and above */ dev->addr_mask = size - 1; - i2c_sethandler(dev->i2c, dev->addr & ~(dev->addr_mask >> dev->addr_len), (dev->addr_mask >> dev->addr_len) + 1, i2c_eeprom_start, i2c_eeprom_read, i2c_eeprom_write, NULL, dev); + i2c_sethandler(dev->i2c, dev->addr & ~(dev->addr_mask >> dev->addr_len), (dev->addr_mask >> dev->addr_len) + 1, i2c_eeprom_start, i2c_eeprom_read, i2c_eeprom_write, i2c_eeprom_stop, dev); return dev; } @@ -155,7 +166,7 @@ i2c_eeprom_close(void *dev_handle) i2c_eeprom_log("I2C EEPROM %s %02X: close()\n", i2c_getbusname(dev->i2c), dev->addr); - i2c_removehandler(dev->i2c, dev->addr & ~(dev->addr_mask >> dev->addr_len), (dev->addr_mask >> dev->addr_len) + 1, i2c_eeprom_start, i2c_eeprom_read, i2c_eeprom_write, NULL, dev); + i2c_removehandler(dev->i2c, dev->addr & ~(dev->addr_mask >> dev->addr_len), (dev->addr_mask >> dev->addr_len) + 1, i2c_eeprom_start, i2c_eeprom_read, i2c_eeprom_write, i2c_eeprom_stop, dev); free(dev); } diff --git a/src/network/net_slirp.c b/src/network/net_slirp.c index 80161b4be..ddfeba6cf 100644 --- a/src/network/net_slirp.c +++ b/src/network/net_slirp.c @@ -150,7 +150,7 @@ net_slirp_notify(void *opaque) } -int +ssize_t net_slirp_send_packet(const void *qp, size_t pkt_len, void *opaque) { slirp_t *slirp = (slirp_t *) opaque; diff --git a/src/pc.c b/src/pc.c index 31586a4b3..bea9d3781 100644 --- a/src/pc.c +++ b/src/pc.c @@ -809,7 +809,7 @@ pc_reset_hard_init(void) /* Reset and reconfigure the Network Card layer. */ network_reset(); - if (joystick_type != JOYSTICK_TYPE_NONE) + if (joystick_type) gameport_update_joystick_type(); ui_sb_update_panes(); diff --git a/src/video/vid_ati_mach64.c b/src/video/vid_ati_mach64.c index 52e125af2..b63b722ab 100644 --- a/src/video/vid_ati_mach64.c +++ b/src/video/vid_ati_mach64.c @@ -1741,7 +1741,6 @@ static void mach64_vblank_start(svga_t *svga) uint8_t mach64_ext_readb(uint32_t addr, void *p) { mach64_t *mach64 = (mach64_t *)p; - uint8_t gpio_state; uint8_t ret = 0xff; if (!(addr & 0x400)) @@ -1878,18 +1877,11 @@ uint8_t mach64_ext_readb(uint32_t addr, void *p) case 0xc7: READ8(addr, mach64->dac_cntl); if (mach64->type == MACH64_VT2) { - gpio_state = 6; - - if ((ret & (1 << 4)) && !(ret & (1 << 1))) - gpio_state &= ~(1 << 1); - if (!(ret & (1 << 4)) && !i2c_gpio_get_sda(mach64->i2c)) - gpio_state &= ~(1 << 1); - if ((ret & (1 << 5)) && !(ret & (1 << 2))) - gpio_state &= ~(1 << 2); - if (!(ret & (1 << 5)) && !i2c_gpio_get_scl(mach64->i2c)) - gpio_state &= ~(1 << 2); - - ret = (ret & ~6) | gpio_state; + ret &= 0xf9; + if (i2c_gpio_get_scl(mach64->i2c)) + ret |= 0x04; + if (i2c_gpio_get_sda(mach64->i2c)) + ret |= 0x02; } break; @@ -2190,7 +2182,6 @@ void mach64_ext_writeb(uint32_t addr, uint8_t val, void *p) { mach64_t *mach64 = (mach64_t *)p; svga_t *svga = &mach64->svga; - int data, clk; mach64_log("mach64_ext_writeb : addr %08X val %02X\n", addr, val); @@ -2382,9 +2373,7 @@ void mach64_ext_writeb(uint32_t addr, uint8_t val, void *p) WRITE8(addr, mach64->dac_cntl, val); svga_set_ramdac_type(svga, (mach64->dac_cntl & 0x100) ? RAMDAC_8BIT : RAMDAC_6BIT); ati68860_set_ramdac_type(mach64->svga.ramdac, (mach64->dac_cntl & 0x100) ? RAMDAC_8BIT : RAMDAC_6BIT); - data = (val & (1 << 4)) ? ((val & (1 << 1)) ? 1 : 0) : 1; - clk = (val & (1 << 5)) ? ((val & (1 << 2)) ? 1 : 0) : 1; - i2c_gpio_set(mach64->i2c, clk, data); + i2c_gpio_set(mach64->i2c, !(mach64->dac_cntl & 0x20000000) || (mach64->dac_cntl & 0x04000000), !(mach64->dac_cntl & 0x10000000) || (mach64->dac_cntl & 0x02000000)); break; case 0xd0: case 0xd1: case 0xd2: case 0xd3: diff --git a/src/video/vid_table.c b/src/video/vid_table.c index e6d2ca2c7..d675ab322 100644 --- a/src/video/vid_table.c +++ b/src/video/vid_table.c @@ -91,6 +91,8 @@ video_cards[] = { { "mda", &mda_device }, { "genius", &genius_device }, { "metheus928_isa", &s3_metheus_86c928_isa_device }, + { "nga", &nga_device }, + { "ogc", &ogc_device }, { "oti037c", &oti037c_device }, { "oti067", &oti067_device }, { "oti077", &oti077_device }, @@ -177,8 +179,6 @@ video_cards[] = { { "virge375_vbe20_vlb", &s3_virge_375_4_vlb_device }, { "tgui9400cxi_vlb", &tgui9400cxi_device }, { "tgui9440_vlb", &tgui9440_vlb_device }, - { "ogc", &ogc_device }, - { "nga", &nga_device }, { "", NULL } }; diff --git a/src/win/86Box.rc b/src/win/86Box.rc index 9cf75a9e1..ef9555e58 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -294,7 +294,7 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,57,24,50,14 CONTROL "Gain",IDC_SLIDER_GAIN,"msctls_trackbar32",TBS_VERT | TBS_BOTH | TBS_AUTOTICKS | WS_TABSTOP,15,20,20,109 - CTEXT "Gain",IDT_1746,16,7,32,9,SS_CENTERIMAGE + CTEXT "Gain",IDT_1746,10,7,32,9,SS_CENTERIMAGE END DLG_NEW_FLOPPY DIALOG DISCARDABLE 0, 0, 226, 86 @@ -302,12 +302,12 @@ STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "New Image" FONT 9, "Segoe UI" BEGIN - DEFPUSHBUTTON "OK",IDOK,74,65,50,14 - PUSHBUTTON "Cancel",IDCANCEL,129,65,50,14 + DEFPUSHBUTTON "OK",IDOK,104,65,50,14 + PUSHBUTTON "Cancel",IDCANCEL,162,65,50,14 LTEXT "File name:",IDT_1749,7,6,44,12,SS_CENTERIMAGE LTEXT "Disk size:",IDT_1750,7,25,44,12,SS_CENTERIMAGE LTEXT "RPM mode:",IDT_1751,7,45,44,12,SS_CENTERIMAGE - EDITTEXT IDC_EDIT_FILE_NAME,53,5,154,14,ES_AUTOHSCROLL | ES_READONLY + EDITTEXT IDC_EDIT_FILE_NAME,53,5,150,14,ES_AUTOHSCROLL | ES_READONLY COMBOBOX IDC_COMBO_DISK_SIZE,53,25,166,14,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_COMBO_RPM_MODE,53,45,166,14,CBS_DROPDOWNLIST | diff --git a/src/win/Makefile.mingw b/src/win/Makefile.mingw index 23dee4930..655790221 100644 --- a/src/win/Makefile.mingw +++ b/src/win/Makefile.mingw @@ -33,9 +33,6 @@ ifeq ($(DEV_BUILD), y) ifndef DEV_BRANCH DEV_BRANCH := y endif - ifndef 596B - 596B := y - endif ifndef AMD_K5 AMD_K5 := y endif @@ -96,12 +93,6 @@ ifeq ($(DEV_BUILD), y) ifndef XL24 XL24 := y endif - ifndef NO_SIO - NO_SIO := y - endif - ifndef GUSMAX - GUSMAX := y - endif ifndef USE_VECT486VL USE_VECT486VL := y endif @@ -115,9 +106,6 @@ else ifndef DEV_BRANCH DEV_BRANCH := n endif - ifndef 596B - 596B := n - endif ifndef AMD_K5 AMD_K5 := n endif @@ -178,12 +166,6 @@ else ifndef XL24 XL24 := n endif - ifndef NO_SIO - NO_SIO := n - endif - ifndef GUSMAX - GUSMAX := n - endif ifndef USE_VECT486VL USE_VECT486VL := n endif @@ -513,6 +495,10 @@ ifeq ($(CYRIX_6X86), y) OPTS += -DUSE_CYRIX_6X86 endif +ifeq ($(GUSMAX), y) +OPTS += -DUSE_GUSMAX +endif + ifeq ($(HEDAKA), y) OPTS += -DUSE_HEDAKA endif @@ -527,6 +513,10 @@ OPTS += -DUSE_MGA DEVBROBJ += vid_mga.o endif +ifeq ($(NO_SIO), y) +OPTS += -DNO_SIO +endif + ifeq ($(OPEN_AT), y) OPTS += -DUSE_OPEN_AT endif @@ -568,10 +558,6 @@ OPTS += -DUSE_M6117 DEVBROBJ += ali6117.o endif -ifeq ($(596B), y) -OPTS += -DUSE_596B -endif - ifeq ($(VGAWONDER), y) OPTS += -DUSE_VGAWONDER endif @@ -580,14 +566,6 @@ ifeq ($(XL24), y) OPTS += -DUSE_XL24 endif -ifeq ($(NO_SIO), y) -OPTS += -DNO_SIO -endif - -ifeq ($(GUSMAX), y) -OPTS += -DUSE_GUSMAX -endif - ifeq ($(USE_VECT486VL), y) OPTS += -DUSE_VECT486VL endif diff --git a/src/win/win_joystick.cpp b/src/win/win_joystick.cpp index 1f9de5ee6..2615092d3 100644 --- a/src/win/win_joystick.cpp +++ b/src/win/win_joystick.cpp @@ -263,7 +263,7 @@ void joystick_process(void) { int c, d; - if (joystick_type == JOYSTICK_TYPE_NONE) return; + if (!joystick_type) return; for (c = 0; c < joysticks_present; c++) { diff --git a/src/win/win_joystick_xinput.c b/src/win/win_joystick_xinput.c index 0e3f5fdce..4b7643c43 100644 --- a/src/win/win_joystick_xinput.c +++ b/src/win/win_joystick_xinput.c @@ -217,7 +217,7 @@ void joystick_process(void) { int c, d; - if (joystick_type == JOYSTICK_TYPE_NONE) return; + if (!joystick_type) return; joystick_poll(); diff --git a/src/win/win_jsconf.c b/src/win/win_jsconf.c index 40329c95e..49e0c2184 100644 --- a/src/win/win_jsconf.c +++ b/src/win/win_jsconf.c @@ -324,7 +324,7 @@ uint8_t joystickconfig_open(HWND hwnd, int joy_nr, int type) *data++ = 0; /*no menu*/ *data++ = 0; /*predefined dialog box class*/ - data += MultiByteToWideChar(CP_ACP, 0, "Device Configuration", -1, data, 50); + data += MultiByteToWideChar(CP_ACP, 0, "Joystick Configuration", -1, data, 50); *data++ = 9; /*Point*/ data += MultiByteToWideChar(CP_ACP, 0, "Segoe UI", -1, data, 50); @@ -342,7 +342,7 @@ uint8_t joystickconfig_open(HWND hwnd, int joy_nr, int type) item->cx = 140; item->cy = 150; - item->style = WS_CHILD | WS_VISIBLE | CBS_DROPDOWN | WS_VSCROLL; + item->style = WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST | WS_VSCROLL; data = (uint16_t *)(item + 1); *data++ = 0xFFFF; @@ -357,7 +357,7 @@ uint8_t joystickconfig_open(HWND hwnd, int joy_nr, int type) /*Static text*/ item = (DLGITEMTEMPLATE *)data; item->x = 10; - item->y = y; + item->y = y + 2; item->id = id++; item->cx = 60; @@ -369,7 +369,7 @@ uint8_t joystickconfig_open(HWND hwnd, int joy_nr, int type) *data++ = 0xFFFF; *data++ = 0x0082; /* static class */ - data += MultiByteToWideChar(CP_ACP, 0, "Device :", -1, data, 256); + data += MultiByteToWideChar(CP_ACP, 0, "Device", -1, data, 256); *data++ = 0; /* no creation data */ if (((uintptr_t)data) & 2) @@ -389,7 +389,7 @@ uint8_t joystickconfig_open(HWND hwnd, int joy_nr, int type) item->cx = 140; item->cy = 150; - item->style = WS_CHILD | WS_VISIBLE | CBS_DROPDOWN | WS_VSCROLL; + item->style = WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST | WS_VSCROLL; data = (uint16_t *)(item + 1); *data++ = 0xFFFF; @@ -404,7 +404,7 @@ uint8_t joystickconfig_open(HWND hwnd, int joy_nr, int type) /*Static text*/ item = (DLGITEMTEMPLATE *)data; item->x = 10; - item->y = y; + item->y = y + 2; item->id = id++; item->cx = 60; @@ -436,7 +436,7 @@ uint8_t joystickconfig_open(HWND hwnd, int joy_nr, int type) item->cx = 140; item->cy = 150; - item->style = WS_CHILD | WS_VISIBLE | CBS_DROPDOWN | WS_VSCROLL; + item->style = WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST | WS_VSCROLL; data = (uint16_t *)(item + 1); *data++ = 0xFFFF; @@ -451,7 +451,7 @@ uint8_t joystickconfig_open(HWND hwnd, int joy_nr, int type) /*Static text*/ item = (DLGITEMTEMPLATE *)data; item->x = 10; - item->y = y; + item->y = y + 2; item->id = id++; item->cx = 60; @@ -483,7 +483,7 @@ uint8_t joystickconfig_open(HWND hwnd, int joy_nr, int type) item->cx = 140; item->cy = 150; - item->style = WS_CHILD | WS_VISIBLE | CBS_DROPDOWN | WS_VSCROLL; + item->style = WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST | WS_VSCROLL; data = (uint16_t *)(item + 1); *data++ = 0xFFFF; @@ -502,7 +502,7 @@ uint8_t joystickconfig_open(HWND hwnd, int joy_nr, int type) /*Static text*/ item = (DLGITEMTEMPLATE *)data; item->x = 10; - item->y = y; + item->y = y + 2; item->id = id++; item->cx = 60; @@ -526,8 +526,8 @@ uint8_t joystickconfig_open(HWND hwnd, int joy_nr, int type) dlg->cdit = (id - IDC_CONFIG_BASE) + 2; item = (DLGITEMTEMPLATE *)data; - item->x = 20; - item->y = y; + item->x = 100; + item->y = y + 5; item->cx = 50; item->cy = 14; item->id = IDOK; /* OK button identifier */ @@ -544,8 +544,8 @@ uint8_t joystickconfig_open(HWND hwnd, int joy_nr, int type) data++; item = (DLGITEMTEMPLATE *)data; - item->x = 80; - item->y = y; + item->x = 160; + item->y = y + 5; item->cx = 50; item->cy = 14; item->id = IDCANCEL; /* Cancel button identifier */ @@ -558,7 +558,7 @@ uint8_t joystickconfig_open(HWND hwnd, int joy_nr, int type) data += MultiByteToWideChar(CP_ACP, 0, "Cancel", -1, data, 50); *data++ = 0; /* no creation data */ - dlg->cy = y + 20; + dlg->cy = y + 25; DialogBoxIndirect(hinstance, dlg, hwnd, joystickconfig_dlgproc); diff --git a/src/win/win_settings.c b/src/win/win_settings.c index ee442179a..e999d6a64 100644 --- a/src/win/win_settings.c +++ b/src/win/win_settings.c @@ -806,6 +806,9 @@ win_settings_machine_recalc_machine(HWND hdlg) SendMessage(h, WM_SETTEXT, 0, win_get_string(IDS_2086)); } + settings_enable_window(hdlg, IDC_MEMSPIN, machines[temp_machine].min_ram != machines[temp_machine].max_ram); + settings_enable_window(hdlg, IDC_MEMTEXT, machines[temp_machine].min_ram != machines[temp_machine].max_ram); + free(lptsTemp); } @@ -5007,7 +5010,7 @@ win_settings_confirm(HWND hdlg) SendMessage(hwndChildDialog, WM_SAVESETTINGS, 0, 0); if (win_settings_changed()) { - if (confirm_save) + if (confirm_save && !settings_only) i = settings_msgbox_ex(MBX_QUESTION_OK | MBX_WARNING | MBX_DONTASK, (wchar_t *) IDS_2121, (wchar_t *) IDS_2122, (wchar_t *) IDS_2123, NULL, NULL); else i = 0;